Fisch´s Projekte-Seite

Project start: January 2021

Last updated: May 2021

IoT double roller blind




This project is about automating off-the-shelf double roller blinds.
Double roller blinds have a curtain that is attached at the top and also is rolled up at the top. At the folding point a bar is used as a weight to keep it from bulging. The user can then pull on a drawstring to wind the blind up. Some blinds use alternating patterns of clear and opaque fabric. This makes it possible to pull up a few centimeters until two clear parts overlap which makes them more translucent.
Exchanging this mechanism for a motor seemed too easy. And off another project goes.

Sadly I didn't take any pictures after the first installation. So heres just a photo from the part I did exchange.
The motor is a DC Geared Motor TDY-12 running at 15 rpm at 12 Volts.


As you might see in this picture two windows have to be taken care of. The printed motor mount gets slotted into the bracket on the window. The 15 rpm variant has a gear ratio such that the friction is high enough to prevent the blind from undwinding on its own. I decided to put the motors on the handle side of the window, so they don't have a risk of getting squished between the window frame and the wall. This however made it neccessary to route the cable along the width of the window to the hinge. A few 3D printed cable clips made it tidy again.


However, these types of blinds have a big problem. If you roll it up or down too much the materal can rip off. This made it very important to at least sense the end points. In 2010 I tried to solve this problem by using reed switches and magnets. A small deviation in position or a loss of magnets results in the mentioned critical failure.
This time I chose light barriers. Those consist of an infrared LED and a matching phototransistor in terms of wavelength. Mounted just below the roll light can shine through the fabric and gets sensed by the forked light barrier. A black strip electrical tape marks the upper end of the blind.


An ESP8266 (Wemos D1 mini) is used to control both blinds and to connect to the IoT Network. The motordriver is a "Wemos D1 Motor Shield", consisting of a TB6612 and I2C capability. This double H-bridge can control both motors independently. By the use of a 10k ohm pull-up resistor at the phototransistors it was also possible to get analog measurements from the forked light barrieres (Liteon LTH-301). The fact that the fabric alternates between clear and opaque parts was quite useful. The alert reader may point out the fact that the ESP8266 has only one ADC capable input. Because a phototransistor shows high-impedance when no light is shining on it both fork barriers can be connected in parallel. Time multiplexing of the LED's through two digital outputs made it possible to measure both sensors on after the other. Every 25 ms the ADC gets read and the LED's switch states shortly after.


Interpreting the measured values took me some time. The following images show the adc values over time. Here I used a median filter over the last 10 values as a way of smoothing the signal. The avarage resulting latency of 2 * 25 ms * 10/2 = 250 ms seemed low enough.
As you may notice the measurements differ quite a lot in the center region where the opaque material is sensed. This could be because of the manufacturing tolarances of the phototransistors and LED's but also because sunlight hitting the sensor (see 3rd picture where the blind is standing still after half of the time).


The colored areas signify the upper and lower boundaries defined in the code. Each time a sensor is read it will try to classify the material in to one of the three possibilities (clear, opaque, end).
Because the movement direction of the motor is defined by the controller, it should be possible to calculate the blind position. However, for this to work a reference position has to be defined. This is where the black strip of tape comes into play.
Let's take the graph "Initialization Left" as an example, where the motor is driving the blind up. At time t=0 s until t=95 s it is not known how far the blind is unrolled. At around t=95 s the end marking is sensed. Now this position is assumed at 0 mm (up). After this every change from clear to opaque fabric can update the position, because the length of 50 mm (clear) and 74 mm (opaque) are known.
To be able to aim for in-between positions a digital modell is used to simulate process dynamics for the time no change of material is detected. This "digital twin" uses the estimated speed and acceleration for the motors for down and for upward motion. The speeds also depends on the current position, because the blind moves quicker if more material is still rolled up, assuming a constant rotational speed.
Furthermore error checking is made possible by the use of such a model by comparing the deviations from the estimation to the real world. If this error gets too large the blind is stopped immediately and a manual reset is needed.

The next image shows moving to the position 865 mm (the blind will move 432 mm down) starting at the top most position. The black strip (pos=0 mm) follow 27 mm until the first clear part. Seven clear (7 * 50 mm = 350 mm) and six opaque (6 * 74 mm = 444 mm) sections later only 44 mm are missing to the requested position. This distance is covered by the simulated movement, such that the blind will stop at around the correct position.


As always the housing for the motors and boxes for the electronics are missing. More pictures to come when its finished.


CAD & Code: repos.ctdo.de/interfisch/blinds_motorcontrol