ESP8266 Temperature Logger With Email Alarm




Introduction: ESP8266 Temperature Logger With Email Alarm

In this tutorial we will show how to build ESP8266 DS18B20 temperature logger with Email alarm notification. We will connect it to EasyIoT Cloud. Sensor is Plug and Play - no configuration is needed to add sensor to the EasyIoT Cloud.

Step 1: Materials

1. ESP8266 WiFi module

2. DS18B20 temperature sensor

3. 4.7K resistor

4. 3.3V power supply or 2 AA batteries

Step 2: 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.

Step 3: 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. 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.

// change those lines
#define AP_USERNAME "xxxx"

#define AP_PASSWORD "xxxx"

#define INSTANCE_ID "xxxx"

Step 4: Setting Email Alarm Notification

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.

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.

Be the First to Share


    • Make It Modular: Student Design Challenge

      Make It Modular: Student Design Challenge
    • Remote Control Contest

      Remote Control Contest
    • Colors of the Rainbow Contest

      Colors of the Rainbow Contest



    Question 3 years ago on Step 3

    Don't you need to change the pin# for the DS18B20 if it isn't connected to Pin2?


    5 years ago

    I am very new to this am using a Wemos d1 v2 and a dht11 sensor can you modify the code to work with this arrangement ?


    6 years ago

    I'm working on a similar project. Do you have any experiences how long the batteries last? The ESP-01 is not able of going into deep sleep mode (without hardware modifications) so it needs power all the time...


    Reply 6 years ago

    This example doesn't use deep sleep. But with HW modifications you can easily use deep slip to extend battery life.