For a while I’ve had success with ESP-01’s using MQTT to trigger ESP pins (as outputs) and also using ESP pins pulled up to receive inputs. For a recent project I needed them to be pulled down and was reminded that the ESP8266 won’t boot from flash with GPIO0 or 2 pulled down (once I’d built it!).
I’m a “trial-and-error” learner, reading lots, copying small sections of other designs, pulling various small sections together, realising they don’t quite work, studying a bit more, trying again and eventually getting something working. The problem with that method is that I’m never certain there’s not a better way.
So, I’ve got a working circuit with GPIO0 & 2 useable in a pulled-down state after boot and without any manual intervention at start-up. My question is…is there a more elegant way to achieve this? Is there a reason not to do this? I’ve struggled to really find anything on-line discussing anything remotely like this as an option so wonder whether there’s a reason for that.
See attached circuit diagram.
The 470uF + 56R combination gives a sufficient discharge time as to hold the pins high for long enough for the ESP to boot properly while keeping the negative voltage sufficiently small as to be (more or less) within the tolerance of the ESP pins (-0.3V to 3.6V when powered with a 3.3V power source, if I understand correctly) when the power is removed. (Does that concept have a name?). At the same time 56R appears to be sufficient pull-down strength for my inputs to trigger reliably.
For completeness, this is a circuit that senses AC live (just on or off) on two separate inputs using the SFH628 AC-input opto-isolator, and sends an MQTT message when that changes. The two 2-pin connectors are screw terminals for an AC supply and two AC-live inputs to the SFH628’s. The 8-pin connector is a 4x2 female header into which an ESP-01 is inserted.