Temperature and humidity monitoring

Author: Maria Iuga, AAC

Project Description

The purpose of this project is to create a small system that measures the temperature and humidity inside a room and sends the data to the Adafruit cloud platform.

For the implementation of the project, I used ESP32-WROOM 32 board, a DHT11 sensor, Adafruit IO platform and the IFTTT service. The connection between Arduino IDE and Adafruit is made using the IFTTT service through the applets. Also, two rules are set in case the sensor registers a temperature higher than a certain value or a temperature lower than a value.

Hardware Description

ESP32 – is the name of the chip developed by Espressif Systems. This provides WI-FI and dual-mode Bluetooth connectivity to embedded devices.

DHT11 – is composite sensor that contains digital signal output of the temperature and humidity.

The connections from the ESP32 to the DHT11 sensor are the following:

  • GPIO26 pin of the ESP32 with the S pin of the DHT11 sensor;
  • GND pin of the ESP32 with the GND pin of the DHT11 sensor;
  • VIN (5V) pin in the ESP32 with VCC pin of the DHT11 sensor.

Software description

IFTTT (IfThisThanThat) – is a service represented by a website or as an application available for IoS and Android that offers a simple way to connect smart devices using applets.

Adafruit IO platform – is a cloud service that makes data useful. The platform allows simple data connections with programming required. The ESP32 board was programmed using Arudino IDE and its programming language.

Aduino IDE – is an open-source software used for writing, compiling & uploading code. Programs written using Arduino Software (IDE) are called sketches.

The main libraries used for the project are:

  • DHT.h is used an Arduino library for DHT11, DHT12 and other temperature and humidity sensors;
  • Wifi.h is used for ESP32 to connect with the network and communicate with the IFTTT service.

Project implementation

Arduino IDE functions used to record and send the data from the sensor to Webhooks from IFTTTT.

void setup () { 
//initialize the serial monitor for debugging 
 Serial.begin(115200);
 Serial.println("DHT11 sensor!");
//call begin to start sensor
 dht.begin();
// Connect to Wi-Fi
 WiFi.begin(ssid, password);
 while (WiFi.status() != WL_CONNECTED) {
   delay(500);
   Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");  
}

Two rules were set in the project.

1.If the temperature is higher than 25 C, an email is sent through an applet (named high temp) with the message “Temperature too high!”;

if (t > high_temp ){  
    if (!client.connect(host, httpPort)) {
      Serial.println("connection failed");
      return;
    }
    else  
    Serial.println("conected");
    client.print(String("POST ") + url_high_low_temp + " HTTP/1.1\r\n" +
    "Host: " + host + "\r\n" + 
    "Content-Type: application/x-www-form-urlencoded\r\n" + 
    "Content-Length: 41\r\n\r\n" +
    "value1=" + t + 
    "&value2="+"Temperature too high "+"\r\n");
    delay(15000);  
}
  

2.If the temperature is lower than 24 C, an email is sent through the same applet with the message “Temperature too low!”.

if (t < low_temp ){  
  if (!client.connect(host, httpPort)) {
      Serial.println("connection failed");
      return;
  }
  else
  Serial.println("conected");
  client.print(String("POST ") + url_high_low_temp + " HTTP/1.1\r\n" +
  "Host: " + host + "\r\n" + 
  "Content-Type: application/x-www-form-urlencoded\r\n" + 
  "Content-Length: 40\r\n\r\n" +
  "value1=" + t + 
  "&value2=" + "Temperature too low "+"\r\n");
  delay(15000);
 }

IFTTT applets used to receive data from Arduino IDE and send them to Adafruit IO platform and send an email The temperature and humidity data are sent to Adafruit IO platform through two applets named temperature and humidity.

The applet Emergency Email Transmission receives two values via Webhooks and it uses the first value to display the temperature recorded and the second value display the warning message accordingly to the temperature recorded (high/low) then sends an email structured like in below image.

The emails sent by the applet are as follows and differs, as two rules are set.

Adafruit IO platform receives data from IFTTT and displays it accordingly. The readings of the sensors are displayed in Adafruit Dashboard. The humidity data is displayed live and the temperature is displayed over a course of 24h.

Conclusion

Using the IFTTT service and Adafruit IO platform is an easy way to monitor remotely the temperature and humidity inside a room from anywhere.

Resources

iothings/proiecte/2021/temphumiditymonitoring.txt · Last modified: 2022/01/28 00:26 by maria.iuga
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0