Subscribe to Arduino Academy and start learning today for FREE!

ESP8266 / DS18B20 Temperature; Ajax Web Updates

I wanted to monitor temperature with a ESP8266, and display the results on a web page. I grabbed a DS18B20 temperature sensor, and created a web server to display the results. I decided to use Ajax, so that the results would autoupdate without having to reload the page. The question came up, what IP address did the ESP8266 grab, so I know where to point my browser. I had a I2C LCD, so I connected that to show the IP address. I probably should have assigned a static IP so that it never changes, but hey, now you will know how to use a LCD with a ESP8266.

I have the I2C LCD connected to the ESP8266 I2C pins, GPIO5 (SCL), and GPIO4 (SDA). The LoLin calls these D1 & D2 respectively. You can specify other pins in the Wire.begin() statement, but the library I’m using doesn’t expose that command. My LCD does not run on 3.3v, so I have it connected to the USB Power pin, labeled VU on the LoLin.

The DS18B20 I connected to GPIO14 (D5), GND, and 3.3v, with a 4.7k Ohm resistor across the D5 and 3.3v.

When I put the IP address displayed on the LCD (or in serial monitor if you are not using a LCD) in my browser, I get the following display:

My next modification will be to email me when the temperature climbs above or drops below my preset “acceptable range”, indicating a problem with my HVAC system.

Libraries:
OneWire and DallasTemperature found in Library Manager

Become the Maker you were born to be. Try Arduino Academy for FREE!

Subscribe
Notify of
guest
2 Comments
Inline Feedbacks
View all comments
Wagner Nunes
Wagner Nunes
3 months ago

Very good.

Donald Vukovic
2 years ago

Thank You Steve, Worked out of the box.

Archives

2
0
Would love your thoughts, please comment.x
()
x