Day 7: Monitoring Home Temperature on the Internet

This is my first ever DIY project — detecting the indoor temperature of my house, and send the periodic recordings to ThingSpeak via WiFi.

I’m quite happy about what has been done today. As I mentioned earlier on, the documentation for NodeMCU was scattered all over the internet. I’m glad I got a little I/O system working, after aggregating all the pieces of information I have learned.

My home temperature on ThingSpeak. I touched the sensor a little once, so that I could verify the reading was not some random static number. It causes the peak around 29 degrees.
Couple of hours later

List of Things

  1. A NodeMCU dev board with ESP8266
  2. A LM35 temperature sensor
  3. Few jumper wires
  4. A USB cord
  5. A breadboard

Wiring

Code

https://gist.github.com/rock3m/7da289ee41ced0488152

Problems

At the beginning, the temperatures ThingSpeak had collected were between 29 and 31 Celsius degrees. It is a quite comfortable day in Seattle today. It cannot be around 30. I checked the thermometer on the heat control panel. It shows 78 F (equal to 26 C). Michael mentioned that, maybe I put the sensor too close to my laptop, and the heat from the laptop may have affected the temperature readings. I moved it around, it didn’t change much.

Before the problem was solved

Then, I went back to check the reading range of the power supply on the NodeMCU. It says 3.3V on the board, but it was actually 2.85 V when I checked the output by running: print(adc.readvdd33()) .

So I updated the temperature formula a bit to:
r = adc.read(0)
c = r * 285 / 1024

Then the temperature turned out to be consistent with the temperature reading on the thermometer. The reason is that, the LM35 series are precision integrated-circuit temperature devices with an output voltage linearly-proportional to the Centigrade temperature. The base is the power supply voltage.

References