In all my excitement about the ESP8266 modules, I almost forgot that I had some boards made to create nice standalone temperature sensors with the ESP8266 using LM75 i2c temperature sensors.
Before my boards arrived, I had already made the central heating temperature logger and forgot about them. Today I soldered one of these boards as a test, the result is in the picture to the right. The board is mounted on a simple breakout that I made for my ESP8266 experiments. The sensor itself is not visible, as it is on the bottom side of the black PCB, so that it can easily be mounted to a surface and make proper thermal contact.
Compared to the DS1820 one-wire sensors, the temperature resolution is not that great, only 0.5 °C resolution, but interfacing these is a lot easier. To make interfacing even easier, I created a small Lua library to read an LM75 sensor from NodeMCU, it’s available in the public domain on Github.
Usage is easy:
1 2 3 4 5
The temperatures can then be read as either a sting repreenting a floating point value or scaled to an integer (temperature in °C is value/10.)
1 2 3 4
Using this library, a sensor node that emits temperatures in mrtg external script format to a TCP client can fit in this tiny snippet of code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
See my previous post about how to easily integrate this into mrtg using netcat.