What is the best battery for the EPS32?
In this article you learn what is the best battery for the ESP32 microcontroller.
First I describe the different voltage levels on the NodeMCU board to avoid magic smoke and a damage of the ESP32. The researched batteries are:
- AA Alkaline batteries
- LiFePO4 battery
- LiPo and Li-ion Battery
- AAA NiMH batteries
- 9V Alkaline block battery
On top of all this content, you learn which batteries need a voltage regulator and how to use such a regulator.
IThe best battery power supply for the ESP32 is the LiFePO4 battery or the LiPo battery pack
- LiFePO4 battery if your main goal is to reach a maximum battery lifetime because you do not need any extra voltage regulator between the ESP32 and the battery. Also LiFePO4 batteries are rechargeable and have a capacity up to 6,000mAh, similar to LiPo and Li-ion batteries that gives your project a long lifetime in combination with a power mode that reduces the power consumption to a minimum.
- LiPo battery pack if you want to charge your battery while the circuit is running. The easiest solution because of the plug-and-play connection is to use an ESP32 microcontroller board that has a JST connector as well as an onboard LiPo charger like the Adafruit HUZZAH32, Sparkfun ESP32 Thing Plus or FireBeetle ESP32
Table of Contents
ESP32 Voltage Levels
Before we can analyze different batteries in combination with the ESP32 microcontroller, we have to understand, that there are different voltage levels on the ESP32 NodeMCU board. The following picture shows a simplified schema of the voltage levels and the important components.
From the picture you see that the 5V USB connection and the VIN pin are connected to a 3.3V voltage regulator, that transforms the input voltage between 5V and 12V to a constant 3.3V output voltage for the ESP32 microprocessor. Also the 3.3V pin is connected to the output of the voltage regulator and therefore also connected to the ESP32.
If you want to know how to operate ESP32 in general, visit the ESP32 tutorial.
The following table shows the technical limits for the ESP32 and the voltage regulator.
Microcontroller | Minimum Voltage | Typical Voltage | Maximum Voltage |
ESP32 | 2.3V | 3.3V | 3.6V |
The ESP32 has a nominal voltage of 3.3V but is able to operate between 2.3V and 3.6V. Voltages higher than 3.6V can damage the microcontroller.
Voltage Regulator | Output Voltage | Maximum Input Voltage | Maximum Output Current |
AMS1117 | 3.3V | 15V | 1A |
The AMS1117 voltage regulator has an output voltage of 3.3V matching the nominal voltage of the ESP32. The maximum input voltage is 15V but for a continuous operation a maximum voltage of 12V is recommended. The maximum output current is 1A leaving a good reserve because the data sheet of the ESP32 advises an output current of 500mA for a voltage regulator.
After we know the parameters of the microcontroller, we review the most used battery types and if it is reasonable to use the battery in combination with the ESP32 NodeMCU microcontroller.
AA Alkaline Batteries
Minimum discharge voltage | 1V |
Working voltage | 1.5V |
Maximum charge voltage | 1.65V |
Number of recharges | 500 |
Energy density | 80 Wh/kg |
AA alkaline batteries have a nominal voltage of 1.5V and if you connect two of them in series you get a nominal voltage of 3V. You can connect two AA alkaline batteries directly to the 3.3V pin of the NodeMCU, but the current that is provided by the AA alkaline batteries is only 50 mA per battery. Connected in series you still get an overall current of 50 mA.
Unfortunately the ESP32 NodeMCU can draw up to 300 mA while booting. When the ESP32 starts up, it pulls so much current out of the AA alkaline batteries that the voltage drops entirely to zero, resetting/crashing the ESP32.
In summary, I can not power the ESP32 NodeMCU with 2 AA batteries.
LiFePO4 Battery
Minimum discharge voltage | 2.5V |
Working voltage | 3.0V...3.2V |
Maximum charge voltage | 3.65V |
Number of recharges | 5000 |
Energy density | 90 Wh/kg … 160 Wh/kg |
The lithium iron phosphate battery (LiFePO4 battery) has a nominal voltage of 3.2V and a maximum voltage of 3.65V. The main advantage of a LiFePO4 battery is the very flat discharging curve so that the voltage drops very slowly during the discharging process. Because the maximum voltage of the lithium iron phosphate battery is with 3.65V only slightly higher than the maximum operation voltage of the ESP32 with 3.6V, you can connect this type of battery directly with the 3.3V pin of the microcontroller.
In summary a LiFePO4 battery is very suitable for the ESP32 and especially when your main goal is to power your circuit for a maximum time. If this is the case, I recommend to power the ESP32 with a LiFePO4 on the 3.3V pin.
The downside is, that it is very complicated to charge the battery while in use. Currently I have no solution for this problem. The easiest solution would be to have two LiFePO4 batteries that you can quickly change and en external battery charger.
LiPo Battery and Li-ion Battery
Minimum discharge voltage | 2.7V...3.0V |
Working voltage | 3.7V |
Maximum charge voltage | 4.2V |
Number of recharges | 5000 |
Energy density | 100 Wh/kg … 265 Wh/kg |
AAA NiMH Batteries
Minimum discharge voltage | 0.8V |
Working voltage | 1.2V...1.25V |
Maximum charge voltage | 1.4V |
Number of recharges | 1000 |
Energy density | 60 Wh/kg … 120 Wh/kg |
If you want to buy AAA batteries, make sure you buy NiMH batteries, because they are rechargeable and have the highest capacity and a nominal voltage of 1.2V…1.25V per battery. The combination with four AAA NiMH batteries result in an operation voltage of 4.8V…5V which is higher than the maximum operation voltage of the ESP32 with 3.6V.
Just like LiPo and Li-ion batteries you can use four AAA NiMH batteries in combination with a LDO regulator that reduces the input voltage to 3.3V. With the reduced voltage, you can connect the power supply to the 3.3V pin of the ESP32.
Compared to the LiPo and Li-ion batteries, NiMH batteries needs the same connection to the microcontroller but have a lower energy density and therefore I do not recommend to use the NiMH batteries.
9V Alkaline Block Battery
Minimum discharge voltage | 6V |
Working voltage | 9.0V |
Maximum charge voltage | 9.9V |
Number of recharges | 500 |
Energy density | 80 Wh/kg |
With a 9V block battery, you can use the VIN pin of the NodeMCU, that is internal connected with the 3.3V AMS1117 voltage regulator. Therefore you need no external components. But because the ESP32 only needs 3.3V, you are overpowered regarding the voltage. Because a 9V Alkaline block battery is nothing else than 6 AA Alkaline Batteries connected in series, you have the same step discharging curve resulting in a short lifespan of your battery powered system.
Therefore I do not recommend to use a 9V Alkaline block battery.
Low-dropout Voltage Regulator
The MCP1725T-3302E/MC fits perfect to the ESP32 in combination with batteries has have a maximum voltage higher than 3.6V. The following tables shows the fundamentals of the LDO datasheet and explains why these fundamentals match perfect to the ESP32.
MCP1725T-3302E/MC | Explanation | |
Output voltage | 3.3V | The regulator needs an output voltage equal to the operating voltage of the ESP32 that is 3.3V. |
Output current | 500mA | It is also important that the LDO has an output current of 500mA because the ESP32 needs around 450mA during the WiFi communication and in the datasheet of the ESP32 an output current of 500mA is recommend. |
Maximum input voltage | 6V | With a maximum input voltage of 6V, we are able to combine the LDO with the 3.7V LiPo and Li-ion batteries as well as the 5V AAA NiMH batteries. |
Minimum input voltage | 2.3V | The minimum input voltage should match the minimum operation voltage of the ESP32 which is 2.3V. |
If you have any questions about the different batteries and how to use them, please use the comment section below to ask your questions. I will answer then as soon as possible.
Well put together article….thanks.
Hi Argonath, thanks for your response. I hope you find a suitable battery for your ESP32 NodeMCU
I want to put 3.3V into the EPS32.
Where can I wire to the 3.3V pins in the following pin map?
https://github.com/nodemcu/nodemcu-devkit-v 1.0#pin-map
I tried it with 1.5V Alkaline Batteries x 2. However, the ESP32 was not responding…
Hi, 2x 1.5V Alkaline Batteries do not provide enough current for the ESP32. My recommendation would be to use a LiFePO4 battery that you can connect to the 3.3V pin and ground.
Thanks! Iwill try!
Hi, you better read again Kirchhoffs law: Regards AA Alkaline Batteries:
once the max-current was 50 mA a single-cell, then the current for 2 cells in series is still 50 mA and Voltage is 3V(nominal). For AA Alkaline, connecting them in parallel, the drawable current was 50mA*2 for a short time, since AA-Alkaline swing and eat up current from each other. Aditionally: NEVER suggest ALKALINE-Cells being charged with external current !!! You may reenergise Alkaline (Zn-C) reducing gas in the dielectric through forcing that process with temp-change for 40°C for 30 Minutes and cooling again before use (this way the travel of ions in the dielectric is supported for a short time).
Your suggestion for a recharable Lithium batterie is for the very use of continuous WiFi quite OK. But realy: The best power source is defined by the Use-case. In an article like yours, where I appreciate your attempt, the use and dimension of buffer-capacitors and with expectance of sharp peaks (power-on / Pwr-Switch) the use of filter-configurations (L/C L/R C/R) on special use shall be at least mentioned.
Hi Wolf,
thx for your input. You are totally right with the 2 AA Alkaline Batteries in series: The draw-able current is still 50 mA.
In my opinion I do not suggest to recharge Alkaline Batteries. The Maximum charge voltage is only the information that if the battery is new, the voltage is higher than the nominal voltage and can hurt the ESP32.
The suggestion of the batteries is only my personal opinion and of course depends on the use case.
The missing part of buffer-capacitors is a good point. I will take a look at this topic and include this part in the article.
how to know the charge % left of a particular battery(lithium ion rechargeable battery)??
Hi Tech Guy,
you can measure the voltage of the battery with the INA219 voltage and current sensor like explained in the INA219 tutorial
how a charge capacity of particular battery(lithium ion rechargeable battery)is known?
Hi Indian,
normally you find the battery capacity on the battery itself, for example 1000 mAh.
hi . I want to monitor 12 VDC using esp 32 . What type of Voltage Regulator I should use?
Hi, you could use for example the INA219 current and voltage sensor instead of a voltage regulator. Here you find a tutorial for the INA219: https://diyi0t.com/ina219-tutorial-for-arduino-and-esp/
Hello,
Okay, now we know the LiFePO4 is the best battery for ESP32, but how to install and charge it?
My goal is to build a permanent enclosure so the battery is permanently installed and connected to a simple battery power indicator and female USB input (both built into the side of the enclosure). That way, when the battery is low, I can take a USB charger and plug it in overnight to charge it up.
Does anyone have experience with this?
Hi HillbillyDelux,
based on your comment I changed the article and if you want to charge the battery while the whole circuit is running, I now would recommend a LiPo battery pack along with an ESP32 that has a JST connector and an LiPO onboard charger, like the following boards: Adafruit HUZZAH32, Sparkfun ESP32 Thing Plus or FireBeetle ESP32
To charge the LiFePO4 you could use TP5000 boards. Dirt cheap and effective.
More info at: https://lygte-info.dk/review/Review%20Charger%20TP5000%204.2-3.6V%20module%20UK.html