-->
Page 1 of 1

Driving a relay. How to cope with GPIO value flipping.

PostPosted: Sun Jul 26, 2020 1:41 pm
by vaiojasard
Hi folks!

I'm using an ESP01 to drive a relay. I'm using GPIO2 (the only one free to use). I noticed that it goes high on power on/start and then down after a short delay. How could I avoid the relay being powered up while the ESP start up process?

Thanks in advance!

Best regards!

Re: Driving a relay. How to cope with GPIO value flipping.

PostPosted: Sun Jul 26, 2020 2:11 pm
by pangolin
GPIO2 NEEDS to be pulled up at boot time for the ESP-01 to run. You must either rewire your relay to take this into account, or reprogram your code - or both i.e make it "active low" rather than the more common "active high".

Second option is to us GPIO1 or 3 and compile with NO_GLOBAL_SERIAL but of course you will then not be able to use TX/RX (Serial) while running. You can still upload with FTDI etc as long as you isolate the relay first.

Third option: spend $2 on a wemos D1 mini which is FAR easier to use, FAR more capable and has none of these problems.