Friday, April 12, 2024

Battery powering an ESP8266

For an index to all my stories click this text.

Upcoming is a fairly complicated project. The project needs a microcontroller with Wifi but just a few IO pins. The ESP8266, in the form of a Wemos D1 mini, was therefore the preferred choice.
Next to that the project needs to work outdoors so no router to connect to. And it needs to be compact and mobile.
No power supply available and solar panels would make the project less mobile.

One lucky aspect is that it just needs to work for a short time, like half an hour or so. After that it would shutdown and not be used for at least a day or so.

I could connect an external powerbank but that would make my project more bulky.

So I opted for batteries.

Battery holder

I knew an ESP286-01 works with batteries as I had done some projects with these. But I had never used a Wemos D1 mini with batteries so it was a bit of a challenge. It turned out much easier as I expected.

What you need is a battery holder for 3 AA or 3 AAA batteries. You can find them at your favorite supplier or build them yourself. I did this before for some projects with an ESP8266-01 and an Attiny 85.
If you are in the lucky position to own a 3D printer you can print battery holders in any type and size you like.



Here is my design for a 3 AA battery case. You can find a description and link to STL files here: http://lucstechblog.blogspot.com/2016/04/3d-printed-battery-holder-i-was.html


Powering the Wemos with batteries.

Actually this is really simple.



Just attach the + connector from the battery holder to the 5V pin of the Wemos D1 mini. Then connect the GND from the battery holder to the GND of the Wemos D1 mini and you're done. Just make sure the Wemos D1 mini is not connected through USB.

And actually it worked really well !!!
I had a sensor attached to the ESP8266 as a test and the tiny AAA batteries even lasted for several hours which was more than needed for this project.

Here is a picture of my setup.

And the good part is that you can still remove the batteries and attach an external powersupply or powerbank.

CAUTION:
DO NOT USE THE BATTERIES AND A POWERSUPPLY, POWERBANK OR A CONNECTION TO YOUR COMPUTER AT THE SAME TIME. THAT MIGHT CAUSE UNREPAIRABLE DAMAGE, CAUSE FIRE, OR EVEN BLOW UP YOUR COMPUTER

Till next time
have fun


Luc Volders