Smart curtain with Blynk

The purpose of this project was to automate the curtain on my window. When I go to sleep, I close the window so that the room is completely dark. But when the alarm clock rings, it's hard to get up without sunlight. Hence the idea that the curtain should automatically close when I sleep and open when I wake up. Additionally, I built the device in such a way that it will not open the curtain at the given time if it does not detect the sun, only after detecting the light the window will be opened. So if the opening is set for 6am, and the sunrise is at 7am, the curtain will open after 7am.


Elements

To build the device I used a NodeMCU development board equipped with an ESP-12E Wi-Fi module which allows to connect to the Blinky server via a router connected to the WAN. Another important component is the 28BYJ-48 stepper motor, it moves the wire which allows for rolling up and down the window curtain. The signal controlling the motor is fed from four GPIO ports of the NodeMCU board to the driver based on the ULN2003 chip, which amplifies the signal fed to the stepper motor coils. Additionally, I attached a light sensor (photoresistor) to the ADC port of the 10-bit converter.

Code

I used Arduino IDE environment to program ESP8266. The program code was written in C++ language using Blynk libraries. This allowed me to use features such as: downloading real time from the server, automatic start at a specified time, controlling the device using a Android widget.

See GitHub page