I finally finished my automated (vertical) blinds and its now time to share my work.
The goal was to control my blinds using domoticz, since it costed to much time and effort to manually change them when the sun moved.
this project uses a Wemos board that subscribes to a mqtt topic on the raspberry pi which runs domoticz.
The phyisical part
I used the following parts:
- Wemos D1 mini
- EasyDriver - Stepper Motor Driver
- 12 to 5 volt converter Fine
- 2.1 DC power socket
- 17HS2408 4-lead Nema 17 Steppermotor
- N/O reed switch (normal open)
- Parametric ball chain pulley
- 3D printed case
- Tesa powerstrip (to mount case to wall)
The Easydriver board has a build in 12 to 5 volt converter, however it gets really warm and using the Fine converter lowered to idle power usage from 0.11 to 0.04 ampere (at 12volt)
The reed switch is optional, it works as a stop limit using a tiny magnet on the ball chain.
Everything in the case:
The software part
In domoticz a Virtual switch is created (named LamellenStudie in this code) of type Blinds Percentage. This switch is assigned to a floorplan(example) and to a roomplan(Lamellen). Domoticz will then send out any any changes done to the Virtual switch to the MQTT topic domoticz/out/example/Lamellen where the Wemos board will subscribe to.
The Wemos code
This is the first time i programmed a board, imo the code is messy, if you guys have improvements let me know.
line 68 is depends on the length of your switch name, there must be a smarter way to do that.
domoticz script that follows the sun
in the above script i have setup the sBegin, sMiddle, sEnd variables to the angles of the sun related to my window.
sBegin is when the sun starts shining on my window, sMiddle is when the sun is 90degrees to the window (blinds need to turn the other way), and sEnd is when the sun is gone.
When the sun is not shining on the window the blinds go open (halfway).
It checks the strength of the sun(very usefull on these dark days of the year) using weather underground and if the TV\PC is on (closes the blinds slightly).
the value's in the script are in the range of 1 to 15 since that is what domoticz sends using mqtt.
there is a virtual debug switch that enables extra log.