ESP32 Multi-Interface Smart Edge Node Using MQTT and UART

by ayush4514be23 in Circuits > Electronics

11 Views, 0 Favorites, 0 Comments

ESP32 Multi-Interface Smart Edge Node Using MQTT and UART

ChatGPT Image May 25, 2026, 02_26_48 AM.png

This project demonstrates a smart IoT edge node developed using the ESP32-WROOM microcontroller and DHT22 temperature-humidity sensor. The system performs real-time environmental monitoring and simultaneously transmits data using MQTT over WiFi and UART serial communication.

Humidity data is published to an MQTT broker for cloud-based monitoring, while temperature data is displayed locally using UART serial communication. The project demonstrates multi-protocol IoT communication, embedded networking, and real-time telemetry systems using low-cost hardware.

Supplies

ESP32-WROOM

DHT22 Sensor

Breadboard

Jumper Wires

USB Cable

WiFi Network

Hardware Components

download.jpg
esp32-development-board-800x800.jpg

In this project, the ESP32-WROOM microcontroller is used as the central processing unit, while the DHT22 sensor is used for temperature and humidity sensing.


The ESP32 provides:

- Built-in WiFi

- UART communication

- GPIO control

- MQTT networking support

Circuit Connections

1.png

ESP32 3.3V → DHT22 VCC

ESP32 GND → DHT22 GND

ESP32 GPIO23 → DHT22 DATA

10kΩ pull-up resistor connected between VCC and DATA

Working Principle

WhatsApp Image 2026-05-25 at 1.59.53 AM.jpeg

The ESP32 continuously reads temperature and humidity values from the DHT22 sensor.


Humidity data is transmitted to an MQTT broker over WiFi for cloud monitoring.


Temperature data is simultaneously transmitted through UART communication for local monitoring using RealTerm.


This demonstrates simultaneous local and remote communication using embedded IoT architecture.

MQTT Communication

MQTT Communication

MQTT (Message Queuing Telemetry Transport) is a lightweight communication protocol widely used in Internet of Things (IoT) systems. It follows a publish-subscribe architecture, where devices publish data to a broker and clients subscribe to receive the data.

In this project, the ESP32 connects to a WiFi network and establishes communication with a public MQTT broker. The DHT22 sensor continuously measures humidity values, which are then published to the MQTT topic periodically.

The MQTT Explorer application is used to subscribe to the topic and visualize the transmitted sensor data in real time.

Workflow

  1. ESP32 connects to WiFi
  2. ESP32 connects to MQTT broker
  3. DHT22 sensor data is acquired
  4. Humidity values are published to MQTT topic
  5. MQTT Explorer receives and displays the data

Advantages of MQTT

  1. Lightweight communication protocol
  2. Low bandwidth usage
  3. Real-time data transmission
  4. Efficient for embedded IoT systems
  5. Supports cloud-based monitoring

MQTT Broker Used

A public MQTT broker is used for testing and monitoring sensor data transmission.

Real-Time Monitoring

The MQTT Explorer dashboard displays:

  1. Humidity values
  2. Device information
  3. Topic structure
  4. Timestamped telemetry data

This demonstrates successful cloud-based IoT communication using ESP32 and WiFi networking.

UART Communication

UART Communication

UART (Universal Asynchronous Receiver Transmitter) is a serial communication protocol commonly used for debugging, monitoring, and communication between embedded systems.

In this project, UART communication is used for local monitoring of temperature data acquired from the DHT22 sensor.

The ESP32 continuously sends temperature readings through the serial interface. The RealTerm serial terminal application receives and displays the transmitted data in real time.

Workflow

  1. ESP32 initializes UART communication
  2. Temperature values are read from DHT22 sensor
  3. Data is transmitted serially through UART
  4. RealTerm receives and displays the values

UART Configuration

  1. Baud Rate: 115200
  2. Data Bits: 8
  3. Stop Bits: 1
  4. Parity: None

Advantages of UART

  1. Simple serial communication protocol
  2. Useful for debugging embedded systems
  3. Real-time local monitoring
  4. Reliable point-to-point communication

Real-Time Serial Monitoring

The RealTerm terminal displays:

  1. Temperature values
  2. Continuous sensor updates
  3. Serial communication status

UART communication provides a simple and effective way to monitor embedded sensor data locally while MQTT communication handles remote cloud-based transmission.

Source Code

https://github.com/ayush4514be23-prog/STM32-IoT-Application-Development-Lab/tree/3b7e82b93c6e065e848b08f51b900bc25cdef873/evaluations/LabEval4/src

Downloads

Results

Screenshot 2026-05-21 104422.png
Screenshot 2026-05-21 104503.png

The system successfully demonstrated:

- Real-time temperature and humidity monitoring

- MQTT communication over WiFi

- UART serial transmission

- Embedded IoT telemetry

- Simultaneous cloud and local monitoring

FUTURE IMPROVEMENTS

Future improvements may include:

- Cloud dashboard integration

- Mobile app monitoring

- Sensor data logging

- Real-time alerts

- Multi-sensor expansion