ESP8266 IoT Temperature and Humidity Monitoring with KiwisIoT

Introduction

Have you ever wanted to monitor the temperature and humidity of a room remotely?

In this project, I developed an IoT-based temperature and humidity monitoring system using an ESP8266 NodeMCU and a DHT11 sensor.

The DHT11 sensor collects environmental data, and the ESP8266 sends the readings through Wi-Fi to the KiwisIoT Dashboard. Users can view temperature and humidity values remotely through the dashboard.

Project Overview

This project has three main components:

  • DHT11 Sensor: Measures temperature and humidity.
  • ESP8266 NodeMCU: Reads sensor data and sends it through Wi-Fi.
  • KiwisIoT Dashboard: Displays the received sensor readings.

How Does It Work?

  1. The DHT11 sensor measures the surrounding temperature and humidity.
  2. The ESP8266 reads the sensor values.
  3. The ESP8266 connects to Wi-Fi.
  4. Sensor readings are sent to the KiwisIoT platform.
  5. The KiwisIoT Dashboard displays the temperature and humidity values.

Data Flow:

DHT11 Sensor → ESP8266 NodeMCU → Wi-Fi → KiwisIoT Platform → Dashboard

Components Required

Component Quantity
ESP8266 NodeMCU 1
DHT11 Temperature and Humidity Sensor 1
Jumper Wires As required
USB Cable 1
Computer 1

Software and Tools Required

  • Arduino IDE
  • ESP8266 Board Package
  • KiwisIoT Arduino Library
  • DHT Sensor Library
  • Adafruit Unified Sensor Library
  • KiwisIoT Account
  • Wi-Fi Connection

Hardware Connections

Connect the DHT11 sensor to the ESP8266 NodeMCU using jumper wires.

DHT11 Pin ESP8266 Pin
VCC 3.3V
DATA D1
GND GND

Circuit Diagram

[INSERT CIRCUIT DIAGRAM IMAGE HERE]

The DHT11 sensor receives power from the ESP8266. Its DATA pin is connected to D1, which allows the ESP8266 to read temperature and humidity measurements.

KiwisIoT Dashboard Configuration

The KiwisIoT platform is used to receive and display the sensor readings.

I configured two data channels:

Channel Parameter Unit
Channel 0 Temperature °C
Channel 1 Humidity %

Two dashboard widgets are configured:

  • Temperature Widget: Displays temperature readings from Channel 0.
  • Humidity Widget: Displays humidity readings from Channel 1.

The ESP8266 sends the sensor values to the corresponding channels.

Arduino IDE Setup

Before uploading the program:

  1. Install Arduino IDE.
  2. Install the ESP8266 board package.
  3. Install the KiwisIoT Arduino library.
  4. Install the DHT sensor library.
  5. Install the Adafruit Unified Sensor library.
  6. Select the ESP8266 NodeMCU board.
  7. Select the correct COM port.

Arduino Code

The following Arduino program reads temperature and humidity from the DHT11 sensor and sends the values to the KiwisIoT Dashboard.

Replace the Wi-Fi name, password, and dashboard Topic ID with your own details before uploading.

#include <ESP8266WiFi.h> #include <KiwisIoT.h> #include <DHT.h>  const char* ssid = "YOUR_WIFI_NAME"; const char* pass = "YOUR_WIFI_PASSWORD"; const char* topic = "YOUR_DASHBOARD_TOPIC_ID"; #define DHT_PIN D1 #define DHT_TYPE DHT11  DHT dht(DHT_PIN, DHT_TYPE); KiwisIoT kiwisiot(ssid, pass, topic); void sendDHTData() { float temperature = dht.readTemperature(); float humidity = dht.readHumidity(); if (isnan(temperature) || isnan(humidity)) { Serial.println("Failed to read DHT11!"); return; } Serial.println(); Serial.println("---------- DHT11 MONITORING ----------"); Serial.print("Temperature: "); Serial.print(temperature, 1); Serial.println(" °C"); Serial.print("Humidity: "); Serial.print(humidity, 1); Serial.println(" %"); String temperatureData = String(temperature, 1); kiwisiot.send("0", temperatureData); Serial.print("Sent to KiwisIoT Channel 0: "); Serial.println(temperatureData); String humidityData = String(humidity, 1); kiwisiot.send("1", humidityData); Serial.print("Sent to KiwisIoT Channel 1: "); Serial.println(humidityData); } void setup() { Serial.begin(115200); Serial.println("DHT11 MONITORING"); dht.begin(); Serial.println("DHT11 initialized"); Serial.println("Connecting to KiwisIoT..."); kiwisiot.begin(); Serial.println("KiwisIoT initialized"); Serial.println("Starting monitoring..."); } void loop() { kiwisiot.run(); static unsigned long lastSend = 0; if (millis() - lastSend >= 2000) { lastSend = millis(); sendDHTData(); } delay(100); } 

Understanding the Code

1. Library Inclusion

The program uses the ESP8266 Wi-Fi library, KiwisIoT library, and DHT sensor library to communicate with the hardware and platform.

2. Wi-Fi and Dashboard Configuration

The Wi-Fi name, password, and KiwisIoT Topic ID are configured so the ESP8266 can connect to the platform.

3. Sensor Initialization

The DHT11 sensor is initialized on the D1 digital pin.

4. Reading Sensor Values

The readTemperature() function reads temperature, while readHumidity() reads humidity.

5. Sending Data to KiwisIoT

Temperature is sent through Channel 0, and humidity is sent through Channel 1.

6. Automatic Updates

The program sends new sensor readings approximately every 2 seconds.

Uploading the Program

  1. Connect the ESP8266 NodeMCU to your computer using a USB cable.
  2. Open Arduino IDE.
  3. Enter your Wi-Fi credentials and KiwisIoT Topic ID.
  4. Select the ESP8266 NodeMCU board.
  5. Select the correct COM port.
  6. Click Verify to check the program.
  7. Click Upload.
  8. Open Serial Monitor and select 115200 baud.
  9. Check the sensor readings and open your KiwisIoT Dashboard.

Live KiwisIoT Dashboard Output

The KiwisIoT Dashboard provides a simple interface for monitoring the sensor readings remotely.

[INSERT KIWISIOT DASHBOARD SCREENSHOT HERE]

The dashboard demonstration displays:

  • Temperature: 28.5 °C
  • Humidity: 72.3 %

These are the values shown in the supplied dashboard screenshot. Actual sensor readings may vary depending on the surrounding environment.

Testing and Results

After connecting the DHT11 sensor to the ESP8266 NodeMCU and uploading the program, the system reads temperature and humidity values.

The ESP8266 sends the readings to the KiwisIoT platform through Wi-Fi. The dashboard displays the received values using the configured widgets.

The system is designed to update the readings approximately every 2 seconds.

Applications

  • Home environment monitoring
  • Classroom temperature monitoring
  • Office environment monitoring
  • Laboratory monitoring
  • Greenhouse monitoring
  • Smart building systems

Future Improvements

  • Add notifications when temperature or humidity crosses a selected limit.
  • Store historical sensor readings.
  • Monitor multiple locations using additional sensors.
  • Integrate more environmental sensors.
  • Add additional dashboard features.

Conclusion

This project demonstrates how an ESP8266 NodeMCU and DHT11 sensor can be combined to create an IoT-based temperature and humidity monitoring system.

By connecting the ESP8266 to the KiwisIoT platform, users can monitor environmental readings remotely through an online dashboard.

This project provides practical experience in sensor interfacing, Arduino programming, Wi-Fi communication, and IoT-based monitoring.

Technologies Used

  • ESP8266 NodeMCU
  • DHT11 Sensor
  • Arduino IDE
  • C/C++ (Arduino Programming)
  • Wi-Fi Communication
  • KiwisIoT Dashboard
  • IoT Technology

Tags

iot esp8266 arduino dht11 kiwisiot