ESP8266 WiFi Temperature and Humidity Sensor

119,784

217

29

Posted

Introduction: ESP8266 WiFi Temperature and Humidity Sensor

In this tutorial we will build ESP8266 WiFi Arduino temperature and humidity data logger. Data will be stored on EasyIoT server and displayed in web browser on remote computer or on mobile phone. With ESP8266 EasyIoT Arduino library you can build sensor with couple lines of code. You can add up to 65535 sensor nodes to one EasyIoT server.

EasyIoT server supports secure SSL connection - ESP8266 does not.

Look also to simplified version in EasyIoT Cloud:

https://www.instructables.com/id/ESP8266-WiFi-DHT22-Humidity-Sensor/

See more tutorials at http://iot-playground.com/build

Step 1: Materials

ESP8266 WiFi module

Arduino pro mini 8Mhz 3.3V

DHT22 temperature and humidity sensor

5V power supply

AMS1117 3.3 regulator

Capacitor 1000uF

EasyIoT server (Windows machine or Raspberry Pi)

WiFi network (WiFi router)

Step 2: Build Sensor Node

Conenct Arduino pro mini, ESP8266, power supply and DHT22 temperature humidity sensor.

VCC 3.3 V to Arduino pro mini

VCC 3.3V to DHT22 sensor VCC

VCC 3.3V to ESP8266 VCC module

VCC 3.3V to CH_PHD pin on ESP8266 module

connect GND on Arduino, DHT22, ESP8266 and power supply GND

connect pin 3 on Arduino to pin RST pin on ESP8266

connect pin 10 on Arduino to pin UTXD pin on ESP8266

connect pin 11 on Arduino to pin URXD pin on ESP8266

connect pin 2 on Arduino to pin DATA pin on DHT22

After you connect wires upload program to Arduino sensor node. Before we start using ESP8266 WiFi module we need to update ESP8266 firmware. We use V0.9.2.2 version of firmware. Detail instructions how to update firmware can be found here.

ESP8266 temperature humidity program is on GitHub. Don't forget to set correct access point username and password and EasyIoT serverIP address in Esp8266EasyIoTConfig.h

Step 3: Build EasyIoT Server

EasyIoT server will be responsible for logging sensor data. You can add up to 65535 ESP8266 WiFi sensor nodes to one EasyIoT server.

If you are using Windows machine: just download latest release of EasyIoT server win release and unzip it to Windows machine. Run EasyIoT.exe under administrator privileges.

Or if you are using Raspberry Pi: download latest version of EasyIoT server disc image to SD card. Windows users can write EasyIoT server image to SD card with Win32 Disk Imager.

Put SD card in Raspberry Pi and switch on Raspberry Pi. Raspberry Pi must be on same network as ESP8266 module.

Step 4: Add Sensor Node to EasyIoT Server

In web browser on computer enter Raspberry Pi IP address. Use username admin and password test when asked.

Go to Configure->Drivers->ESP8266 EasyIoT driver and enable driver. Press button Add Node and switch on your ESP8266 Arduino sensor. After couple of seconds you should see two added sensor modules (no timeout message). Then go back and add new modules to Group and modules and enable data logging (see attached pictures).

Step 5: Display Data

Go in Web browser in computer and enter IP address of your Raspberry Pi. On front page you should see current temperature and humidity and chart of temperature and humidity.

Display data in web browser on remote computer or on mobile phone.

Share

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • First Time Author Contest 2018

    First Time Author Contest 2018
  • Sew Warm Contest 2018

    Sew Warm Contest 2018
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

28 Comments

This might be a silly question but, will it display in fahrenheit? I'm going to build this when the parts get here but i was just curious.

Mike

The formula for converting Celsius to Fahrenheit is (C * 1.8) +32

Just put that in your sketch to convert whatever variable holds the temp.

I mean this nicely, but it is a silly question. :-) These are just values. It's easy to represent the values as how our Imperial overlords wanted us to (until they switched to Metric anyways). You can also make up your own temperature system, so that water boils at 666 and freezes at 42. It's just scale.

(See the map() function for some easy ways to scale/convert, although for something like C<->F or F<->C there are are dedicated functions).

Ok, it's so easy? but how do you do it? most of us don't know how to do the code, or even know how to start...

See the examples at Arduino.cc and others , sparkfun,etc It is a one line change in the code .very easy

I've seen similar configurations that include a resistor but no capacitor. Is the capacitor required?

Could you run this off a coin cell battery? For example, I'd like to put this in my fridge to log temp and alert me if it drops below a certain point. So running a 5V power cord into the fridge would be a pain.

Nice project. By the way ESP8266 does support SSL. Why do you say it doesn't? Maybe it has been added since you posted this? Maybe it is the firmware on the esp8266 serial boards you use that don't support it? Lua and Micropython firmware both support SSL on esp8266.

If I do this I will likely use an I2C sensor instead. Then you don't need the Arduino. I'll probably use an MQTT server. It is rapidly becoming the standard for simple sensors. I wouldn't be surprised if EasyIot isn't based on MQTT anyway. They are a little short on technical data on their web pages so it is hard to tell. Anyway thanks for the Instructable..

this looks fun. i have done something similar. i really like the webpage interface. is that from the easyiot software?

20141208_104027.jpg

Yes, this is EasyIoT interface. It works good on desktop and mobile devices and supports secure SSL connection (ESP8266 does not suport SSL).

I noticed that you have many projects supporting "electronic" gardening. I'm also using EasyIoT to monitor and control my balcony garden. Maybe I will write instructable about this.

Did you try NRF24L01 transceiver? It's really low power - it consumes less than 1/10 power of ESP8266 and it's really suitable for battery sensors. EasyIoT also supports NRF24L01.