This is a design for a vertical blinds controller with Alexa integration and manual override in the form of a rotary encoder. The intention is to close the blinds automatically at night and open them during the day.
The unit is powered from a 5 volt USB mains supply (>= 2A recommended)
The mechanical mechanism is designed to pull the ball chain on a set of vertical blinds (note: it does not 'draw' the blinds from side to side - it only controls the vertical position).
A 6 turn sail winch digital servo (GWS S125 6TD) was selected for the main drive for the chain operation. This was chosen based on the amount of movement required to fully rotate the blinds (0 to 180 degrees) as a standard servo would not have enough rotation for full blind operation without some form of gearing.
The advantage of using a servo here is that the blinds angle is directly related to the servo position. It would be possible to use a standard or stepper motor but some form of feedback on the position would then be required, particularly at power up and this would make the mechanical design more complex. The use of a digital servo also means there is no requirement for high current motor drive circuitry.
To link the servo with the chain, I designed a 3D printable pulley which mated with the servo drive shaft. The pulley disc itself is shaped to mesh with the ball chain. The pulley disc is attached to the servo by mating with the spline and using the normal central screw to secure it in place.
The single piece print was good but could probably be improved by splitting the disc into 2 parts (to avoid overhangs) and print them separately. The two halves could then be glued together afterwards.
The tricky part of this project is finding an enclosure to hold the servo, electronics, and allow looping of the chain around the pulley and fix it to the window frame. I managed to use a PSU case for this purpose. This allowed the servo to be bolted to the case and maintain the required position of the drive wheel so that the blinds chain could be kept vertical. Although not ideal, it does the job. A 3D custom printed enclosure would be an improvement.
Fixing the enclosure to the window frame was done using Velcro to allow easy placement and removal.
A rotary encoder was added to provide manual control of the blinds (at my wife's request!).
Also, an LDR (light dependent resistor) was also included to sense the light level. This could be used to close the blinds automatically when the sunlight exceeds a certain level.
Note: If you implement the LDR, ensure you place it on the appropriate side of the enclosure (i.e. to face the window). This will depend upon which side (left or right) of the window the blind chain is on! Also the code may need changing to reverse the servo direction. The same warning applies to the mounting of the encoder.
The project uses an Arduino WEMOS D1 Mini as the main controller. This provides the WiFi interface and is small enough to fit in the enclosure but provide sufficient I/O pins.
The code has an optional start up section which will put the servo into its central position for ~20 seconds. This allows the blinds to be similarly positioned in their mid-position and for the chain to then be hooked around the drive wheel. The enclosure base can then be screwed on and the whole unit attached to the window frame. Once the chain has been successfully synchronised to the servo position, the start up section of code can be removed (via OTA) to speed up initialisation of the unit in case of power cycling.
The CodeThe code connects to the WiFi and then sets the current time of day and date from the internet via an NTP (Network Time Protocol) call. This is essential in order to calculate dawn/dusk times and open/close the blinds at the required times. Alterations may be required depending upon your position on earth and for any daylight savings.
The code supports OTA programming so that the unit does not have to be removed each time to download any code updates.
The initial version of code supported MQTT publishing/response so that the blinds could be controlled via Home Assistant (a slider on the home screen could be adjusted to set the blind angle). The LDR also submitted readings to the MQTT so that other devices could make decisions based on the readings. However I removed all the MQTT interface following failure of the Raspberry Pi MQTT server (the flash memory card) which caused the code to hang because it couldn't connect. This could be re-introduced if required by improving the control around the connection routines. I've not done this because I found it isn't really necessary if the unit is autonomous.
The servo has a tendency to judder slightly when trying to maintain its position. This can be a bit annoying and so the PWM drive is detached (in code) after the servo has had enough time to get to its position to prevent this vey slight movement.
Alexa integration was done using Xose Perez's excellent fauxmoESP library so as well as automatically opening/closing the blinds at the correct time of day, they can be opened/closed via Alexa voice commands.
A rotary encoder was included to allow manual control of the blinds to any desired angle. The controller will revert back to automatic mode at the next programmed change. Pressing the encoder's button will immediately put the unit controller back into automatic mode and the blinds will then go to the current automated position. Rotary encoder changes are handled by pin interrupt via the ESPRotary library written by Lennart Hennigs.
Handling the sunset/sunrise etc. timings was based on the TimeLord library.
The code also includes a webserver so that the current status of the controller can be requested from a web browser. The status consists of the current date/time setting, WiFi signal strength, whether or not BST is active, the predicted sunset, sunrise, dawn, dusk times, the LDR reading, the current blind position (degrees) and the current rotary encoder position (degrees).
Comments
Please log in or sign up to comment.