4 channel Relay ESP8266 Wifi board WORKING with esphome

If all 4 of them aren’t working, maybe you are doing something wrong. Try another tutorial, and start from the beginning.

Try another FTDI adapter, or try programming a known working board.
I didn’t do anything special for this.

Try holding it to ground until flashing is finished.

EDIT: although searching seems to indicate it shouldn’t be necessary to ground GPIO0 once it is in bootloader mode.

You aren’t accidentally pulling CH_PD low are you? It needs to be high to flash.

Thank you! I’d just gotten my relays in and discovered they had the other cpu controlling the relays when you posted your results. Here is my front yard sprinkler system - thanks to you.

3 Likes

I’m pullin I00 low, but I’ve orderedthis one, and are waiting for the delivery.
I hope that will make it work.
I’ll mount a momentary switch to the GND/I00, so that I can press that easily.
Now I just hope I haven’t fried them all :smiley:
I’ve flashed a ton of these until now, though so far only ESP8266, so I usually get this working without problems.

Ok, I finally got the usb programmer instead of the ftdi, and now I can program the esp-01 without problems…

Hey all,

Thanks for your work on this!

I just got a single channel relay:

but don’t seem to be able to get this working :confused:

esphome config below. Have I done something wrong? Feels like the GPIO might not be correct as nothing happens when toggling the switch in HA, I’m expecting the relay to ‘click’ but no luck.

Thanks!

esphome:
  name: relay2
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "SSID"
  password: "PASSWORD"

# Enable logging
logger:
  baud_rate: 0 #need this to free up UART pins

# Enable Home Assistant API
api:

ota:

uart:
  baud_rate: 115200 # speed to STC15L101EW
  tx_pin: GPIO1
  rx_pin: GPIO3
  
switch:
  - platform: template
    name: "R1"
    id: "R1"
    turn_on_action:
      - uart.write: [0xA0, 0x01, 0x01, 0xA2]
    turn_off_action:
      - uart.write: [0xA0, 0x01, 0x00, 0xA1]
    optimistic: true
1 Like

theres a tasmota fork called wespota that supports these boards right out of the gate.
obviously not ideal if you want everything ESPhome but still worth considering.
the version i’m running on my 4 channel has a bug where it fills the console with failed DNS errors but its rock solid in in its actual function so i’ve been giving this bug a damn good ignoring.

I have a similar one and just used a standard GPIO switch:

No need for any of the UART or baud rate in logger

switch:
  - platform: gpio
    id: relay
    inverted: true
    name: relay
    pin: GPIO0

The example in the customer review on the Amazon page said baud rate needed to be 9600. Give that a try.

Well that is a completely different device then isn’t it.

2 Likes

theres a tasmota fork called wespota that supports these boards right out of the gate.
obviously not ideal if you want everything ESPhome but still worth considering.
the version i’m running on my 4 channel has a bug where it fills the console with failed DNS errors but its rock solid in in its actual function so i’ve been giving this bug a damn good ignoring.

Thanks, I am trying to stick with ESPHome

I have a similar one and just used a standard GPIO switch:

No need for any of the UART or baud rate in logger

I did try this but didn’t work same result - nothing happens

The example in the customer review on the Amazon page said baud rate needed to be 9600. Give that a try.

YES This was correct, I had tried that previously but it didn’t work which leads me on to the real reason this wasn’t working:

I had my power supply set to 3V instead of 5V. So the ESP01 was running fine but the relay wasn’t getting enough power to energise! :man_facepalming:

Thanks for the help!

1 Like

Happy to see these boards work with home-assistant. Just wonder if there might be issues using another board than the linked one in the opening post. Cheaper but also available on banggood and the only difference (?) seems to be 12V relay’s instead of 5v ones…?
5v version
12v version

They look likely to work. Depends if your handy power supply is 5v or 12v.

Thanks for this guide!

I only had a 5v USB to serial cable handy so I used the 7 pin header on the relay board to hook it up, which stepped down to 3.3v for the ESP-01. I was able to program it successfully after bridging EN to 3V3 and IO0 to GND (I just used logic analyser test clips on the topside of the ESP-01).

Now to wire up my sprinkler solenoids…

2 Likes

So I had this working. Just got my EPS-01 and x2 relay board today. It worked for about an hour. The ESP-01 gets on wifi just fine and I can send commands, but nothing is happening. I checked the 5v pins and the power is there. The D5 blue led is lit and D6 is flashing on the relay board. Any ideas what else I can check?

1 Like

What is your yaml? Where is your log?

# Enable logging
logger:
baud_rate: 0 #need this to free up UART pins
# Enable Home Assistant API
api:

uart:
baud_rate: 115200 # speed to STC15L101EW
tx_pin: GPIO1
rx_pin: GPIO3

switch:

  • platform: uart
    name: “A1on”
    data: [0xA0, 0x01, 0x01, 0xA2]

  • platform: uart
    name: “A1off”
    data: [0xA0, 0x01, 0x00, 0xA1]

  • platform: uart
    name: “A2on”
    data: [0xA0, 0x02, 0x01, 0xA3]

  • platform: uart
    name: “A2off”
    data: [0xA0, 0x02, 0x00, 0xA2]

[18:33:18][C][uart:140]: UART Bus:
[18:33:18][C][uart:142]: TX Pin: GPIO1
[18:33:18][C][uart:145]: RX Pin: GPIO3
[18:33:18][C][uart:147]: Baud Rate: 115200 baud
[18:33:18][C][uart:148]: Stop bits: 1
[18:33:18][C][uart:150]: Using hardware serial interface.
[18:33:18][C][logger:175]: Logger:
[18:33:18][C][logger:176]: Level: DEBUG
[18:33:18][C][logger:177]: Log Baud Rate: 0
[18:33:18][C][logger:178]: Hardware UART: UART0
[18:33:18][C][uart.switch:020]: UART Switch ‘A1on’
[18:33:18][C][uart.switch:020]: UART Switch ‘A1off’
[18:33:18][C][uart.switch:020]: UART Switch ‘A2on’
[18:33:18][C][uart.switch:020]: UART Switch ‘A2off’
[18:33:18][C][captive_portal:169]: Captive Portal:
[18:33:18][C][api:095]: API Server:
[18:33:23][D][switch:021]: ‘A1on’ Turning ON.
[18:33:23][D][switch:045]: ‘A1on’: Sending state ON
[18:33:23][D][uart.switch:016]: ‘A1on’: Sending data…
[18:33:23][D][switch:045]: ‘A1on’: Sending state OFF

2019-12-28 23:56:00 DEBUG (MainThread) [aioesphomeapi.connection] x.x.x.x: Sending <class ‘api_pb2.SwitchCommandRequest’>: key: 391537630
2019-12-28 23:56:00 DEBUG (MainThread) [aioesphomeapi.connection] x.x.x.x: Got message of type <class ‘api_pb2.SwitchStateResponse’>: key: 391537630
2019-12-28 23:56:03 DEBUG (MainThread) [aioesphomeapi.connection] x.x.x.x: Sending <class ‘api_pb2.SwitchCommandRequest’>: key: 391537630
2019-12-28 23:56:03 DEBUG (MainThread) [aioesphomeapi.connection] x.x.x.x: Got message of type <class ‘api_pb2.SwitchStateResponse’>: key: 391537630

So it works totally for some time and then stops? Or doesn’t ever switch the relays at all?

Can you point us to the exact device you are using?

It did work perfectly and now it won’t trigger the relays at all. I was setting it up to control a garage door.

This is what I got.

So I have no Idea what happened. For giggles I powered off the module and ESP-01, held in S2 (reset) and powered up. Now it is fine.

3 Likes