In this guide, you’re going to build a voltage regulator for the ESP8266 that can be used with LiPo and Li-ion batteries.
Watch the video version
This guide is available in video format (watch below) and in written format (continue reading this page).
ESP8266 power consumption
The ESP8266 is well known for being power hungry when performing Wi-Fi tasks. It can consume from 50mA to 170mA. So, for a lot of applications it’s not ideal to use a battery with it.
It is better to use a power adapter connected to mains voltage, so that you don’t have to worry about power consumption or charging batteries.
ESP8266 with LiPo/Li-ion batteries
However, for some ESP8266 projects that use Deep Sleep or don’t require constant Wi-Fi connection, using the ESP8266 with rechargeable LiPo batteries is a great solution.
For battery powered applications the ESP-01 version is the recommended board, because it has few on board components.
Boards like the ESP-12 NodeMCU use more power, because they have extra components like resistors, capacitors, chips, etc..
Since LiPo batteries are so easily available, I’ll show you how to power the ESP8266 using those types of batteries.
This guide is not about different types of batteries and I won’t explain how LiPo batteries work. I’ll just give you the relevant information to complete the circuit presented…
LiPo/Li-ion batteries fully charged
LiPo/Li-ion batteries are rechargeable with the appropriate charger and they output approximately 4.2V when are fully charged.
However, as the battery keeps discharging the voltage starts to drop:
The ESP recommended operating voltage is 3.3V, but it can operate with voltages between 3V and 3.6V. So you can’t plug the LiPo battery directly to an ESP8266, you’ll need a voltage regulator.
Typical Linear Voltage Regulator
Using a typical linear voltage regulator to drop the voltage from 4.2V to 3.3V isn’t a good idea.
For example: if the battery discharges to 3.7V, your voltage regulator would stop working, because it has a high cutoff voltage.
Low-dropout or LDO Regulator
To drop the voltage efficiently with batteries, you need to use low-dropout regulator or also known as LDO regulator that can regulate the output voltage.
Having a low dropout voltage means that even if the battery is only outputting 3.4V it would still work. Keep in mind that you should never empty the LiPo battery completely, because it will damage the battery or decrease its lifetime.
After researching LDOs, I found a couple of good alternatives. One of the best LDOs I’ve found was the MCP1700-3302E.
It’s fairly small and It looks like a transistor.
There is also a good alternative like the HT7333-A.
Any LDO that has similar specifications to the ones shown on the datasheet below are also good alternatives. Your LDO should have similar specs when it comes to:
- Output voltage (3.3V)
- Quiescent current (~1.6uA)
- Output current (~250mA)
- Low-dropout voltage (~178mV)
MCP1700-3302E Pinout
Here’s the MCP1700-3302E pinout. It has GND, Vin and Vout:
Other LDOs should have the same pinout, but you should always search for your LDO’s datasheet to verify its pinout.
ESP8266 Circuit with LDO and Li-ion Battery
Here’s the parts required to design the voltage regulator for the ESP-01:
- LiPo battery or Li-ion batter + battery holder
- Low-dropout or LDO regulator (MCP1700-3302E)
- 1000uF electrolytic capacitor
- 100nF ceramic capacitor
- Pushbutton
- 10k Ohm resistor
- ESP-01 – read Best ESP8266 Wi-Fi Development Boards
- Breadboard
- Jumper wires
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Take a look at the diagram below to design your own voltage regulator circuit.
Or you can take a look at the Fritzing diagram (the ceramic capacitor and electrolytic capacitor are in parallel with GND and Vout of the LDO):
The pushbutton is connected to the RESET pin of the ESP-01, for this particular guide it’s not necessary, but it will be useful in a future guide.
Here’s the final circuit:
About the capacitors
The LDOs should have a ceramic capacitor and an electrolytic capacitor connected in parallel to GND and Vout to smooth the voltages peaks. The capacitors prevent unexpected resets or unstable behaviour for your ESP8266.
Testing
Let’s power the circuit and test it. Having the multimeter measuring the Vin voltage of the LiPo battery, you can see it outputs approximately 4.2V, because the battery is currently fully charged.
Let’s place the multimeter probe on Vout. Now, the multimeter is measuring approximately 3.3V which is the recommended voltage to power the ESP8266.
Voltage regulator
A popular voltage regulator design for the ESP8266 looks like this:
You solder the capacitors to the LDO, so in the end you have a voltage regulator in a small form factor that can be easily used in your projects.
I hope this guide was useful. This concept will be very helpful to power future projects.
This is an excerpt from my Home Automation using ESP8266 eBook. If you like ESP8266 and you want to learn more about it. I recommend downloading my course: Home Automation using ESP8266.
I hope this guide was useful. Thanks for reading!
thanks, you helps me a lot
You’r welcome! 🙂
Great idea! I’m going to give it a try.
What do you recommend for charging the LiPo battery when discharged?
Ross.
Hi Ross.
We recommend using a lipo battery charger: for example: https://makeradvisor.com/tools/rechargeable-li-ion-batteries/
In that link that I’ve sent you, the lipo batteries come with the appropriate charger.
Regards,
Sara 🙂
//const char* resource = “/trigger/button_pressed/with/key/
I don’t understand this.
Hi Ross.
That’s the URL path to make a request to IFTTT services.
But you’re probably referring to another blog post. In this blog post there isn’t any code, it is just a circuit.
I think you’re referring to this: https://randomnerdtutorials.com/esp8266-wi-fi-button-diy-amazon-dash-button-clone/
Regards,
Sara
Hello.
Thank you for this manual. I used this circuit to power my ESP32 project with the 18650 Li-Ion 4.2V battery. It works fine until battery voltage drops to 3.5V. Then LDO regulator gives only 2.8V and lower and ESP32 is dead. Do you now about some other circuit, which can gives still 3.3V, when battery voltage is between 4.2 to 3.3V?
Thank you.
Hi.
I’m sorry but I don’t have any tutorials about what you’re looking for.
Regards,
Sara.
Forse puoi collegare 2 batterie in serie ed ottenere così una tensione più alta, ma bisogna usare 2 batterie identiche, e verificare che il regolatore accetta tensioni di ingresso anche di 8,4 volt.
Forgive me my late reply but maybe something isn’t right. If you are using the HT7333 that only has a 90mv drop. Admitted, that is at 40mA and the ESP can draw quite a bit more, but i doubt the 7333 would go up to 700mV drop.
Can it be that you have peripherals attached that would drive the power consumption above 250mA causing the 7333 to collapse?
Anyway, as it is almost a year ago, I hope you found an answer
if you used the MCP that has a slightly larger voltage drop (170mV) and that is still a far cry from what you experienced. The MCP1700 does shut down though when >250mA is drawn
Hi Vit,
I’m sure you’ve already solved this problem but I’ll post this in case someone else is interested. Here’s most likely why the voltage drops when the battery voltage is 3.5 V.
From the MCP1700 datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/MCP1700-Low-Quiescent-Current-LDO-20001826E.pdf
See the Vin parameter in the DC Characteristics table. See Note 1.
1:The minimum VIN must meet two conditions: VIN >= 2.3V and VIN >= VR+3.0% + VDROPOUT.
VIN is the battery voltage
VR is the nominal regulator output voltage-in your case 3.3V
Note from the data sheet that VDROPOUT typical = 178 mV and VDROPOUT maximum is 350 mV.
With the typical VDROPOUT of 178 mV, VIN = (VR * 1.03) + .178 = 3.577 V i.e., greater then 3.5 V
With the worst case VDROPOUT of 350 mV, VIN = 3.749 V i.e., greater than 3.5 V
Can you please tell me why ceramic as well as electrolytic capacitors area used?
1000uF electrolytic capacitor
100nF ceramic capacitor
Regards,
Sara
Because the electrolytic capacitors work better at filtering low frequency ripple while the ceramic capacitors work better at high frequencies. In a circuit where both are present, the combination works effectively as a team.
Thanks Dan.
Hi Sara & Rui,
Brilliant tutorial.
I am trying to create a voltage regulator for the ESP-12 NodeMCU connected to a NEO-6M GPS module. The goal is to acquire real-time GPS data as a wearable.
Will the same parts required to design the voltage regulator for the ESP-01 work for the NodeMCU?
Cheers
Yes.
You can use the same parts.
Regards,
Sara
Hi,
I am trying to build a fritzing diagram including the MCP1700-3302E but cannot find this part online. The included voltage regulator has the wrong pin-out in the PCB. Is there any chance to get the version you created?
Kind regards
Kai
Hi.
Unfortunately, we don’t have that fritzing part.
Regards,
Sara
Hello.
The manufacturer suggests in the MCP1700 datasheet to use one 1uF capacitor in the V_in and one 1uF capacitor in the V_out so I am curious why are you using one 1000uF electrolytic capacitor and one 100nF ceramic capacitor?
Thanks.
MCP1700 datasheet:
ww1.microchip.com/downloads/en/DeviceDoc/MCP1700-Low-Quiescent-Current-LDO-20001826E.pdf
The 1000 uF capacitor will supply more current when the ESP is transmitting. It will work as a reservoir. You can start with a smaller capacitor like 100, 220,330,470 if you don’t have a 1000 uF capacitor.
Yes thanks, that is correct, but ESP datasheet suggests of using one 10uF ceramic and one 100nF ceramic capacitor so why use 1000uF electrolytic capacitor instead?
To answer Vit Zaoral’s question from 2 years ago, you need to use a 3.0V regulator instead of a 3.3V regulator with 18650 Li-Ion batteries or you lose 15-20% of the total battery charge with that 3.5V cutoff. Your discharge curve above is for LiPo; the Li-Ion has a steeper discharge curve (more like alkalines) so you want to have somewhere around a 3.2V minimum input voltage to get the most out of the battery. Additionally, the ESP32 and ESP8266 both draw in excess of 400mA during WiFi transmission, so you’re better served with a 500mA regulator instead of a 250mA model. You need a $$ 270uF tantalum electrolytic to supply those large current spikes during WiFi otherwise.
A TI TLV75530P would be a better LDO choice with 18650 batteries, https://www.ti.com/lit/ds/symlink/tlv755p.pdf although several other 3.0V 450-500mA LDO regulators would also work with the ESPs.
I am comparing the MCP1700 with a simple diode for voltage drop. Assuming a 8266 will operate between 2.5 and 3.6 volts (per spec sheet):
The MCP1700 has a dropout voltage of approximately 0.2 volts. which means it will power an 8266 from full charge (4.2 volts) down to dropout which would be 3.3+0.2 or 3.5 volts. Using the black line in the lipo graph above that’s about 45% of the lipo’s charge that will be available. quiescent current is 1,6 uA.
Comparing with a simple diode with a forward drop of 0.7 volts: The lipo should now power the 8266 from full charge down to 3.2 volts (3.2V – .7V = 2.5 V which is the 8266 low voltage cutoff) This uses about 95% of the lipo’s charge and no quiescent current.
Obviously I’m missing something here as the simplicity of the diode, the non existent quiescent current and about 50% greater use of the lipo seem to make it a better choice. Where did I go wrong? Or did I?
Thanks for any comments.
Schuh
OK, found several errors I made. The actual useful battery capacity on the MPC1700 is about 70% of lipo capacity (read the graph wrong … my bad 🙁 ). So that makes it about 70% for the MPC 1700, 95% for the diode and about 88% for an HT7333. BUT all that’s assuming that the LDO’s cut off completely when input voltage = regulated voltage + dropout voltage. I have since learned that some LDO’s cut all output at that point and some continue to supply current, but at a reduced voltage, That would increase the usuable amount from the lipo but drag the voltage dangerously low for lipo health. Best of all worlds would be a LDO that cuts off all output when the input voltage reaches 3.2 volts and with a dropout voltage less than 100 mV. All this in a TO92 package. Anyone …anyone …………
Hi,
It’s really not recommend to add a capacitor of this value to the OUTPUT of a voltage regulator.
For MCP1700 series the datasheet shows up 1µF and NOT 1000µF
such a huge capacitor can, depending on the regulator , have negative effects on regulation behavior or simply destroy it while attaching or removing the battery
Shouldn’t you also use a supervisor to turn off the power if the voltage is too low?