I'm using an ESP8266-01S for a battery-powered project. The ESP is in DeepSleep, a doorbell relay pulls RST to GND, bringing the ESP to life to do some stuff, before going back to DeepSleep.
My problem is that once the program ran successfully and the ESP is in DeepSleep, the next RST will not bring it up properly. Instead, it will linger in some undefined state, eating around 33.7mA constantly (I went through that battery quite quickly without realizing it).
With serial output enabled, I reliably get something like this when entering those undefined states:
rll�r$�n�l�b|���rb�b�nnlnnbbp�$blrl
Edit: setting the Baud rate to 74880 revealed the above to be the following:
11:58:17.042 -> �
11:58:17.042 -> ets Jan 8 2013,rst cause:2, boot mode:(3,6)
11:58:17.042 ->
The next RST will then perform successfully, i.e. the ESP comes up, does its thing and goes into DeepSleep. My multi meter shows a power consumption of roughly 15uA, which looks like proper DeepSleep to me.
Another RST would then bring the ESP back into the undefined state, and so on.
Cutting power provokes the same behaviour, so it feels like it could be a hardware thing, some lingering current or something.
I created a minimal version of my program that shows the behaviour on the ESP:
int Led = LED_BUILTIN;
void setup() {
pinMode(Led, OUTPUT);
}
void loop() {
digitalWrite(Led, false);
delay(4000);// Delay 4 seconds
digitalWrite(Led, true);
delay(1000);// Delay 1 second
ESP.deepSleep(0);
}
Is there anything I'm missing or doing wrong, maybe something on the hardware side, to make DeepSleep work on an ESP8266-01S? Do the pins have to be initialized or brought in a defined state somehow? Also, is there a better way than Serial Output to figure out what's going on?
I believe I don't have to connect GPIO16 to RST, since I don't want to wake the ESP by software, but through hardware events only.
Edit: I left the device in DeepSleep over night and RSTed it in the morning, and this time it recovered fine for once.
I reliably get something like this when entering those undefined states
perhaps if you set the baud rate of the terminal software to match what the esp is using, the text will provide some insight into the problem - 74880 I believe is the default for ESP's