user58286: I'm currently working on an IOT project with my esp32, ill need it to run on batteries, I will only be needing "active mode" with wifi once per hour to upload some data to a database and then go back to deep sleep (need to save data cant use hibernation).
THIS website explain pretty well how much energy the esp needs, but it says e.g. 30mA - 60mA, but on batteries it says mAh, so is the mA just mAh or how do I calculate the power usage?
.
ps.
currently, I'm thinking of using 2 cr2032 batteries, good recommendations on batteries are welcome

user4143: There's a number of things to consider when choosing batteries.
First is the capacity. In broad terms, the capacity is, mAh, means "This battery can supply X mA for one hour". So a battery of 1000mAh could supply around 1A (1000mA) for one hour before it goes flat.  Simply divide the mAh by your device's mA and you get the time it will run for before it goes flat. So a 50mA device would run for about (1000 / 50) 20 hours before running flat.  That is only a "ball park" figure though, since the capacity is somewhat dependent on the amount of current you draw.
Then there is the question of the internal resistance of the battery. This determines the maximum current that you can draw from the battery before the voltage drops below a usable level.  Different battery chemistries have different internal resistances. 
Small button cells like the CR2032 have a high internal resistance and a low capacity.  A typical cheap CR2032 has around 200mAh capacity. At 50mA that would last 4 hours. But drawing 50mA from a CR2032 is not really on.  Looking at the graphs in the datasheet linked to above you can infer that, with a nominal voltage of 3V, with a 1kΩ load the output drops to 2.6V. That means that 1kΩ is drawing (2.6/1000) 0.0026A (2.6mA).  The internal resistance is dropping (3 - 2.6) 0.4V, therefore the internal resistance must be (0.4 / 0.0026) 154Ω. 
Drawing 50mA from the battery would mean the internal resistance would drop (154 * 0.05) 7V. Since you can't get below 3V, that means the battery simply can't support that kind of current drain.  Indeed, in the datasheet I link to the "Standard Current Drain" (the current it's rated for as "normal" usage) is a mere 0.1mA. 
So to work out what battery you need, you want:

The average current draw over the period of an hour
The peak current draw the device will draw
The length of time you need the device to run for between battery changes / recharges

For the ESP32 the current can peak at hundreds of mA depending on what you are doing (WiFi uses a lot of power in short bursts). The average will be based on the ratio of the "running" time to the "sleeping" time, and the current draw for both those states. 

58286: <p>I'm currently working on an IOT project with my esp32, ill need it to run on batteries, I will only be needing "active mode" with wifi once per hour to upload some data to a database and then go back to deep sleep (need to save data cant use hibernation).</p>

<p><a href="https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/" rel="nofollow noreferrer">THIS</a> website explain pretty well how much energy the esp needs, but it says e.g. 30mA - 60mA, but on batteries it says mAh, so is the mA just mAh or how do I calculate the power usage?</p>

<p>.</p>

<p>ps.</p>

<p>currently, I'm thinking of using 2 cr2032 batteries, good recommendations on batteries are welcome</p>
 4143: <p>There's a number of things to consider when choosing batteries.</p>

<p>First is the capacity. In broad terms, the capacity is, mAh, means "This battery can supply X mA for one hour". So a battery of 1000mAh could supply around 1A (1000mA) for one hour before it goes flat.  Simply divide the mAh by your device's mA and you get the time it will run for before it goes flat. So a 50mA device would run for about (1000 / 50) 20 hours before running flat.  That is only a "ball park" figure though, since the capacity is somewhat dependent on the amount of current you draw.</p>

<p>Then there is the question of the internal resistance of the battery. This determines the maximum current that you can draw from the battery before the voltage drops below a usable level.  Different battery chemistries have different internal resistances. </p>

<p>Small button cells like the CR2032 have a high internal resistance and a low capacity.  A <a href="http://www.farnell.com/datasheets/1671733.pdf" rel="nofollow noreferrer">typical cheap CR2032</a> has around 200mAh capacity. At 50mA that would last 4 hours. But drawing 50mA from a CR2032 is not really on.  Looking at the graphs in the datasheet linked to above you can infer that, with a nominal voltage of 3V, with a 1kΩ load the output drops to 2.6V. That means that 1kΩ is drawing (2.6/1000) 0.0026A (2.6mA).  The internal resistance is dropping (3 - 2.6) 0.4V, therefore the internal resistance must be (0.4 / 0.0026) 154Ω. </p>

<p>Drawing 50mA from the battery would mean the internal resistance would drop (154 * 0.05) 7V. Since you can't get below 3V, that means the battery simply can't support that kind of current drain.  Indeed, in the datasheet I link to the "Standard Current Drain" (the current it's rated for as "normal" usage) is a mere 0.1mA. </p>

<p>So to work out what battery you need, you want:</p>

<ul>
<li>The average current draw over the period of an hour</li>
<li>The peak current draw the device will draw</li>
<li>The length of time you need the device to run for between battery changes / recharges</li>
</ul>

<p>For the ESP32 the current can peak at hundreds of mA depending on what you are doing (WiFi uses a lot of power in short bursts). The average will be based on the ratio of the "running" time to the "sleeping" time, and the current draw for both those states. </p>
