In this tutorial we will show how to build WiFi humidity and temperature sensor connected in EasyIoT Cloud. We will use ESP8266, DHT22 and Arduino IDE.
This tutorial is obsolete. Use ESP8266 WiFi DHT22 humidity sensor (EasyIoT Cloud REST API V1) instead.
Contents
3. EasyIoT Cloud configuration
Introduction
Historical temperature and humidity chart.
Materials
-ESP8266 WiFi module
ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module | |
$2.11 | |
$17.00 |
ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module | |
$2.07 | |
$2.15 |
ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module | |
$2.06 | |
$1.75 |
ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module | |
$1.88 |
ESP8266 ESP-07 Serial WIFI Wireless Transceiver Module | |
$2.18 | |
$1.88 |
ESP8266 Lua Nodemcu WIFI Network Development Board | |
$7.43 | |
$2.65 |
-DHT22 humidity sensor
DHT22 Digital Temperature And Humidity Sensor | |
$2.67 | |
$2.45 |
-3.3V power supply (battery or regulator)
5pcs 3.3V regulator module 800mA | |
$1.12 | |
$1.56 |
2xAA 3V Battery Holder Box Case Wire | |
$0.99 | |
$0.99 |
See buying guide at the end of tutorial for details.
EasyIoT Cloud configuration
Register to EasyIoT Cloud service. If you do not receive registration email check spam folder. If it's not there contact us and we will activate your account.
Then go to Configure->Modules->Add Module and leave Generic sensor type. Click Senosr.Parameter1.
For first parameter set: Name: Sensor.Parameter1, Description: temperature, Unit:°C or °F, Enable DB logging and DBAvgInterval:10.
DB logging means that we will log values in database, and historical values can be displayed in chart. DB Avg.Interval = 10 means that average value of parameter is inserted in database every 10 minutes.
Press Save Parameter button. After save you will see InstanceId/ParameterId - remember this value, because you will need it later in program.
Go back and press Add Parameter button.
For second parameter set: Name: Name:Sensor.Parameter2, Description: humidity, Unit:%, Enable DB logging and DBAvgInterval:10.
Add new parameter and for last parameter set: Name: Settings.Icon1 and Value:humidity.png - this will change module icon. You can see all module icons under Configure->Module Icon.
If everything is configured correctly you should see new module on first age (go back on first page).
Program
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. Be sure to use library from our GitHub, because it's ported to Arduino ESP8266 IDE.
In program change Access Point username and password (AP_SSID , AP_PASSWORD) and instance id/parameter id for temperature and humidity sensor. InstanceId/Id can be found in configuration. Change EIOT_CLOUD_TEMP_INSTANCE_PARAM_ID and EIOT_CLOUD_HUM_INSTANCE_PARAM_ID and write your InstanceId/Id for temperature and humidity parameter.
Instance id/parameter id:
//AP definitions - update this
#define AP_SSID "xxxxx"
#define AP_PASSWORD "xxxxx"
// EasyIoT Cloud definitions - change EIOT_CLOUD_TEMP_INSTANCE_PARAM_ID and EIOT_CLOUD_HUM_INSTANCE_PARAM_ID
#define EIOT_CLOUD_TEMP_INSTANCE_PARAM_ID "xxxxx"
#define EIOT_CLOUD_HUM_INSTANCE_PARAM_ID "xxxxx"
If you are using Fahrenheit instead of Celsius use dht.toFahrenheit(temp) function to report temperature in Fahrenheit.
In program we will send value to EasyIoT Cloud server. Correct URL to updating value is and it's generated automatically:
http://cloud.iot-playground.com:40404/RestApi/SetParameter/[instance id]/[parameter id]/[value]
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).
See more tutorials at http://iot-playground.com/build
Buying guide
To support this site and EasyIoT framework development please buy in our store.
Comments
Yes, it's easy, EasyIoT.
RSS feed for comments to this post