Hi Rui & Sara,
First of all, I wanted to thank you for all the work you do. Your site is a real gold mine!
I started electronics a short time ago, and I’ve learned a lot thanks to you. Nevertheless, I still have a lot of shortcomings on a purely electrical level.
My goal is to be able to power small circuits built around the ESP32 with Lithium-Ion batteries. In particular, I would like to know if I can power the following circuit with a simple CR123 (3V) battery by connecting the positive pole directly to the 3V3 pin of the ESP32.
1. Will the ESP32 be able to operate in this way?
2. Will this be enough to power the BME280 temperature sensor at the same time?
What do you think?
I would have the same questions if I replaced the CR123 with a 18650 LiFePO4 (3.2V) battery.
3. What do you think would be best?
4. Do I need to insert a voltage regulator between the battery and the ESP32? And if you think it is necessary, which one would you recommend?
Hopefully you can answer me,
Thanks again for everything.
[Edit] 2 days later
No one here has a clear idea on the matter?
Yet the prospect is very interesting for small embedded projects with a long autonomy at low cost (as long as the microcontroller is put to deep sleep or hibernation)…
I’ve not been able to power my ESP32 modules using a 3V cell. I have used 4×1.2 rechargeable batteries with success going to the 5V input. The ESP will run pretty consistently until the batteries drop down to under 4 volts. I have an outdoor solar powered project that can run for days, as long as it’s reallllly sunny. (I’m beefing up my solar cell and getting higher capacity batteries 🙂 )
FWIW – Current draw on my HiLetGo WrOOM32 module (with attached BME280 sensor) is 160mA running and 15 mA in deep sleep mode.
Thank you for your detailed feedback @SDBURTON.
To tell the truth, I would like to avoid going through Vin in 5V, because the voltage regulator associated with it necessarily implies a loss of energy in the form of heat due to the potential difference in relation to the operating voltage of the ESP32. And the greater this difference, the more the regulator will heat up. As a result, some of the energy supplied by the battery is wasted to produce heat which unfortunately serves no purpose, except to risk damaging the board if the potential difference is too high.
CR123 3V batteries actually seem to provide a voltage of 3.2V ~ 3.3V when they are charged (according to their data sheet), and this voltage decreases very slightly during the whole discharge process (before the exhaustion threshold, where it suddenly collapses). But during the discharge phase, the voltage seems to remain above 2.7V for a consumption below 250 mA, so it is a priori sufficient to supply the ESP32.
But these are only the observations of a pure novice 🙂 and I ask myself the following questions:
– can the 3.3V pin also be used to power the ESP32 or can it only be used to power the rest of the circuit on the prototyping board (if the ESP32 is also powered via its micro-USB port or its Vin input)?
– won’t I damage my ESP32 board by connecting a CR123 battery to its 3.3V pin?
Moreover, I had also spotted some rechargeable lithium batteries: the LiFePO4, which deliver a voltage of 3.2V, so it’s very close to the ESP32’s operating voltage. I thought (perhaps naively) that this would be enough to power my ESP32. And if I put it into a deep sleep for 1 or several minutes between each measurement on the sensor, then I could expect a running time of several weeks or even months (?)
In fact, I don’t dare to make the connection too much for fear of burning my ESP32 card :-/
Moreover, while going through the BME280 data sheet in detail, I noticed that it was possible to set up different sampling scenarios. And one mode in particular (Weather Station mode) allows you to obtain the temperature, humidity and pressure every minute by also putting the sensor in deep sleep for the whole time between each measurement… which means substantial energy savings in the long term there too!
Sorry for my questions, which may be silly, but I’m just starting with electronics and I don’t have enough distance to make a correct analysis…
In any case thank you for your detailed answer, even if it does not correspond exactly to what I wish to achieve. But maybe what I wish is impossible. Perhaps someone here can help me to clarify this question?
I don’t think you can use CR123 (3V) to power the ESP32 with the BME280. You really need to provide 3.3V on the 3.3V pin or 5V(or a bit lower) on the VIN pin.
We have a tutorial that explains how to power the ESP8266 with batteries that also applies to the ESP32. You can read it here: https://randomnerdtutorials.com/esp8266-voltage-regulator-lipo-and-li-ion-batteries/
We also have this with solar pannels: https://randomnerdtutorials.com/power-esp32-esp8266-solar-panels-battery-level-monitoring/
Let me know if you need further help.
I’ve just posted my previous answer before reading your question.
So, here I’m answering your previous question.
- If you’re powering the ESP32 through the USB cable, the 3.3V pin will output 3.3V. So, you can use this pin to power the rest of the circuit. So, in this scenario, you can’t provide 3.3V on that pin – you can only use one power source at a time for the ESP32. You can use an external power supply for the peripherals (sensors, etc) if needed.
- I’ve never experimented with a CR123 battery, but I don’t think it will damage the ESP32 – but you have to experiment to actually see the results.
- Also, in terms of power consumption, you need to experiment to see what will actually happen. Every case is different, so I don’t have a clear answer for you.
- About the BME280 in deep sleep mode, I’ve never tried it, but maybe you can find something about it in this example: https://github.com/adafruit/Adafruit_BME280_Library/blob/master/examples/advancedsettings/advancedsettings.ino
I’m sorry if I didn’t help much.
Thank you Sara for your advice.
I will try to study in detail the leads you gave me, and I will get back to you if I need help.
On the other hand, you didn’t give your opinion on the possibility of using rechargeable Lithium-Ion batteries like LiFePO4 which deliver a nominal voltage of 3.2V… don’t you think it could work?
And I just took a look at Adafruit’s code… This is exactly what I used in my code:
bme->setSampling( Adafruit_BME280::MODE_FORCED, Adafruit_BME280::SAMPLING_X1, Adafruit_BME280::SAMPLING_X1, Adafruit_BME280::SAMPLING_X1, Adafruit_BME280::FILTER_OFF );
Finally, how can I accurately measure the current drawn by my circuit in operation?
I haven’t experimented with those batteries. So, I can’t really tell. You have to experiment and see how it works. We’ve used 3.7V lithium batteries with a voltage regulator and worked well: https://randomnerdtutorials.com/esp8266-voltage-regulator-lipo-and-li-ion-batteries/
To measure the current drawn you can use a good multimeter, you can use a dedicated power supply that shows the power consumption, or you can use something like this tool.
I hope this helps.
Okay, I’ll run some tests with different lithium batteries and let you know… I’m still hopeful it’ll work.
I have a multimeter… but I don’t know where to place the probes to properly measure the overall power consumption…
To proper measure the power consumption you need to place the multimeter before the power reaches to the ESP32. So, you can either strip your USB cable and cut the red wire to place your probes as shown in this image (ignore the ESP-01 circuit on the PCB). If you do this, I recommend cutting a USB cable that doesn’t have data wires if you have one.
If you don’t want to cut your USB cable, you can use something like this tool or an external power supply.
I hope this helps.
Well… I think I’ve found a little trick (you’ll tell me if it’s wacky):
I power an Arduino Nano via the micro-USB port and I put my amperemeter in series between the 5V output of the Nano and the Vin input of my ESP32.
It seems to work!
11.4 mA during the sleep phase and
75 mA during the measurement phase with the BME280.
What do you think of my idea? Is it reliable?
Sorry Sara, I hope I’m not boring you too much with my questions…
Thank you very much for your help!
Those seem to be normal values for power consumption. Go ahead and experiment.
Don’t worry about asking questions, that’s the purpose of the forum.
If you need further help, just ask.
Yes, after reading different things here and there, I realize that the ESP32 DevKit v1 (DoIt) is not the most suitable board for the lowest power consumption! Even when it does almost nothing (in deep sleep), mine already consumes 11 mA, which is huge.
So I started looking for less greedy boards, and I identified two that I think better meet my expectations:
- The FireBeetle from DFRobot, already well known.
- The TinyPico, more recent, designed by an Australian Maker who achieves very good results in terms of consumption (only 18 µA in deep sleep!). I don’t know if you know this board, but I think it’s worth the detour for embedded projects.
Thanks again for your answers,
See you soon
For low power consumption, I think the TinyPico is more suitable. I’ve heard a lot about the TinyPico, but I haven’t experimented with that yet.
You’ll also get good results if you use an ESP32 or ESP8266 bare chip. We have a project that uses the ESP8266 bare chip and it consumed very little power (about 7uA in deep sleep): https://randomnerdtutorials.com/low-power-weather-station-datalogger-using-esp8266-bme280-micropython/
This project will be perfect for me to start designing my first PCB!
Personally, I prefer to code in C, but the leads are already there for everything else.
Thanks a lot Sara!
I don’t know why you marked the discussion as “Resolved” ?
The initial topic wasn’t really closed in my opinion… 🙂
Anyway, I wanted to post you a picture of my circuit in operation as a demonstrator:
– an ESP32 DevKit v1 (DoIt) board running as a WiFi Access Point
– flashing of the built-in LED as a WiFi ready indicator
– a BME280 sensor wired to the I2C bus
– an amperemeter wired in series with the circuit power
– all powered by a CR123 1400 mAh battery on the 3.3V input
And… it works!
So this experiment seems to prove that it holds the charge with a power consumption that is not at all optimized here (I didn’t put the ESP32 in deep sleep on purpose for this demo).
I’m waiting to receive my TinyPico board to set up an operational weather station optimized to extend its autonomy using deep sleep. I guess it will last a very long time.
But I’m happy to have been able to see how the whole circuit works with a DevKit v1 which is greedy.
Who can do more can do less…