In this tutorial we will show how to build "Plug and Play" WiFi humidity and temperature sensor connected in EasyIoT Cloud. It shows how to send two parameters with one request with REST API V1. We will use ESP8266, DHT22 and Arduino IDE. 

Contents

1. Introduction

2. Materials

3. Program

4. Hardware

5. Buying guide

 

Introduction

 

Historical temperature and humidity chart. Data can be exported to CSV.

Materials

-ESP8266 WiFi module

ESP8266 ESP-01 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-01 Serial WIFI Wireless Transceiver Module
$2.11
$17.00
ESP8266 ESP-03 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-03 Serial WIFI Wireless Transceiver Module
$2.07
$2.15
ESP8266 ESP-12 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-12 Serial WIFI Wireless Transceiver Module
$2.06
$1.75
ESP8266 ESP-05 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-05 Serial WIFI Wireless Transceiver Module
$1.88
ESP8266 ESP-07 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-07 Serial WIFI Wireless Transceiver Module
$2.18
$1.88
ESP8266 Lua Nodemcu WIFI Network Development BoardESP8266 Lua Nodemcu WIFI Network Development Board
$7.43
$2.65

 

-DHT22 humidity sensor

DHT22 Digital Temperature And Humidity SensorDHT22 Digital Temperature And Humidity Sensor
$2.67
$2.45
 

 

-3.3V power supply (battery or regulator)

5pcs 3.3V regulator module 800mA5pcs 3.3V regulator module 800mA
$1.12
$1.56
2xAA 3V Battery Holder Box Case Wire2xAA 3V Battery Holder Box Case Wire
$0.99
$0.99

 

See buying guide at the end of tutorial for details. 

Program

First we need to register to EasyIoT Cloud. After registration we do not need any other configuration, because sensor is "Plug and Play". We just need to remember Instance Id which is visible under Config->User Info.

Program is written in Arduino ESP8266 IDE. See Arduino ESP8266 IDE tutorial how to connect ESP8266 module to computer to upload program. Program is available at our GitHub. You will also need DHT22 library and REST API V1 library. Be sure to use library from our GitHub, because it's ported to Arduino ESP8266 IDE.

 

 

In program change Access Point username and password and Instance Id. Instance Id is under Config->User Info.

Instance id:

Instance Id

 

// change those lines
#define AP_USERNAME "xxx"
#define AP_PASSWORD "xxx"
#define INSTANCE_ID "xxx"

 

If you are using Fahrenheit instead of Celsius use dht.toFarenheit(temp) function to report temperature in Fahrenheit.

 

First time when you connect sensor to power supply it will connect to access point and check module id. If module id is 0, then program will call REST API functions to get new token, adds new module and configure its parameters. Module Id and token are then stored in EEPROM. If module is already added to cloud (module id is different than 0), then program will skip this procedure and just read module parameters Id's. Then it reads temperature and humidity and sends it to Cloud in one POST. API function to post more parameter values is SetParameterValues.

Hardware

Connection diagram is shown below. Instead of ESP8266-01 you can use different type of ESP8266. For power supply you can use 2 AA batteries or 3.3V regulator (see buying guide).

 

ESP8266 DHT22 connection

 

ESP8266 DHT22 humidity sensor

 

ESP8266 DHT22 sensor

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

Buying guide

To support this site and EasyIoT framework development please buy in our store.

ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module

ESP8266 Serial WIFI Wireless Transceiver Module

ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module

ESP8266 serial Port WIFI wireless module ESP-12

ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module

ESP8266 serial WIFI model ESP-03

ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module

ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module

ESP8266 ESP-07 Serial WIFI Wireless Transceiver Module

ESP8266 with external antenna

ESP8266 Lua Nodemcu WIFI Network Development Board

ESP8266 Lua Nodemcu WIFI Network Development Board

DHT22 Digital Temperature And Humidity Sensor

The DHT22 is a basic, low-cost digital temperature and humidity sensor.

5pcs 3.3V regulator module 800mA

Basic regulator module based on AMS1117.

2xAA 3V Battery Holder Box Case Wire

This 2xAA battery holder puts a nice finishing touch on your battery powered project.

 


Comments   

#7 profile 2018-10-31 11:02
Need cheap hosting? Try webhosting1st, just $10 for an year.

#6 Late 2017-11-17 11:40
Help! This does not work
#5 streexz 2017-06-14 17:50
i try combination ESP8266 WiFi DHT22 humidity sensor (EasyIoT Cloud REST API V1) and ESP8266 WiFi door/window sensor (EasyIoT Cloud REST API V1.0) why in sensor.parameter1 cannot change text??
#4 Vojta Bula 2017-01-06 12:33
Hey, I like this project.

How to solve outside and the bedroom temperature? You have connected only one temperature sensor. In the text code you have it. Can I solve wireless?

Thank you
+2 #3 Gleb 2016-11-21 08:06
#define AP_USERNAME "xxx"
#define AP_PASSWORD "xxx"

please rename this to

#define WIFI_NAME "xxx"
#define WIFI_PASSWORD "xxx"


I spent two o'clock to understand that this is not your login and password on the application (AP)
+1 #2 Gerald 2016-05-21 01:08
Great Work
how can i add a Battery monitor to this Project
i am not a realy good programmer
thx
+1 #1 Pedro 2016-05-11 16:50
Great tutorial you have here. I've followed it to use with my D1 mini + DHT11 shield but I'm having some issues.

Before the upload I've changed the AP user and password and the instance_id. I've also changed the DHT pin from 2 to 4, to match the connections on the D1 mini.

After the upload I'm getting this on the serial monitor:

http://i.imgur.com/PyxIvei.png

Can you help me please?

You have no rights to post comments

Forum latest

  • No posts to display.