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

User avatar
By sean_intez
#63739 [quote="Barnabybear"]Hi, by default I didn't think pullups were enabled.
[code]
pinMode(13, INPUT); // set as input - no pullup.
pinMode(13, INPUT_PULLUP); // set as input - with pullup.
[/code][/quote]
They are enabled on startup by default on some pins.

I was hoping to find a way to modify the registers and disable the pullups when uploading the firmware.
User avatar
By rudy
#63742
sean_intez wrote:Using PNP transistor instead of NPN was my other option but that also has its own disadvantages. If esp8266 fails for any reason and shuts down, the relay gets energized and activates the high voltage circuit which is very dangerous.


The ESP8266 starts with the output pulled high because of the internal pull up resistor. And if the ESP can't start for any reason the transistor is never turned on. The PNP never turns on, the NPN never gets turned on, the Relay never gets turned on. So no power will be switched on to the output.

If the code runs and the output is turned on, and then the CPU crashes for some reason, the output can be left on. But this is also the case when using a NPN transistor. It is the same. The only problem with using PNP transistors is that it takes more components to accomplish the same job.

As I said, the circuit I included was the best I could find on the web. I would include an external pull up resistor to ensure the PNP transistor never turns on even if the ESP's output was disabled. (no pull up, not configured for output)
User avatar
By Barnabybear
#63747
sean_intez wrote:
I was hoping to find a way to modify the registers and disable the pullups when uploading the firmware.


The register is @ 0x60000808 bit 7, but I'm not sure that any changes will last through a reset.
https://esp8266.ru/esp8266-pin-register-strapping/
Have you thought about putting the relay between Vcc and GPIO13. Set GPIO high at the start of the code and invert the output?