Shares

ESP8266 DS18B20 Temperature Sensor Web Server with Arduino IDE

Shares

In this project you’ll create a standalone web server with an ESP8266 that displays the temperature with a DS18B20 temperature sensor.

Recommended Resources:

If you like the ESP and you want to do more projects you can read my eBook Password Protected Web Server Accessible from Anywhere using ESP8266 and Arduino IDE.

Let’s get started!

Installing the libraries

You’ll need to install the OneWire Library and DallasTemperature Library.

Installing the OneWire Library

  1. Click here to download the OneWire library. You should have a .zip folder in your Downloads
  2. Unzip the .zip folder and you should get OneWire-master folder
  3. Rename your folder from OneWire-master to OneWire
  4. Move the OneWire folder to your Arduino IDE installation libraries folder
  5. Finally, re-open your Arduino IDE

Installing the DallasTemperature Library

  1. Click here to download the DallasTemperature library. You should have a .zip folder in your Downloads
  2. Unzip the .zip folder and you should get Arduino-Temperature-Control-Library-master folder
  3. Rename your folder from Arduino-Temperature-Control-Library-master to DallasTemperature
  4. Move the DallasTemperature folder to your Arduino IDE installation libraries folder
  5. Finally, re-open your Arduino IDE

Uploading your ESP8266 code

Having the ESP8266 add-on for the Arduino IDE installed (How to Install the ESP8266 Board in Arduino IDE).

Go to Tools and select “Generic ESP8266 Module” or “ESP-12E”.

Arduino IDE select esp8266

Copy the sketch below to your Arduino IDE. Replace the SSID and password with your own credentials.

After modifying my sketch upload it to your ESP8266 (if you can’t upload code to your ESP8266, read this troubleshooting guide).

Schematics

To complete this project you need the following components:

Here’s the schematics:

ESP8266_ds18b20_arduino

ESP8266 IP Address

Open the Arduino IDE serial monitor at a baud rate of 115200. After a few seconds your IP address should appear. In my case it’s 192.168.1.105.

serial monitor

Demonstration

For the final demonstration open any browser from a device that is connected to the same router that your ESP is. Then, type the IP address and press Enter:

web server window

Now you can see temperature in Celsius and Fahrenheit in your web server. To see the latest readings simply refresh the web page.

Do you have any questions? Leave a comment down below.

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook Page.

P.S. If you got stuck during this tutorial make sure you read “ESP8266 Troubleshooting Guide

P.P.S. To lear more about the sensor used in this tutorial, you can read Guide for DS18B20 Temperature Sensor with Arduino

Leave a Comment:

Add Your Reply

Download Home Automation Using ESP8266 (2nd Edition) and Save 30%
Sale Ends January 21

x