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.




List of Things
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.


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
- Using the ADC on NodeMCU http://www.thalin.se/2015/05/using-adc-on-nodemcu-esp8266.html
- How to calculate temperature based LM35 readings http://www.magics-notebook.com/lm35.html
- How to verify ESP8266 connectivity http://www.esp8266.com/viewtopic.php?f=24&t=1292