Chat freely about anything...

User avatar
By pete_l
#16536 My plan is to use an ESP-01 (the one with two GPIO pins exposed) in a simple application where one pin is used as an input and is connected to a PIR and the other GPIO is an output that activates a floodlight.
This is a pretty simple security light type of device with the obvious advantage of being web-connected.

The problem that kills this application stone dead is the ESP8266 bootloader. When power is applied, both GPIO pins are set as inputs and their state (logic 0 or 1) determines whether the ESP-01 will run user code (when both are at logic 1) or whether it enters a state for loading firmware. However, it appears that the only state that allows user code will be executed after a power-up is for both GPIO0 and GPIO2 to be at a "1". With a PIR connected to one of these input pins it's obvious that this situation cannot be guaranteed.

Has anyone got experience of an ESP-01 running a different bootloader that doesn't rely on the logic states of the GPIO pins when power is applied? As it appears to me that with the existing boot code the device cannot be used reliably in a standalone application where one of the pins will be used as as input.
User avatar
By ArnieO
#16562
pete_l wrote:The problem that kills this application stone dead is the ESP8266 bootloader. When power is applied, both GPIO pins are set as inputs and their state (logic 0 or 1) determines whether the ESP-01 will run user code (when both are at logic 1) or whether it enters a state for loading firmware. However, it appears that the only state that allows user code will be executed after a power-up is for both GPIO0 and GPIO2 to be at a "1". With a PIR connected to one of these input pins it's obvious that this situation cannot be guaranteed.

Has anyone got experience of an ESP-01 running a different bootloader that doesn't rely on the logic states of the GPIO pins when power is applied? As it appears to me that with the existing boot code the device cannot be used reliably in a standalone application where one of the pins will be used as as input.

Why not use a simple transistor buffer between PIR output and GPIO input? One 2N2222 (or similar) and two resistors. the collector resistor on the transistor pulls the GPIO up to Vcc at startup, and ensures correct boot of the ESP.