Temperature and Humidity Monitoring System using ESP8266 and DHT11 with Arduino Cloud Monitoring

This document outlines how to create a temperature and humidity monitoring system using an ESP8266, DHT11 sensor, and Arduino Cloud Monitoring. The system measures environmental data and sends it to the Arduino IoT Cloud, allowing real-time monitoring from a web dashboard or mobile app.

Components Required

  1. ESP8266 (e.g., NodeMCU or Wemos D1 Mini)
  2. DHT11 Temperature and Humidity Sensor
  3. Jumper wires
  4. Breadboard
  5. USB cable for ESP8266

Step 1: Arduino Cloud Setup

  • Sign in to Arduino Cloud:
  • Visit the Arduino IoT Cloud and log in with your Arduino account.
  • Create a Thing:
  • Define a new “Thing” and add variables for temperature and humidity.
  • Configure the Device:
  • Add your ESP8266 device to the cloud using its unique device ID.
  • Dashboard Design:
  • Create a dashboard and add widgets like gauges or charts to display the temperature and humidity.

Step 2: Connecting the Hardware

  • DHT11 Pinout:
  • VCC: 3.3V or 5V
  • GND: GND of ESP8266
  • DATA: GPIO pin (e.g., D4 for NodeMCU)
  • Wiring Diagram:
  1. Connect the DHT11 VCC to 3.3V on ESP8266.
  2. Connect GND to GND.
  3. Connect DATA to a GPIO pin.

Step 3: Programming ESP8266

  • Install Required Libraries:
  • DHT sensor library by Adafruit.
  • Arduino IoT Cloud library.
  • Sample Code:
  • The Arduino IoT Cloud automatically generates boilerplate code after setting up your Thing. Add the following logic to read the DHT11 data:
#include "thingProperties.h"
#include <DHT.h>

#define DHTPIN D4
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

void setup() {
  Serial.begin(9600);
  initProperties();
  ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  dht.begin();
}

void loop() {
  ArduinoCloud.update();
  temperature = dht.readTemperature();
  humidity = dht.readHumidity();

  if (isnan(temperature) || isnan(humidity)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  Serial.print("Temperature: ");
  Serial.println(temperature);
  Serial.print("Humidity: ");
  Serial.println(humidity);
}

Step 4: Uploading the Code

  1. Select NodeMCU 1.0 (or your ESP8266 board) in the Arduino IDE.
  2. Choose the correct COM port.
  3. Upload the code to the ESP8266.

Step 5: Monitoring the Data

  • Access the Arduino Cloud Dashboard to view real-time temperature and humidity readings.
  • Use the Arduino IoT Remote app on your smartphone for mobile monitoring.

Applications

  1. Home Automation: Monitor indoor temperature and humidity for comfort.
  2. Greenhouses: Track environmental conditions for plant health.
  3. Weather Stations: Build simple weather monitoring setups.

Leave a comment

Your email address will not be published. Required fields are marked *