Smart Blinds with ESPHome
How to Control an Electric Blind
When purchasing an electric blind, if it doesn't have speed control, it will have 4 wires.
- Green-Yellow: Ground
- Blue: Neutral (Electricity return)
- Black: Line to raise the blind
- Brown: Line to lower the blind
Check your blind's instruction manual to verify the color codes
How to Control an Electric Blind with ESPHome
To control such a simple electrical circuit, we can use two relays to activate the raising or lowering of the blind.
There are two ways to connect the relays:
- Connect a Phase relay to the raising line and a Phase relay to the lowering line of the blind.
This can be dangerous because both relays can be activated by software and burn the blind's motor. - Connect a relay to the phase, and that same relay to the other relay.
From the second relay, connect the output of the first relay and connect the two outputs of the relay to the raising and lowering lines.
This way, you can control with the first relay whether the blind receives electricity, and with the second, whether it goes up or down.
In both options, it is necessary to connect the neutral wire of the blind to the house's neutral and the ground wire of the blind to the house's ground.
We will use the second option because if there are software or hardware problems, there won't be issues with the blind's motor activating both the raising and lowering phases.
Code for ESPHome
cover:
- platform: time_based
name: "Time-Based Cover"
open_action:
- switch.turn_on: power_cover_switch
- switch.turn_on: direction_cover_switch
open_duration: 18s
close_action:
- switch.turn_on: power_cover_switch
- switch.turn_off: direction_cover_switch
close_duration: 17.5s
stop_action:
- switch.turn_off: power_cover_switch
- switch.turn_off: direction_cover_switch
switch:
- platform: gpio
name: "power_cover_switch"
id: "power_cover_switch"
pin: GPIO23
inverted: True
- platform: gpio
name: "direction_cover_switch"
id: "direction_cover_switch"
pin: GPIO22
inverted: True
In this code, GPIO pins 22 and 23 are used to control the 2 relays. Change them to whichever ones you prefer. You should also adjust the raising and lowering times.
Source: https://esphome.io/components/cover/time_based.html
The Relay Burns Out After a Few Uses 🔥
If after some time the blind only goes up or down, it's possible that the relay that changes the direction has burned out.
This is because motors, when they stop abruptly, cause a voltage spike effect, reaching between 4 and 10 times the usual voltage. In Europe, this could be up to 2500 Volts.
Voltage Spike Graph
More info at: https://passive-components.eu/rc-snubber-design-for-smps-protection/
To address this, there are RC snubber circuits. R for Resistor and C for Capacitor.
They should be placed around the relay closest to the load, in this case, the blind's motor. Because we have 2 possible load circuits, both raising and lowering, two snubber circuits should be installed. Both will be connected on the resistor side to the connection between the first activation relay and the second direction relay.
The other end will be connected between each end of the second direction relay.
I have tried placing the relay between both relays, and still, the second relay burned out.
RC Snubber Circuit Module
You can buy them on AliExpress: https://s.click.aliexpress.com/e/_DeBu6tN
And on Amazon: https://www.amazon.es/dp/B091FL19WV?psc=1&ref=ppx_yo2ov_dt_b_product_details
Tests
Once you configure everything, you can connect it to Home Assistant.
This way, you can make the blinds go up in the morning and go down at midday in summer or whenever you want.
To avoid overloading the cables, I recommend that the blinds go up or down one by one; besides, it will look like someone is doing it, and it's always good to simulate presence.
I hope to provide more details about this soon. If you want me to keep doing this, let me know with some interaction.