-->
Page 1 of 6

ESP-01 unsuitable for standalone. Alternative bootlaoders?

PostPosted: Tue May 05, 2015 4:54 am
by pete_l
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.

Re: ESP-01 unsuitable for standalone. Alternative bootlaoder

PostPosted: Tue May 05, 2015 8:16 am
by SoC
you can simply add a 0.1uf between sensor output to esp gpio. might need pull up resistor also.

Re: ESP-01 unsuitable for standalone. Alternative bootlaoder

PostPosted: Tue May 05, 2015 8:25 am
by j0hncc
Hi pete_l,

If your application does not need serial IO you can instead use RX and TX pins ( gpio1 and 3) which will avoid that problem. It may make it less convenient to flash depending on the specifics of your setup/hookup.

Cheers,
John

Re: ESP-01 unsuitable for standalone. Alternative bootlaoder

PostPosted: Tue May 05, 2015 9:11 am
by ArnieO
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.