Creating automated curtains that open and close is fairly easy with some knowledge of electronics, computers and elementary physics. In fact the operating principle is so simple that the realization constitutes the area where most of the effort has been expended. This tutorial shows the operating principle and runs through the realization showing the various components that have been used to create this automation whilst providing the code and showing where the items can be obtained from.
This project is part of the environmentalism reel of inventions and made for the second revision of the hydroponics wardrobe hence the plants inside. You can check out the hydroponics project at the second revision within the environmentalism section if you would like to see its application as part of a different project. Interestingly, the automated curtains project uses its own ESP controller such that it can be used independently of the hydroponics controller and this was made intentionally because controlling curtains is not something that would be inherent to a hydroponics bay.
The operating design is very easy to grasp, it is based on one single motor combined with a spindle wheel on the other side and with a band or wire that connects the two. The idea is so simple that first we did not understand what was going on when we watched a YouTube video based on a similar project from 2016 by Fluxwood Manufactory. Perhaps when people are told about a "curtain system" they think up complicated ways of connecting the actual shaft that the curtains are suspended from to the rotational motion of a motor. In reality, the solution just consists in using a piece of wire and just tying a thread or belt between the motor wheel and the far-end to the hoop of the curtain itself.
The cable or conveyor belt that moves between the rotating motor and the wheel on the other end has a wire attached that clamps to one end of the curtain. The other end of the curtain is fixed so it cannot move. When the motor starts moving the cable, the end that is connected to the belt will start moving and compressing the curtain thereby opening the curtain. In reverse, when the motor engages in reverse, it will pull the end away from the extreme wheel and thereby close the curtains.
The extreme wheel is just a free-spinning wheel that is not connected to any motor and it is just meant as the counter-rotor for the motor wheel.
In principle it is possible to just use some thread or wire but it was decided to a pair of wheels and a plastic conveyor belt that were initially meant for a 3D printer in order to reduce step errors. A thread that would be tied between the two wheels of the motor and the far spindle would have done just fine but the conveyor belt and the wheels have small insets or crevices into which the treads of the conveyor belt fit such that traction can be properly accounted for because the belt does not slide.
The motor used is a NEMA17 which is a step up (ha!) from a regular cheap stepper-motor and it provides precise, stable and trackable movement. One of the more difficult tasks has been cutting the conveyor belt and then gluing it to size. In order to do this, the free-spinning wheel on the opposite end of the stepper motor wheel is fixed with a central pivot that can be loosened and the wheel can be rotated away from the motor or closer - it is a small movement of about but that provides sufficient clearance to attach the belt. The procedure becomes a matter of pulling the free-spinning wheel close to the motor, wrapping the conveyor belt around the motor wheel an the free spinning wheel and then finally pushing the free-spinning wheel away and screwing it in place in order to tighten the conveyor belt.
As cans be observed from the images on both ends of the curtains, the far end with the free-spinning wheel is fixed such that the curtain cannot move whereas the other end close to the motor is attached "dumbly" to the coveyor belt with a piece of rotated copper wire. Even though this is a very simple solution, any more sophisticated solution would have just been a visual embellishment. For example, the copper wire could have been replaced by two alligator clips connected by, say, some elastic thread but this would not have changed the operating principle much. In fact in this realization, the conveyor belt is actually punctured and the wire is passed through the middle of the belt but just attaching the wire without drilling a hole into the belt would have also been fine.
The motor control automation uses a WeMoS D1 Mini ESP8266, a TMC2208 controller and a NEMA17 motor. All of these components are extremely cheap, except the NEMA17 motor that is actually very expensive compared to alternatives. The build of the motor can be immediately sensed as quality, being made entirely out of metal, heavy and with an axle that seems to rotate flawlessly concentric without and waggle.
A WeMoS ESP8266 is used instead of an ESP-01s due to the number of required pins. The NEMA17 itself is connected to the TMC2208 motor controller via 4 wires and the TMC2208 is connected to the ESP8266 using three wires and one optional wire such that the ESP-01s, even if very small, would not have worked at all.
The circuit is not that difficult and typical wiring methods are well-documented. In principle, the motor is connected with one pin that enabled the motor, one pin that selects the direction (clockwise or counter-clockwise) and one pin that when toggled makes the stepper-motor execute a step. There is some software clunkyness with various libraries that are designed for various combinations of motors and controllers but the combination of a TMC2208 and a NEMA motor is of sufficient good quality such that the motor could just be controlled manually without even using a library. The libraries themselves also do not cover the entire functionality such that, for example, a well-known library like "AccelStepper" will still require the user to enable the motor first by using digital I/O.
One of the problems experienced was the infamous "jittery motor" which is perhaps one of the most annoying issues to deal with. The symptoms include a motor that: does not spin the correct way around, moves suspiciously slow, just trembles or vibrates as if it is just a piece of garbage, etc, all of which are pretty daunting because if the other parts are done correctly would just hint that the motor is junk. What people say is that there are very many motors on the market and that some of them have the wires wrapped wrongly such that the middle two wires should be switched in case the motor jitters. As an extension of that, any stepper motor that exhibits the same type of behavior just has an issue with the wrong coils being energized in the wrong order such that anything related to the pins and wires could be the culprit. During this realization the issue was that the circuit draw on the bottom would make a bad contact between on of the pins and a different copper wire, leading to a motor that just sits there and vibrates. In this case, the PCB was recycled from a different project, cleaned and then the components were fit onto the PCB but without planning ahead too much on the circuitry on the bottom which required various bridges to be erected in order to create parallel circuitry which ended up shorting between layers. As a takeaway lesson, it is important to be very careful when designing the circuitry and make sure that everything is connected cleanly and without making the design too complicated.
Another difficult part has been connecting the belt together because there is no intuitive way of doing that elegantly. The belt is just cut and then glued together. It was decided to use both glue and a heat-shrink tube that was inserted and then shrunk on top of the connection. The connection is good, but it is not ideal because one would have expected a solution that would preserve the treading of the conveyor belt and the tube actually creates a slipper portion that will not bite into the insets of the wheel. There exist crickets that could possibly fix the two parts of the belt together but the project was just realized with the tools at hand without looking more into it.
There are any connection diagrams out there for the TMC2208, some even using the NEMA:
but they are all just orientative because depending on the application one would need to stray away from the design. Here are some notes:
MS1
and MS2
can select the stepping type (the degrees that the motor performs) but leaving them both floating low just means a full step such that that part of the circuit can be ignored. In reality, this realization connects MS1
and MS2
to the Arduino in order to allow a template to dynamically select the stepping type.RST
and SLP
are connected with RST
actually being a PD
pin for programming the TMC2208v3. This connection does not need to be made and can be left floating.EN
absolutely necessarily has to be connected to the Arduino because the EN
pin allows enabling and un-enabling the motor - in this field, "enabling or "disabling" the motor carries special meaning: when a motor is "enabled" the main axle becomes rigid and cannot be spun by hand such that "enabling" is also sometimes referred to as "locking" because the motor cannot be spun at all. "Disabling" the motor then allows the axle to be spun. However, there is also a downside to this mechanism; "enabling" the motor or "locking" it means that there is current flowing to the motor which raises the power consumption and heats the motor. For the curtains application the mechanism was useful because during testing the curtains had to be re-adjusted such that allowing the main axle to spin freely by hand allowed the conveyor belt to be moved by hand back and forth.With that said, the following is the updated block diagram that was used for the realization of this project.
The capacitor is functionally equivalent to a tiny battery that acts as a buffer on the input feed and it is specifically in order to trim any input spikes because typically attach powerful motors to these controllers. However, for pulling curtains, the force required is way beneath the torque force of the motor such that the capacitor could be omitted.
The software used to drive the project is show on the step motors page where some template code is given that is made to spin a single motor. The template is sophisitcated because it incorporates wifipreboot template that is made to ensure that the Arduino remains connected to the network. However, the actual driving of the motor is accomplished by the MultiStepperLite library which was chosen due to its simplicity.
One realization when creating the project is that using a stepper motor was a bit of an unnecessary adventure because for this application, a standard DC motor and a relay would have sufficed to get the job done. The "stepping" was needed here because precise movement is need in order to ensure that the motor does not pull the curtain too much or too little or, in other words, to ensure that the closing and opening of the curtain is as deterministic as possible. However, in spite of wheels with insets an in spite of conveyor belts with matching teeth, there is still some degree of error that might occur depending on the environment such that it is still possible for this system to fail catastrophically. Interestingly, before using glue, just some thermal shrinking heat tubes were used such that when it was decided to write about this project and film a demonstration, the belt snapped and had to be glued together again (this time, using permanent glue!).
One way to prevent these errors that was thought of during the realization, was to use two micro-Hall sensors that detect magnetic fields and then to place a very tiny magnet on the part of the curtain next to the motor. As the small magnet travels, it will first impress a sensor placed close to the motor, denoting the "closed position", and then it should travel to the other senor on the far end, close to the free spinning wheel, that will denote the "open position". This additional feedback element will provide a non-dependent auxiliary system that will be able to determine on its own whether the left-edge (opening edge) of the curtain is in the "open" or "closed" area. This auxiliary system could then feed into the stepper motor system in order to refine the movement. As mentioned, right now, the number of steps to open an close the curtains is just measure empirically (ie: 13000 steps) and the mechanism just relies on the quality of the motor to not overstep or understep in order to make the roundtrip from open to closed. Using two sensors could even eliminate the need for a stepper sensor and just a DC motor could be used (on or off) because the sensors would be able to account or track the curtain position. In principle, these motors and belts are designed for machined systems where every part is designed to fit with another part down to micron, however, this is a "wild" project where the length of the curtain and the placement is rather arbitrary and do not represent some meaningful values.
Lastly, as mentioned, the belt was one part of this project that felt like wasted material. Given that the length of the cupboard is not meaningful, the very same system could be easily scaled up or down for any curtains! However, the fact that the belt must be cut to size makes the whole project bound to this wardrobe. Some more documentation is needed, perhaps a belt exists that can be somehow snapped in place and made larger or shorter without having to cut material; maybe something with a snapping mechanism or made out of velcro. If this part of the project is solved, then this curtain automation could be a self standing project that could be delivered ready-made. Right now it could be commercialized but a few meters of conveyor belt would have to be supplied with it an the cutting let up to the user (nope). A trivial solution would be to just switch over to … using bicycle gears on both ends and connect them using a regular bicycle chain. It seems overkill but bicycle chains can be made larger or smaller without wasting material and both gears and chain should be very cheap due to surplus of availability.
It is a simple trick, so worth mentioning but double blinds can be automated using the exact same project with no changes simply by attaching both edges of the curtains to both sides of the conveyor belt such that once the motor is engaged, both halves of the curtains will move in opposed directions, either closing or opening. Even intuitively, the distance traveled should be half the steps that the single curtain steps; that is, half clockwise to close and then half counter-clockwise to open.
For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.