In this tutorial we will show how to build Plug and Play WiFi temperature sensor connected in EasyIoT Cloud. We will use ESP8266, DS18B20 and Arduino IDE. We will also add Email alarm notification if temperature is to high.

Contents

1. Introduction

2. Materials

3. Hardware

4. Program

5. EasyIoT Cloud configuration 

6. Buying guide

 

Introduction

Historical temperature chart.

Historical temperature chart

Materials

-ESP8266 WiFi module

ESP8266 ESP-01 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-01 Serial WIFI Wireless Transceiver Module
$2.45
$7.65
ESP8266 ESP-03 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-03 Serial WIFI Wireless Transceiver Module
$2.07
ESP8266 ESP-12 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-12 Serial WIFI Wireless Transceiver Module
$2.09
ESP8266 ESP-05 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-05 Serial WIFI Wireless Transceiver Module
$1.88
$3.89
ESP8266 ESP-07 Serial WIFI Wireless Transceiver ModuleESP8266 ESP-07 Serial WIFI Wireless Transceiver Module
$2.18
$1.87
ESP8266 Lua Nodemcu WIFI Network Development BoardESP8266 Lua Nodemcu WIFI Network Development Board
$7.43
$3.20

 

-DS18B20 temperature sensor

DS18B20 DALLAS Temperature SensorDS18B20 DALLAS Temperature Sensor
$0.99
$1.19
DS18B20 DALLAS Waterproof  Temperature Sensor DS18B20 DALLAS Waterproof Temperature Sensor
$1.44
$4.05
DS18B20 Temperature Sensor moduleDS18B20 Temperature Sensor module
$1.89
$1.99
 

 

-4,7K resistor

400X 0.25w 1/4w Metal Film Resistor Pack Kit 1% 20 Value Each 20 Pcs 10 ~ 1M ohm400X 0.25w 1/4w Metal Film Resistor Pack Kit 1% 20 Value Each 20 Pcs 10 ~ 1M ohm
$3.55
$2.99

 

-3.3V power supply (battery or regulator)

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

 

See buying guide at the end of tutorial.

 

Hardware

Connection diagram is shown below. Instead of ESP8266-01 you can use different type of ESP8266. Also you can use 3.3V  power supply instead (AMS1117-3.3) of 2 AA batteries. 

ESP8266 DS18B20 connections

 

Program

Program is written in Arduino ESP8266 IDE. See Arduino ESP8266 IDE tutorial how to connect ESP8266 module to computer. If you are not experienced it's recommended to use ESP8266 Node MCU board - just connect it to computer USB port.

Download program from our GitHub. Also download EIoTCloudRestApiV1.0 library and add it to your library folder in Arduino IDE. Dallas temperature lib can be downloaded here.

In program you need to change only three lines: set access point name, access point password and your instance ID. To get instance ID you need to register to EasyIoT Cloud service. Instance Id can be found under Configure->User Info->Instance Id

Instance ID

 

// change those lines

#define AP_USERNAME "xxxx"

#define AP_PASSWORD "xxxx" 

#define INSTANCE_ID "xxxx"

Program reads configuration from EEPROM. If module ID is 0 then it know that it is not configured in Cloud. It ads new module, name it and add appropriate parameters and parameter settings (look in program comments for details). Newly added module ID is stored in ESP8266 EEPROM. Next time when we switch on our temperature sensor it reads module ID from EEPROM and no Cloud configuration is not needed. Temperature sensor is automatically added to EasyIoT Cloud and no configuration is needed. You can see new module in EasyIoT Cloud or native mobile application.

 

 

EasyIoT Cloud configuration 

To use temperature sensor you do not need to configure anything, because sensor is Plug and Play. If you want to set temperature email alarm configure following automation program. Go to Configure->Automation and press Add automation button.

In automation program configure following:

Enable program, select program type "Condition". In If condition select your newly added sensor module and Sensor.Parameter1 and set condition to ">= rising edge". Rising edge means that you will be notified only once when temperature raise at certain value. In condition value select "Fixed value" and set fixed value (in our case fixed value is 27). Then set action "Send email" and set email address and message. If you want to see value in message use {value}.  At least save program with button save.

Program configuration

 

In this example if sensor for 9 - room temperature sends temperature equal or greater than 27 we will be notified once (on rising edge) to email address with message like this:

Alarm notification

 

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

Buying guide

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

DS18B20 DALLAS Temperature Sensor

The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements.

5PCS DS18B20 DALLAS Temperature Sensor

The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements.

DS18B20 DALLAS Waterproof Temperature Sensor

The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements

DS18B20 Temperature Sensor module

The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements.

400X 0.25w 1/4w Metal Film Resistor Pack Kit 1% 20 Value Each 20 Pcs 10 ~ 1M ohm

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.

10Pcs 2xAA Plastic Battery Storage Case Box Holder

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

ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module

ESP8266 Serial WIFI Wireless Transceiver Module

ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module

ESP8266 serial WIFI model ESP-03

ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module

ESP8266 serial Port WIFI wireless module ESP-12

ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module

ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module

ESP8266 Lua Nodemcu WIFI Network Development Board

ESP8266 Lua Nodemcu WIFI Network Development Board

 


Comments   

+1 #3 Don 2016-10-18 10:55
In the "Please select a board" section, there are only Arduino boards and no ESP8266 boards. Can you please explain?
+2 #2 Super User 2016-06-12 14:30
Yes, use REST API V1 http://iot-playground.com/blog/2-uncategorised/78-easyiot-cloud-rest-api-v1-0 3.21. Get parameter value. Or use MQTT API http://iot-playground.com/blog/2-uncategorised/86-easyiot-cloud-mqtt-api-v1
+1 #1 thomas 2016-06-12 13:45
Hi,

Is there a way to get the data back from the databse to the esp8266?

You have no rights to post comments