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

User avatar
By Paul Miller
#21875 As most of us know, gpio2 needs to be held high or unconnected during boot to run user applications. This makes connecting a device that triggers high problematic because it will pull gpio2 low during boot causing unwanted behavior. I searched around here and didn't find any real solutions (just work arounds) so I'm glad to share my own in case it helps someone else.

The solution was to come up with a circuit that would output gpio2 = Vcc - Sensor output. This will keep gpio2 normally high. When the sensor triggers, it will be pulled low. Then, your software can be set up to look for the LOW on gpio2. Since my ESP-01 boots before the sensor device ever sends a HIGH, this works very well.

The circuit uses 4 1K resistors and an Op Amp. I also put a 47K resistor in between gpio2 and my HC-SR501 sensor device.

Here is the circuit:
esp8266_gpio2.png


If anyone else has a solution, please share it.
You do not have the required permissions to view the files attached to this post.
User avatar
By j0hncc
#21973 Paul, that is good, thank you!

Unfortunately this part would be the "show-stopper" for many applications:
Paul Miller wrote: Since my ESP-01 boots before the sensor device ever sends a HIGH, this works very well.
User avatar
By lethe
#22000 This circuit seems awfully complicated to me. I'm not an electrical engineer, but from what I understand you just want to invert logic levels. Why don't you just use a simple transistor inverter or any standard NOT, NAND or NOR gate from the 74xx or CD40xx logic IC series?
User avatar
By Paul Miller
#22048
lethe wrote:This circuit seems awfully complicated to me. I'm not an electrical engineer, but from what I understand you just want to invert logic levels. Why don't you just use a simple transistor inverter or any standard NOT, NAND or NOR gate from the 74xx or CD40xx logic IC series?


Sounds awesome. Please post the circuit so we can take a look.