GPIO pins on boot!

So I have an issue where when all my relays are active. Im basicly running all relays via GPIOs as active, and then dropping power to them when i am triggering my devices.

My issue with this is when there is a power cut, the relay will drop and the state then changes. This is unsafe for a number of devices I am using.

What I would prefer to do is, have the relays LOW and energize them when turning my devices ON, and when devices are off, the relays are LOW so if power fails, they dont change state.

The issue with this is, when the PI boots, it always sends all relays HIGH, until HASSIO boots, then when HASSOS loads, it sends them LOW again.

Is there a way around this?

Thanks

I gave up connecting relays directly on ESP. No matter what pin i used i happened occasionally that relay triggerred quickly (and opened garage door at 2 in the morning). Now i changed/updated all my devices and i always use MCP23017, MCP23008 or PCF8574. Problem solved.
I guess it’s similar with Pi GPIO’s. If you can use mentioned I/O chips, do so. Their outputs will stay inactive until chip is initialized.

This table lists which way the GPIO is pulled at boot. Select your GPIOs appropriately:

If it is an ESP, check out the tables on these pages for which GPIOs to use:

ESP8266: https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/

ESP32: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/

1 Like

Excellent, thank you! So changing the GPIO should do it! I think this is the answer I was looking for.

Thank you!

Ok so I’ve switched it to a pin that is pulled down, and still on boot, the relay actives and then deactivates again quickly after rebooting the PI.

Is there a way to avoid this.

Thanks

It is… as i said above. I did all you’re doing now - no luck. Direct pins are just not 100% proof, at least i couldn’t find any. Extra chip is.