November 23, 2024, 06:45:38 AM

ESP32-POE and relay

Started by sebr, August 22, 2023, 11:38:10 PM

Previous topic - Next topic

sebr

Hi
I bought your super ESP32-POE card to control 2 relays for home automation on Home Assistant and ESPHome.
To control my garage doors I found this code at the following link:
https://digiblur.com/wiki/ha/esphome-garage-opener/
Impossible to switch a relay, I tested on GPIO14 and 15 then GPIO0 and GPOI1 (Is it an error on the PDF on the name of the GPOI1?)
I don't see why I can't switch the relay on.
Thank you for your help.

LubOlimex

There can be a lot of reasons for that. What are the relays exactly? Can they be controlled via 3.3V signal? GPIO14 and GPIO15 should be alright if you don't have SD card. Maybe also try using GPIO32. Maybe check the Arduio relay code for ESP32-EVB, it is our board with two on-board relays: https://github.com/OLIMEX/ESP32-EVB/blob/master/SOFTWARE/Arduino%20IDE%20examples/RELAY/RELAY.ino maybe also inspect the schematic of ESP32-EVB to see what relays we use and how we have connected it to the ESP32 chip.
Technical support and documentation manager at Olimex

sebr

Hi,
Thank you for the quick reply. The relay and one from AZ Delivery:
https://www.az-delivery.de/fr/products/kf-301-relais-modul-mit-low-level-trigger
When I put it in contact with a GPIO the relay switches well as we can hear in this video:
With Home assistant it's not coded like arduino, the relay is controlled like this:
  - platform: gpio
    pine:
      number: GPIO22
      inverted: false

sebr

I just did the test with my multimeter, if I play with the buttons of my Home Assistant, the GPIOs go well to 0v on OFF and 3v on ON.
My relay must not be compatible with this type of installation.

sebr

I was able to progress thanks to the following topic: https://community.home-assistant.io/t/5v-relay-and-esphome/366110/13
I put in 3v relay and it works. I don't know why in 5v the relay always remains active even if the GPIO goes from 0 to 3v.
I think the relay is not very good. I have to test another piece of code.
Thanks for your help.

KeviNH

GPIO pins cannot supply high-current loads such as to drive even a 3V relay coil, thus the mention above of a "low-level-trigger" relay (usually opto-isolated).

I'm building a garage-door triggering system with ESP-32, I ordered a set of "DC 5V Relay Module High/Low Level Trigger with Optocoupler" from Amazon.   I soldered pins to get both 5V and GND from the contacts on the edge of the ESP32-POE, and for the control signal I used GPIO5 from that same row.

Worth noting that you get what you pay for, you can get one fully-QA-tested relay module for ten bucks, or five factory seconds off Amazon/Ali for the same price.   Choose wisely!