I took apart my garage door remote, soldered wires to the button contacts, and hooked them to a relay controlled by ESPhome (Wemos D1 Mini) in order to open/close my doors. The problem is that when I supply the power to the Wemos D1 Mini it turns on the relays for a split second, this will cause the doors to open. Normally, not a big deal. But if the Wemos loses power then regains power it would open all my doors. Is there a way to prevent this millisecond of turning the relays on? I’m also providing 3.3v power to the garage remote using the Wemos 3.3v pin. I’ve considered finding a way to cut the power at startup. Is there code that I could add to ESPhome that would toggle a switch command 1 second after startup? Then I could wait 1 second before supplying power to the remote control.
The relays are wired to be normally energized, but I don’t know how I can wire them differently to be normally de-energized. Instead, I used the inverted: true in my esphome code. But it takes maybe 200 milliseconds for the relay to invert after powering on the Wemos.
The wire are currently wired to the C → NC. If I use the opposite contact (C → NO) on the relay then the doors will all open once the wemos and relay lose power as the relays will de-energize and the C and NO will be connected.
You need to wire them to be normally de-energised. That way loss of power (or power on) won’t activate them.
Which relay (module?) are you using?
If you use C & NO (normally open) and wire the relays to only come on and close the contact when you activate them then you will not get glitching or activation on power loss.
That won’t work. Without inverted: true in my ESPhome code the relays energize by default once the Wemos D1 Mini receives power and will then open the garage doors.
I even tried adding restore_mode: ALWAYS_OFF but it still turns on for a split second when it receives power.
And you are correctly using the C & NO contacts (so the contacts close when you activate the switch).
The only other thing I can think to suggest is to add physical 3.3V pull-up resistors to ensure the inputs are held high before the GPIOs are configured as outputs. Any value from 1K to 10K Ohm should work.
However if these outputs are actually pulled low for some reason at boot this is unlikely to help.
I found a work around. I’m powering the remote control using the 3.3v from the ESP board. I routed the 3.3v power from the ESP to the 4th relay on the board. But I used the C>NC instead of the C>NO I’m using for the controls. Then I removed the invert:true from that relay command. Finally, I used an ESPhome automation to turn that 4th relay “on” 2 seconds after boot. This way the power is cut from the remote for the first 2 seconds of boot up, the same time the other relays turn on briefly.
I just wanted to leave a comment to this unresolved post since this is the first hit in google.
Adding the following line helps, as well check the pinout diagram of the wemos d1 mini, some pins are high at boot. D1, D2, D3, D5, D6,D7, D8 works.
Hi @dansity your solution is brilliant. It works for me.
Is that happening for Wemos D1 only or this is for every ESP32 / ESP8266 board?
Thanks
Vasilis