Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By stevemac00
#46864 I'm using Huzzah and SainSmart relay with NodeMCU. If I turn on the relay with gpio.write(2,1), it will stay on - even across a reset. This could be disastrous for me if there was a malfunction such that the software could never start.

I know this has internal pullups but I tried a 10k resistor between GPIO and 3.3V but that did not make any difference and a reset still left the relay ON.

If I remove power then supply power, the relay defaults to off as it should but can anyone tell me how to make the relay default off for a software/firmware problem? (Hope that's clear.)
User avatar
By stevemac00
#46895 It's my understanding when I gpio.write(2,1) on the HUZZAH that I'm really writing to GPIO-4 since the NodeMCU pin table shows D2 as GPIO4. This is confirmed by testing the relay as well.

So, I tried #4, #5, #12, #13 to turn on the relay then I did a software reset. Each time the relay stayed on.
User avatar
By martinayotte
#46900 How did you wired you relay and it's driver ?
There are many ways to workaround such situation.
You could use double MOSFETs with pullups in such way that only an LOW output will drive the relay ON and adjust your software accordingly.