Do-it-yourself smart curtains

    Once, after a hard day, I came home and realized that I wanted to relax, and not walk and close the curtains. I would like to see them closed in the evening and open in the morning, while not dancing in front of the window. Googling different decisions, it was decided to do everything by myself.



    By popular demand, I post all my best practices for remaking conventional roller blinds into automated ones with remote control. Caution, a lot of photos!

    For starters, about roller blinds:

    • Pros: roller blinds visually expand the space, beautiful and inexpensive. Very easy installation. You can control each window separately. Free space on the windowsill.
    • Difficulties: manually opening 5 windows already takes a long time. The mechanism itself interferes with opening the full corner window (example: the mechanism at the top of the balcony door abuts against the wall and prevents the passage from being opened completely). Because of this, it is necessary to hang curtains from the outside of the window. The price even for Chinese motorized curtains starts at 2,000 rubles, we multiply by 5 and immediately think about how to do everything with the means at hand.



    A little about the tasks:

    It is necessary to add remote control to ordinary roller blinds from the building store and connect it to the smart home on the openSource Home Assistant platform . And you still need to keep the usual control of the rope.



    The choice of motors:

    If everything is automated, then speed does not matter, so you can use motors with a gearbox. Collector motors are cheap, but not the most reliable thing for daily use. Servos also have commutator motors and plus are not stable with constant rotation. A great option is stepper motors. Silent, you can control the situation, there are a penny. As a result, a set of 5 28BYJ-48 engines with ULN2003 driver cost me $ 10



    About the 28BYJ-48 engine:

    Details about it can be found here .

    There were questions about the power of this engine. Fears that he would be weak did not materialize. Or rather, if you use full-step mode, the engine is very frail, if you use half-step, then the shaft cannot be stopped with your bare hands. To whom there will be little power, there are a lot of articles on the Internet how to raise tension, turn it into bipolar and other improvements.

    About sensors:

    Since we still have manual control, and we don’t want to drive the engine for nothing, curtain position sensors are needed. At least one sensor is needed at one end, but two is better. You can use any terminal, optical, etc., but I personally chose the reed switch, because gluing a neodymium magnet on the other hand is very simple and should work stably and durable. I have chosen reed switches for aesthetics already in the case. Plus provided for the adjustment of the distance from the shaft. The height can be adjusted with spacers.



    About the mounting design:

    The task was to design the case as simple as possible for manufacturing on a 3D printer with minimal modifications. I modeled it in Fusion 360. The complete mount clings to the top of the window, but such a design on an FDM printer will be difficult to do with the required strength requirements, so a design with one screw for adjustment was invented.



    In total, three details were obtained for 3D printing. Link to download 3D models .

    Main part for the motor, control board on ULM2003, mounting reed switches, motors, fishing line for stabilizing curtains, and adjusting screw.

    Cover for closing all this disgrace. Clamp or otherwise hook.



    The design of the curtains itself contains several springs that work like a brake if you pull on the curtains (the spring is tightened) or lets go if you twist on the rope.





    When assembling, you need to make one refinement: break the rim with the wire cutters, which covers the rope, because Now we have our own fixed bezel, which prevents the rope from falling out.



    Management:

    NodeMCU on ESP8266 will control the stepper motor. It is chosen because of its low cost, availability of a backup wi-fi channel, and it is quite easy to write the necessary scripts on it. If you need more than two curtains or additional sensors, then the legs of the microcontroller will not be enough, you can look towards ESP32. (not shown in esp32 photo, because it is in the junction box)



    Software part:

    The development environment can be any. ESP32 can be programmed through the Arduino IDE. But I chose Visual Studio Code for myself because of speed, modularity and free. In this environment, you can develop almost any platform (not just hardware). You can even connect the IAR ARM. (But this is a completely different topic)

    The program’s task is simple:

    Connect via Wi-fi
    Connect to the MQTT broker
    Subscribe to the topic
    Manage the speed of two motors
    Monitor the status of end sensors
    Send brokers current steps

    Sources can be taken from here . (Carefully this is the very first bydlock code for curtain testing). In the code you need to specify your username and password from wi-fi. As well as the parameters of the MQTT broker .

    We fill in the program and try to send the first data through MQTTBox. Everything works! How to add curtains to the home-assistant system I will write a separate article, if everyone is interested.

    A short video of how this was done:



    Plus, the presentation at what stage my smart home is.

    I wish everyone to relax at home!
    UPD: Link to download files for printing on a 3D printer

    Also popular now: