Integrating ESP32 with DHT22 and Node-RED

Oct 16, 2024

IoT Frontier: ESP32 Integration with DHT22 and Node-RED

Introduction

  • Host: Hariharna
  • Topic: Simulating ESP32 integration with DHT22 using WalkPay
  • Objective: Send temperature and humidity to Node-RED dashboard via MQTT
  • Reminder to like and subscribe

Previous Video

  • Overview of sending temperature/humidity using ESP8266 with DHT11 sensor
  • Link to previous video provided

Wokwi.com Overview

  • Wokwi: Simulator tool for IoT projects without hardware
  • Simulation Setup:
    • Select ESP32 board from Wokwi
    • Use starter template for setup
    • Adding components: DHT22 sensor
  • Wiring connections:
    • VCC to 3V
    • SDA to GPIO 2
    • Ground to GND

Code Setup

Libraries Needed

  • Wi-Fi library
  • PubSub MQTT library
  • DHT sensor library

Code Explanation

  • Initialization of libraries and variables for temperature/humidity
  • Connection to Wi-Fi using SSID and password
  • MQTT broker connection: Broker URL - broker.hivemq.com
  • Reconnection logic for MQTT
  • Pin setup for DHT22 and built-in LED
  • Reading temperature and humidity using DHT library

Publishing Data

  • Data published to topics:
    • IoT Frontier/temperature
    • IoT Frontier/humidity

GitHub and Simulation

  • Code available on GitHub for reference
  • Steps to compile and start simulation on Wokwi

Node-RED Setup

Installation

  • Launch Node-RED via PowerShell
  • Configuration of MQTT nodes:
    • Set server and topic for subscription
    • Use QoS settings

Dashboard Configuration

  • Installation of Node-RED dashboard library
  • Adding gauge and chart nodes for temperature and humidity
  • Deployment of the dashboard

Simulation Execution

  • Start simulation in Wokwi to publish data
  • Live monitoring of data in Node-RED debug window
  • Dashboard view for real-time updates

Conclusion

  • Recap of the entire simulation process
  • Interactive demonstration of changing values on the dashboard

Closing Remarks

  • Request for comments on future tutorials
  • Reminder to like and subscribe
  • Thank you for watching!