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

User avatar
By Suxsem
#16877 Hi. Sorry for the very noon question, but I'm scared of destroy my esp8266-1 board.

Basically I have a 12v logic signal (from my home surveillance system) and I want to monitor the state of this signal with the esp8266.

Can I just shift the 12v to 3.3v with a voltage divider and connect it to the GPIO2 (I know that I can't use the GPIO0 because it may trigger the bootloader during boot) or this could damage the esp8266 GPIO2 pin?

Do I need some sort of current limitation? I'm not very expert in electronics but I think that when a GPIO pin is in input mode it should be in high impedance state... but I'm wondering if the GPIO2 is already in input mode at boot time

Thanks!
User avatar
By eriksl
#16881 You could do it with a voltage divider, but it's a bit risky. Better alternative would be to have your monitoring signal drive a transistor (base, with a resistor) and have the resistor (collector to emitter) pull down the GPIO, which you can either pull up internally or using an external resistor to +3.3V (about 10k should be fine).
User avatar
By Suxsem
#16889 Thanks. I know how to apply transistor or optocoupler solutions but I'm wondering why you say that voltage divider is dangerous.
Because the GPIO2 could not always be in high impedance state?