This project demonstrates a real-time IoT system built using the ESP32 and the MQTT protocol.
It enables:
- 🌡️ Live monitoring of temperature and humidity
- ☁️ Cloud-based data transmission
- 💡 Remote control of devices (LED)
The system showcases two-way communication between hardware and cloud, which is a core concept in modern IoT systems.
- IoT (Internet of Things)
- MQTT Publish–Subscribe Model
- Real-time Data Communication
- Embedded Systems (ESP32)
- Cloud Messaging Systems
graph LR
A[DHT22 Sensor] --> B[ESP32]
B -->|Publish| C[MQTT Broker]
C -->|Subscribe| D[MQTT Client]
D -->|Command| C
C -->|Deliver| B
B --> E[LED]
- Reads temperature and humidity using DHT22
- Sends data every 2 seconds
- MQTT Topics:
/ThinkIOT/temp/ThinkIOT/hum
- Enables real-time monitoring via MQTT clients
- Subscribes to:
home/led
- Supported commands:
ON→ LED turns ONOFF→ LED turns OFF
- Instant cloud-to-device communication
- ESP32 Microcontroller
- DHT22 Sensor
- LED + Resistor
- Jumper Wires
- Arduino IDE
- MQTT Client (MQTTx recommended)
- WiFi.h
- PubSubClient.h
- DHTesp.h
| Parameter | Value |
|---|---|
| Broker | test.mosquitto.org / HiveMQ |
| Port | 1883 |
| Protocol | MQTT |
| Topic | Type | Purpose |
|---|---|---|
| /ThinkIOT/temp | Publish | Temperature data |
| /ThinkIOT/hum | Publish | Humidity data |
| home/led | Subscribe | LED control commands |
- ESP32 connects to Wi-Fi
- Reads DHT22 data
- Publishes values to MQTT broker
- MQTT client receives live data
- User sends command (
ON/OFF) - Broker forwards message
- ESP32 processes input
- LED switches accordingly
- ✅ Successful Wi-Fi + MQTT connection
- ✅ Continuous real-time data transmission
- ✅ MQTT client received:
- Temperature: 4.50°C
- Humidity: 55.5%
- ✅ LED responded instantly to commands
- MQTT reconnection handling
- Wi-Fi instability
- Message formatting issues
- Sync between publish & subscribe
- 📱 Mobile App Integration
- 📊 Dashboard (Node-RED / Grafana)
- 🔒 Secure MQTT (TLS/SSL)
- ☁️ Cloud Platforms (AWS IoT, Firebase)
- Smart Homes
- Weather Monitoring
- Industrial IoT
- Agriculture Systems
- Charan Mahendaran
- Aditya Nimbargi
- Likhith K
This project is intended for academic and educational use.
If you found this useful:
- ⭐ Star the repo
- 🍴 Fork it
- 📢 Share it
This project builds a strong foundation in IoT, combining embedded systems with real-time cloud communication—an essential skill for modern engineers.

