Lolin32 lite won't go into deep sleep after WIFI
Posted: Tue Mar 15, 2022 1:51 pm
I have been dabbling for a few months with a cheap Wemos Lolin32 lite I bought from ebay... actually I had to buy two because I smoked the first one by connecting a LiPO battery with the wrong polarity. I was hoping that this dabbling would lead to me understanding C programming (most of what I do at the moment is copying code other people have made and tweaking it). I want to build a temperature sensor which will periodically send data to a web server maybe a once or twice an hour and go to sleep in between. Nothing too new or imaginative here.
The problem is with the current consumption during deep sleep. I uploaded the ESP32>DeepSleep>TimerWakeUp example from the Arduino IDE then disconnected it from the PC and connected the LiPO battery via a multimeter to measure current. The current drawn starts at about 40mA and then reduces to 0.1mA and it repeats after 5 seconds. Great!
I then inserted my code for sending the sensor readings and the current drawn is now 60-80mA and remains at this level all the time. Even just inserting WiFi.begin(ssid, password); with no code for measuring the sensor or sending the data prevents the current going down. After much searching the internet I found that it was necessary to disconnect the WIFI in order for the ESP32 to go into deep sleep mode, however no matter what I try the current continues to be 60-80mA. I have tried the following commands before esp_deep_sleep_start(); and probably some more but nothing seems to work.
WiFi.mode(WIFI_OFF);
btStop();
adc_power_off();
esp_wifi_stop();
esp_bt_controller_disable();
I also tried a ten second delay between these commands and the deep sleep command in case it wasn't switching off the WIFI in time before it going to sleep.
Basically, after opening a WIFI connection deep sleep just doesn't work. Just wondering if anyone could suggest anything else to try.
The problem is with the current consumption during deep sleep. I uploaded the ESP32>DeepSleep>TimerWakeUp example from the Arduino IDE then disconnected it from the PC and connected the LiPO battery via a multimeter to measure current. The current drawn starts at about 40mA and then reduces to 0.1mA and it repeats after 5 seconds. Great!
I then inserted my code for sending the sensor readings and the current drawn is now 60-80mA and remains at this level all the time. Even just inserting WiFi.begin(ssid, password); with no code for measuring the sensor or sending the data prevents the current going down. After much searching the internet I found that it was necessary to disconnect the WIFI in order for the ESP32 to go into deep sleep mode, however no matter what I try the current continues to be 60-80mA. I have tried the following commands before esp_deep_sleep_start(); and probably some more but nothing seems to work.
WiFi.mode(WIFI_OFF);
btStop();
adc_power_off();
esp_wifi_stop();
esp_bt_controller_disable();
I also tried a ten second delay between these commands and the deep sleep command in case it wasn't switching off the WIFI in time before it going to sleep.
Basically, after opening a WIFI connection deep sleep just doesn't work. Just wondering if anyone could suggest anything else to try.