NodeMCU as a standalone thermometer


I finally completed work on my networked thermometer. I got some old 7Ah 5-cell NiCd battery packs from emergency lighting fixtures that will power the device. I wonder how long can they last. NiCd batteries suffer from high self-discharge rates, on the other hand the NodeMCU will sleep most of the time and use very little energy.


I wanted to measure battery voltage. NodeMCU has a resistive divider (click on the schematic to enlarge, it is in the “ADC” box on the right), but when I measured USB voltage (about 5V) the ADC got saturated and returned 1023. I added a 270k resistor first, but it did not help. Then I added 180k to that (450k overall). I did a single point calibration – the ADC returned 685 when the voltage was 5,075V. The scaling factor is 0,007382482 [V/LSB] – you have to multiply ADC value by it to get the value in Volts. I do it on the server side before feeding data to RRDtool.

That is how the “finished” “product” looks like (it still needs a weatherproof box):

I store the data in a RRDtool database to make some nice graphs. RRDtool is both a database and graphing application suited for time-series data (I will make a separate post about it).
This sensor is named “No2”. The “No1” stopped sending data when I was cleaning up the cables and accidentally disconnected it (USB charger cable was quite loose). Both are located in different places in the house.

One thought on “NodeMCU as a standalone thermometer

Comments are closed.