Flaky ESP8266 Behavior
Flaky ESP8266 Behavior
The EP8266 is great: It gives your IoT device WLAN and IP connectivity for only a few bucks.
On the other hand, the ESP8266 is quite a hand full: It creates power spikes that have negative impact on its own operation and possibly that of your entire circuit, it experiences out-of-the-blue resets that have to be dealt with, and it suffers hang-ups that can only be cured with a hardware reset or uttering "The IT Crowd" mantra ("have you tried turning it off and on again"; https://www.youtube.com/watch?v=nn2FB1P_Mn8).
I have had A LOT of trouble with the ESP8266 before I had a lot of fun. Some problems can be solved with a proper power supply, a bit of hardware, and somewhat sophisticated error handling. Other, more persistent problems can only be addressed with resetting the chip or even cycling its power supply.
My Arduino library uses three levels of measures to straighten out the balking chip:
- Soft-reset, by issuing a "restart" command to the ESP
- Hard-reset, by connecting an Arduino digital port pin to the reset pin of the ESP. This just requires a piece of cable. And an IO pin.
- "Turn if off and on again", by connecting an Arduino digital port pin to a transistor that controls the ESP power supply. That requires a transistor and minor wiring. And another IO pin.
You can't do more without modifying the ESP8266 firmware. Wait, you can: check out Sufficient Power Supply regarding power spikes.