Battery powered IoT temperature logger testing

Two days I posted some pictures of my newest IoT gadget in Today’s IoT device posting.  This device was second version of my IoT temperature meter, now powered with two AA batteries.

This device is built around tiny ESP8266 module I introduced in WIFI module ESP8266 for IoT article.

The temperature data is read from DS18B20 digital temperature sensor and sent to ThingSpeak using HTTP based ThingSpeak API (module communicates with WiFi that is connected to Internet). I published the data available publicly so that I can easily read it in chart format.


In the first tests I found out that things worked pretty well. I get reasonable temperature readings once per minute. Things seemed to restore nicely if I remove and install batteries or WLAN connection. Things seem to be right here.

One issue I found out. If I remove and insert batteries to device, sometimes the temperature reading sent at around this time can have incorrect value (for example +75 degrees Celsius when real temperature was a around 23 degrees). Maybe there is need for some software fix for this..

Other issue. When I run the device for long time, I found out that suddenly the temperature reading started to increase several degrees with no specific reason (room temperature did not change considerably). I found out that battery voltage powering the device had dropped to 2.67V (old batteries getting empty). Readings started to make more off when battery voltage dropped to 2.4V or slightly below it. At 2.42V voltage the temperature reading was around 8 degrees off (reading 31-32 degress while real temperature in room was 23-24 degrees).

I put in new batteries and the reading got back to normal. I took a look at the datasheets, and found out what could be the problem source:  DS18B20 Datasheet says that the DS18B20 device can be powered with 3.0V to 5.5V power supply. When the battery voltage starts to drop from 3V, it will be too low for temperature sensor. Maybe I should add battery voltage monitoring if I plan to continue to use this sensor or try to find another more suitable sensor.

Other thing on the device is that in the current setup it eats your batteries quickly. I can run it one day or two, and batteries become empty. I think I should look up how I could optimize that so that the device could be powered longer time with batteries. I thinks there is lots of room for optimization on software side and in hardware (module has small LED that is constantly on consuming power).



  1. Tomi Engdahl says:

    Some more test results:

    My temperature meter seems to take average 68 mA from the battery.
    No wonder that the batteries run out quickly.
    There must be a way to optimize the power consumption.

  2. Tomi Engdahl says:

    One finding:
    When battery voltage dropped to around 2.3V, the temperature sensor kept sensing out temperature reading 127 degrees celsius at normal room temperature.

  3. Tomi Engdahl says:

    Another battery powered temperature meter design:

    Building a battery powered WiFi IoT Sensor with ESP8266, MS-5611 (GY-63), nodemcu and MQTT

    While there are a lot of Wifi modules on the market, the ESP8266 has some benefits. It is very cheap, it has a toolchain and powerful firmwares. Together with MQTT and ago control it is very easy to build powerful IoT (buzzword bingo! again) devices.

  4. Tomi Engdahl says:

    The typical operating voltage is 3.3V (acceptable range is 1.7V to 3.6V). As the module can draw up to 200 to 300mA peak power, make sure the power supply can deliver at least 300mA.


  5. Tomi Engdahl says:

    ESP8266 – Operating voltage range and sleep current

    Test conditions were, an ESP-01 board with both LEDs removed and a 330uF cap directly across the board input power pins. Power was supplied by a Tek lab supply and current monitored with 5.5 digit bench DMM. A Lua script was run on power up that connected to the WiFi, connected to an MQTT broker, got the temp from a DS18B20 temp sensor, published the temp, then when into deep sleep for 10sec, & repeat.

    Minimum Voltage: At the low end, the device did not reset correctly 100% of the time by about 2.2V, 2.3V seemed stable. Therefore 2.5V should be a pretty safe bet.

    Current Consumption: The ESP-01 board with no leds in deep sleep mode consumes about 30uA @ 3.3V. This sounds about right, with the datasheet stating 10uA for the ESP8266, however there is also a flash device on this board fully powered on all the time.

    At lower voltages there was no significant reduction in sleep current.

    As the voltage increased above about 3.8V there is exponential increase in sleep current

    At 4.5V, the sleep current increases to ~2.5mA, or around 100x what it is below 3.8V.


  6. Tomi Engdahl says:

    Some testing to get JSON data with URL

    I got:

  7. Tomi Engdahl says:

    For example p5js code can be pretty easily changed to read data from ThingSpeak

    var url = ‘’;

    // Get the angle (convert to radians)
    var angle = radians(Number(weather.field1));
    // Get the wind speed
    var windmag = Number(weather.field1);


Leave a Comment

Your email address will not be published. Required fields are marked *