Using an ESP8266 Dual Relay Combo Board with Home Assistant

So, I grabbed one of these dual-relay ESP8266 boards from Amazon to have a more compact unit than my older setup with ESP32 and two 3v3 relay boards. Had no problem flashing ESPHome to the ESP-01 board, and it boots up fine when connected to the relay board. Here’s the problem: Whether I use the longer UART byte sequence (with preamble) or the shorter sequence (without preamble) the led behind each relay lights red when I turn on that relay using Home Assistant. What does NOT happen: I don’t hear a click, and it does not appear the relay is actually firing/contacting? I’ll try a higher power 2A USB brick next and see what may happen.Nope, the 2A USB power supply made no difference. Frustrating.

Figured out the problem, and it’s nothing a return to vendor won’t fix.
See picture below.

Thank you so much for your info. I’d just installed at home and it’s working perfect.
This is my config:

uart:
  baud_rate: 115200
  tx_pin: GPIO1
  rx_pin: GPIO3

binary_sensor:
  - platform: status
    name: "PC Remote ESP Status"

# Led de Estado
status_led:
  pin: GPIO2
  
switch:
  - platform: template
    name: "Velocidad Baja"
    id: baja
    icon: mdi:fan
    optimistic: true
    turn_on_action:
     - switch.turn_off: media
     - delay: 10ms
     - switch.turn_off: alta
   
  - platform: template
    name: "Velocidad Media"
    id: media
    icon: mdi:fan
    optimistic: true
    turn_on_action:
     - switch.turn_off: baja
     - switch.turn_off: alta
     - delay: 10ms
     - uart.write: [0xA0, 0x01, 0x01, 0xA2]
    turn_off_action:
     - uart.write: [0xA0, 0x01, 0x00, 0xA1]
 
  - platform: template
    name: "Velocidad Alta"
    id: alta
    icon: mdi:fan
    optimistic: true
    turn_on_action:
     - switch.turn_off: baja
     - switch.turn_off: media
     - delay: 10ms
     - uart.write: [0xA0, 0x02, 0x01, 0xA3]
    turn_off_action:
     - uart.write: [0xA0, 0x02, 0x00, 0xA2]

And a 3D printed box:

5 Likes

Can you share you stl file of the printed box?

Ok. I’ll try to get the file.

1 Like

By the way, and linked to the topic, do you know how to reset/restart with a physical press button? I can do it with Home Assistant by using the following:
switch:
‘# Switch to restart the relay

  • platform: restart
    name: Irrigation Valve 1

But if the relay loose the wi-if connectivity and an HW reset is needed then a push button can do the job. I can ground the reset of the ESP01 with a pull up resistor but will force to me to soldier some wires in the relay board which I’m trying to avoid and those pins on the board might work since there is one that says RST.
This is to control a latching solenoid for water irrigation with a internal fail safe timer just in case.
Thanks!

I don’t see the problem… could you explain?

Mouse over the picture, and note the JPEG file name.
The factory placed 12V DC relays onto a 3.3VDC and 5VDC board.
They can NEVER fire, as there’s never 12VDC anywhere near them.

did anybody find out if it is posible to yuse one of gpio pins for a button ?

i try to use your commands. But my board can not working for longtime. it can work just 2-3 min before it not respond. May you know solution? thank

Sorry, I’m using the board for anything at the moment but I had it running previously for months without issue.
If it works fine for a few minutes but then fails maybe your board is faulty?

You are a genius!

That guide is very handy! thanks dude!

I must have a different variant (from ebay) that would not work with any of the above esphome configs.

I eventually got it working with the following:

switch:
  - platform: gpio
    id: relay1
    name: 'Relay 1'
    pin: GPIO0

  - platform: gpio
    id: relay2
    name: 'Relay 2'
    pin: GPIO2
3 Likes

Thank u @swifty, finaly got it working when adding the preamble!!

Hi there. Some things I learned while getting this to work.

GPIO0 needs to be tied to ground when flashing.

The board needs to be in a mode that isn’t whatever it’s configured to be in from the factory. To switch it I randomly pressed the S1 and S2 buttons until the D7 LED turned on red. If D7 isn’t on, whatever is being sent by the esp board seems to be ignored.

You’ll have to set the logger to baud_rate: 0 otherwise UART won’t work on the needed GPIO pins.

logger:
  baud_rate: 0

And then magic!

2 Likes

Can you share the stl for the case?

Dude…that did the trick for me…

Thx alot…
Have the exact same one…

Did anybody managed to use the other GPIO’s for anything like sensors on the relay board ?
if yes, please share pins and config.
thank you !

Wow, I’m so excited. Mine is exactly the same as yours, and this piece of s**t actually worked! Cheers mate!