Lolin32 + 4chan relay board: cannot make relay port behave as expected

Hi.
I’ve a lolin32 attached to a 4 channel relay board. Ok the esp I installed the Time Based cover platform. I’m pasting below the ESPHome configuration.
Basically, when I switch on the board, all the four relay red led are turned on, and this sounds strange to me, because other installations I checked have the LEDs off by default. Whenever I trigger the GPIOs, the led turn off according to the active pin for the configured duration of the action, then it comes back on.
Despite the LED status, and despite the fact I can hear the relays physically triggering, the relay ports are always stuck: B+C is closed, B+A is open.


I’ve a second board and behaves exactly the same. I haven’t tried another lolin32…

Given the second is doing the same, I think it’s something I haven’t done correctly.

I tried measuring voltage on the relay board and everything seems fine. It gets the 3.3V, and when the relay is triggered by ESPHome its current is set to 0. But the frontend ports never change.

I’m wondering what I can have configured badly. Any hint on how to debug this is welcome.

Thanks

substitutions:
  name: esphome-web-c858b0
  friendly_name: ESPHome relay tende

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  name_add_mac_suffix: false
  project:
    name: esphome.web
    version: '1.0'

esp32:
  board: lolin32
  # board: esp32dev
  # framework:
    # type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
  - platform: esphome

# Allow provisioning Wi-Fi via serial
improv_serial:

wifi:
  # Set up a wifi access point
  ap: {}

# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:

dashboard_import:
  package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
  import_full_config: true

# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
  authorizer: none

# To have a "next url" for improv serial
web_server:


cover:
  - platform: time_based
    name: "Tenda cucina"

    open_action:
      - switch.turn_on: tenda_cucina_open
    open_duration: 32sec

    close_action:
      - switch.turn_on: tenda_cucina_close
    close_duration: 32sec

    stop_action:
      - switch.turn_off: tenda_cucina_open
      - switch.turn_off: tenda_cucina_close
  - platform: time_based
    name: "Tenda ragazzi"

    open_action:
      - switch.turn_on: tenda_ragazzi_open
    open_duration: 29sec

    close_action:
      - switch.turn_on: tenda_ragazzi_close
    close_duration: 29sec

    stop_action:
      - switch.turn_off: tenda_ragazzi_open
      - switch.turn_off: tenda_ragazzi_close

switch:
  - platform: gpio
    id: tenda_cucina_open
    pin: GPIO25
    restore_mode: ALWAYS_OFF
    interlock: &interlock_cucina [tenda_cucina_open, tenda_cucina_close]
    interlock_wait_time: 200ms
  - platform: gpio
    id: tenda_cucina_close
    pin: GPIO27
    restore_mode: ALWAYS_OFF
    interlock: *interlock_cucina
    interlock_wait_time: 200ms
  - platform: gpio
    interlock_wait_time: 200ms
    interlock: &interlock_ragazzi [tenda_ragazzi_open, tenda_ragazzi_close]
    id: tenda_ragazzi_open
    pin: GPIO26
    restore_mode: ALWAYS_OFF
  - platform: gpio
    interlock: *interlock_ragazzi
    interlock_wait_time: 200ms
    id: tenda_ragazzi_close
    pin: GPIO14
    restore_mode: ALWAYS_OFF

sensor:
  # WiFi Signal sensor.
  - platform: wifi_signal
    name: Relay WiFi Signal
    update_interval: 60s

I expect your relay board to trigger when esp pin is set off (low, 0V, Gnd). That might cause inverse logic to your expectations. You can set inverted option on your yaml.
Also, those relays have 5V coil, they might work at 3.3V or might not. Correct wiring would be 5V to jd-vcc jumper removed and 3.3V to vcc.
How is your relay output side wired (nc, no, com)?

IMHO.

image

You must operate relay by low level signal (so use inverted: true on switches), as well supply 5V (or 12V depending which board You actually have) to VCC pin of relay board.

That would sink 5V/12V to your esp and fry it. Vcc should be 3.3v. Jd-vcc should be 5V and jumper has to be removed.

Why not, but IMHO no trouble.

My experience.
Have 12V powered Wiegand card reader directly connected to ESP board GPIO’s with no issues.
No burn, no fry, just working.

Different circuit.
Try to set a esp pin as output and then give it 12V on that pin…

Thanks everyone for the replies!

Setting invert: true on the switch changes the LED behavior as expected.

About the relay, the board indeed needs 5V and not 3.3, but my lolin32 doesn’t have such output! I did choose this because of integrated wifi, I didn’t consider the lack of 5V output. I guess I need to change board.

Thank you again for the support!

If it works at 3v3, let it be. It’s in a gray zone but it’s safe. If you ever get misbehaviour you know what to do…

The led works, but the relays are never triggered, so I cannot say it’s as expected :sweat_smile:

Weird board you have, if you don’t have 5v pin. Might be labeled VIN.

Nop

Maybe the only esp32 devboard in the world without 5V pin… :roll_eyes:
So power your relay board separately from 5V source on the right side, JD-vcc and gnd(jumper removed).

1 Like