esp32 not working on battery

ESp32 Battery Fail: Solutions for non-functioning devices

By Daniel Jackson
AD

Is your ESP32 not working on battery power, despite being configured correctly? You're not alone, and we've got you covered with a comprehensive guide to diagnose and potentially fix your issue.

ESP32, with its dual-mode Wi-Fi and Bluetooth capabilities, is a powerhouse among microcontrollers. However, when it comes to battery operation, it's not immune to hiccups. Let's dive into the most common culprits and how to troubleshoot them.

Power Management Issues

The ESP32's power management unit (PMU) controls power delivery to the system. If this isn't configured correctly, your device might not be getting the power it needs from the battery.

AD
How to Power ESP32 Boards: USB, VIN & Battery Guide
How to Power ESP32 Boards: USB, VIN & Battery Guide
10 ESP32 Skills Every Maker Should Learn
10 ESP32 Skills Every Maker Should Learn
DAY 5 — ESP32 Explained | Wi-Fi & Bluetooth Microcontroller Notes
DAY 5 — ESP32 Explained | Wi-Fi & Bluetooth Microcontroller Notes

Double-check your code to ensure you're setting up the PMU correctly. Remember to call `pmu_set_sleep_mode` to set the sleep mode, and `esp_deep_sleep_start` when you want to go into deep sleep mode.

IncorrectWakeupEn

In the `pmu_set_sleep_mode` function, the `incorrect_wakeup_en` parameter is crucial. Setting it to `true` enables the wakeup pin, while `false` disables it. Ensure you've set this correctly according to your needs.

Simulate ESP32 Projects in VS Code with Wokwi (Beginner Guide!)
Simulate ESP32 Projects in VS Code with Wokwi (Beginner Guide!)
an electronic device with wires connected to it and some other components attached to the board
an electronic device with wires connected to it and some other components attached to the board
an electronic device is shown in this poster, with instructions on how to use it
an electronic device is shown in this poster, with instructions on how to use it

For example, if you're using GPIO0 as the wakeup pin, you should set `incorrect_wakeup_en` to `true`. Otherwise, it might cause unexpected behavior, leading to your ESP32 not working on battery.

Deep Sleep Configuration

If you're not using the deep sleep mode correctly, your ESP32 might drain the battery quickly or not wake up as expected. Make sure you've configured the deep sleep mode parameters correctly, such as the wakeup time, GPIO interrupt wakeup, and ULP co-processor wakeup.

AD

Additionally, ensure you're storing the RTCmem and ULP co-processor data correctly before going into deep sleep. Any incorrect configuration here can prevent your ESP32 from working on battery.

How to Use ESP32 Deep Sleep Mode for Battery-Powered IoT Projects - Engineering Projects
How to Use ESP32 Deep Sleep Mode for Battery-Powered IoT Projects - Engineering Projects
10 Useful ESP32 Concepts That Take You from Noob to Pro!
10 Useful ESP32 Concepts That Take You from Noob to Pro!
ESP32 Pinout Guide: GPIO, Buttons & Ports Explained
ESP32 Pinout Guide: GPIO, Buttons & Ports Explained
Tech Note 134 - ESP32 Easy power reduction method for battery powered projects
Tech Note 134 - ESP32 Easy power reduction method for battery powered projects
💡 ESP32 Web Server – Control an LED from Your Browser!
💡 ESP32 Web Server – Control an LED from Your Browser!
ESP32 Schaltplan – ESP32 Arduino Projekte
ESP32 Schaltplan – ESP32 Arduino Projekte

Battery Level and Charging

Your ESP32 might not work on battery if the battery level is too low or if the charging process isn't configured correctly.

Make sure you're monitoring the battery level correctly and have set up the charging process properly. Use the `esp_bt_controller_mem_release` function to free up memory and `esp_bt_mem_release` to release both controller and host memory when entering deep sleep.

AD

Battery Level Thresholds

Set up your low and critical battery level thresholds correctly. When the battery level reaches these thresholds, your ESP32 should perform specific actions, like reducing power consumption or alerting the user.

Tech Note 131 - ESP32/8266 Reducing Battery Load Hints & Tips
Tech Note 131 - ESP32/8266 Reducing Battery Load Hints & Tips
ESP32 RTC: Keep Accurate Time ⏱️⚡
ESP32 RTC: Keep Accurate Time ⏱️⚡
Tutorial:ESP32 & DC Motors
Tutorial:ESP32 & DC Motors
🔋 Powering Your ESP32 with a 12V Source! ⚡
🔋 Powering Your ESP32 with a 12V Source! ⚡
ESP32 Keeps Resetting? 3-Step Troubleshooting Guide
ESP32 Keeps Resetting? 3-Step Troubleshooting Guide
ESP32 Telegram Bot: Send Sensor Readings To Your Phone!
ESP32 Telegram Bot: Send Sensor Readings To Your Phone!
⏱️ ESP32 NTP Time Sync – How to Get Accurate Time via Wi-Fi!
⏱️ ESP32 NTP Time Sync – How to Get Accurate Time via Wi-Fi!
ESP32 Over-the-Air (OTA) Updates – Wireless Firmware Upload
ESP32 Over-the-Air (OTA) Updates – Wireless Firmware Upload
Anatomy esp32
Anatomy esp32
⚔️ ESP32 vs ESP8266 – Which One Should You Choose?
⚔️ ESP32 vs ESP8266 – Which One Should You Choose?
ESP32-C3 Super Mini Pinout & Specs 📌⚡
ESP32-C3 Super Mini Pinout & Specs 📌⚡
⚡ ESP32 Interrupts — Master Hardware & Software Interrupts for Real-Time Control!
⚡ ESP32 Interrupts — Master Hardware & Software Interrupts for Real-Time Control!

To monitor the battery level, use the `esp_adc_cal_value_get` function to get the ADC value, and then compare it with the threshold values obtained from `esp_adc_calchar_get_char_data`.

Charging Process

If your ESP32 is charging, ensure the charging process is configured correctly. Double-check that the charging circuit is functioning as expected and that your ESP32 is correctly interfacing with the charging circuit.

AD

Moreover, ensure you're handling the charging interrupt correctly. The `esp_sleep_on_chargedone_wakeup` function should be called to wake up the system when charging is complete. Any mistakes here can lead to your ESP32 not working on battery.

In many cases, a combination of these factors might be causing your ESP32 not to work on battery. Carefully debug each aspect and ensure you've configured everything correctly. Happy problem-solving!

AD