Overview
This project automated a pair of apartment curtains using a temperature sensor, a Pycom microcontroller and a stepper motor. When the room became too warm during the day, the system could close the curtains to reduce incoming sunlight and reopen them once the temperature dropped again. Temperature readings, curtain state and balcony-door state were also recorded and presented in a web dashboard, making it possible to compare the apartment's temperature over time with what the curtains were doing.
Architecture & Implementation
The system was split between an embedded controller at the curtains and a small web application used to inspect the collected data. The Pycom board measured the room temperature, controlled the stepper motor and sent each measurement over UDP. The web application read the resulting records from MongoDB and exposed them through an Express API to a browser-based dashboard.
flowchart LR
subgraph Device[Automated curtains]
sensor([Temperature sensor]) --> controller[Pycom controller]
controller --> motor([Stepper motor])
end
controller -->|UDP readings| server([Home server])
server --> database[(MongoDB)]
database --> dashboard[Web dashboard]The firmware spent most of its time in deep sleep and woke at regular intervals to take a new measurement. Instead of relying on a single temperature reading, it collected 100 analog samples, averaged them and checked the difference between the highest and lowest values before accepting the result. Batches with too much variation were discarded and sampled again, reducing the effect of inconsistent sensor readings.
Automatic curtain movement used two temperature thresholds rather than a single switching point. The curtains closed at 30 °C and reopened once the temperature had fallen to 28 °C, preventing repeated opening and closing when the temperature hovered around the limit. Automatic movement was also restricted to daytime hours. The current curtain state was stored in non-volatile memory so it could survive deep-sleep cycles, while a physical button provided a separate manual way to open or close the curtains without having the automatic logic immediately reverse the action.
The same measurement cycle also recorded whether the balcony door was open or closed and synchronized the device clock over NTP so readings could be timestamped. Each transmitted record contained the measured temperature together with the curtain and door states, allowing the web side to relate changes in room temperature to what was happening in the apartment.
On the web side, the stored measurements were exposed through an Express application and visualized with Google Charts. The browser calculated values such as the daily average, minimum and maximum from the raw readings and displayed the measurements day by day. This made the project more than a motor-control experiment: the same system that reacted to the temperature also produced a history that could be used to inspect how those changes developed over time.
This project was built as part of a university course, Introduction to Applied Internet of Things.