Tuesday, December 24, 2019

ESP8266 DHT Temperature Sensor

My cube mate seems to think that hanging NASA Space Blankets on the glass cube block windows drastically changes the temperature in our cube. It does nothing to class the place up but does seem to offer some heat savings on hot days. The blocks get up over 100 degrees on sunny days so I am sure it helps some.

Anyway, I have a thermometer at my desk and thought it would be fun to create a real time monitor for the temperature near the space blanket to compare. I threw together a ESP8266, DHT, and a small LCD that I recently ordered and wanted to test.

I plugged the LCD up as follows:
GND - GND
VCC - VIN pin
SDA - D2
SCL - D1

I plugged the DHT data connection into D2 and ground and power.

Here is the code.


I am using the LCD library from here: https://github.com/johnrickman/LiquidCrystal_I2C. Just download the zip and then in the Arduino IDE add the zip file as a library. You will also see that I have the code needed to connect to wifi and then post the data to a web service. I was using this to get some temperature trends in the office, and may turn that back on later so I just left it in there.

I then found a bunch of local weather buzz words and made a little border using an index card. The temperature is gathered every 30 seconds. I would get a NAN reading from the sensor often so I changed it so if NAN was the read it would just display the last good value.




0 comments:

Post a Comment