How much power does a 8266 use?
Having got to the point that I can use an ESP-12E/F I was interested to see just how much current it draws.
So I modified the test/programmer lead by adding a 1R0 resistor inline, this then allowed me to use my multi-meter in voltage mode and measure the drop across the resistor.
With 1R0 as the test, we get a simple 1mV = 1mA ratio. If I was testing a higher power unit, then I would use lower resistor values to minimise the voltage loss to the device, but as the values are small this keeps things easy.
As a first test I used the blinky 50/50 program with 1/2 second on and 1/2 second off.
Measuring the current this shows a steady state value of around 24mA. But with a much higher initial draw (around 70mA). This seems to be a startup draw, my thoughts on this later.
Changing the timing ratios to on for 100ms and off for 5s, brought the current average down to 22mA.
Repeating with reversed timing, i.e. LED mostly on, took the current to 25mA, so not a huge difference. Certainly not enough that I would worry about using the LED in normal operation.
For a more realistic test, I put together a multi-role application, which had the following functionality:
- Every 10 seconds, gets the time (NTP) from a local server
- Every 1 second prints out the time to the serial port
- Has a simple web server with a text based reply
- Has a nominal 100ms sleep every loop
- Uses 74880 baud for output
By default without accessing the webserver, I again noticed the initial higher current draw, but settling down to a long term value of 63mA.
For reference I took out the sleep, and re-ran, which then showed a constant draw of around 70mA, this seemed to show no separation between the startup and the main current draw. Again comments on this later.
Increasing the sleep to 250ms gives a long term current of 56mA, and further increase to 500ms drops the current further to 44mA.
Returning to the reference 100ms sleep, but disabling the webserver totally, made a slight drop from 63mA to 62mA, this may well just be measurement error.
Returning to the 500ms sleep, and the webserver on but not used retested as 45mA.
Adding 1 chrome client brought the current up to 53mA, and adding 2 clients (from different PCs) took the current up to 68mA.
Disconnecting the clients and the current dropped back to the 44-45mA range.
I disabled the NTP polling and the current drop to around 43mA.
Turning off serial output altogether seemed to have no affect on the current which remained at 43mA.
My takeaways on current use
These are my takeaways from the tests so far:
- The unit itself seems to draw up to 70mA during startup and in the most busy cases of normal operation.
- If nothing else is happening, then the longer the sleep in the main loop, the lower the current. For me the 500ms seemed a good compromise and still allows web activity to occur without obvious delays.
- Serial output really doesn’t impact the current draw significantly, so use it appropriately.
- Background WiFi activity does affect the current draw and can push the load right back up to the 70mA max. But soon after the activity ceases the power will drop down.
- During startup and in the main loop, if you don’t include any sleep, then it will draw the full current. Don’t worry about this during startup as that only happens once (hopefully), but do consider the relevant sleep in the main loop.
Real world test
I took the above code, and added a small 32×128 OLED display (0.91″) which I used to display the IP address, the time and the ADC voltage.
I then used a small DC to DC buck/boost converter that can take a wide voltage range (1V-6V) and gives a 3.3V output. This I connected to a 18650 Cell (output voltage 4.2V full, 2.7V empty) and used this to power the test board.
Again I added the 1ohm resistor, but in this case, directly into the feed from the battery to see the raw drain.
As you can see the modules, ESP-12F, OLED and DC DC converter are all quite small units and are significantly smaller than the battery itself. I also added a resistor divider on the raw battery voltage to allow the module to measure it’s own power supply voltage.
This allowed me to test the current in actual operation, and when the battery voltage was around 3.4V it was drawing around 120mA, without the OLED this dropped to just under 100mA.
Using a 3000mAh cell (tested), I found that it would give well over a days operation without any problems. Based on the 120mA and 3000mAh, it should work out at 25 hours, so this fits well. In reality I think you will get more as the DC DC converter is more efficient when the battery voltage is higher and so you get more run time than the 3.4V test would indicate.
Get new content delivered directly to your inbox.