An IoT-based environmental monitoring system using the ESP32 microcontroller that demonstrates bidirectional communication with the Blynk mobile app. The system reads temperature and humidity data and allows remote LED control through cloud connectivity.
Implement IoT system with ESP32 and DHT22 sensor Demonstrate READ operations from mobile app to hardware Monitor real-time environmental data through cloud platform Showcase bidirectional communication between hardware and mobile app
Hardware: ESP32 Dev Module, DHT22 Sensor, LED Software: PlatformIO, Arduino Framework IoT Platform: Blynk Cloud Services Simulation: Wokwi ESP32 Simulator Communication: WiFi, Blynk Cloud
esp32-blynk-iot-project/
โ
โโโ src/
โ โโโ main.cpp # Main application code
โโโ include/ # Header files
โโโ lib/ # Custom libraries
โโโ diagram.json # Wokwi simulation diagram
โโโ wokwi.toml # Wokwi configuration
โโโ platformio.ini # PlatformIO configuration
โโโ README.md # Project documentation
VS Code with PlatformIO extension Blynk IoT mobile app Wokwi account (for simulation)
-
Clone the Repository
git clone https://github.com/Dipta117/esp32-blynk-iot-project.git cd esp32-blynk-iot-project -
Open in PlatformIO
Launch VS Code Open the project folder PlatformIO should automatically detect the project
-
Configure Blynk Credentials Update the following in
src/main.cpp:#define BLYNK_TEMPLATE_ID "YOUR_TEMPLATE_ID" #define BLYNK_TEMPLATE_NAME "YOUR_TEMPLATE_NAME" #define BLYNK_AUTH_TOKEN "YOUR_AUTH_TOKEN"
-
Build the Project
Click the โ (Build) button in PlatformIO Or use the terminal:
pio run
-
Ensure all files are in the project root:
diagram.jsonwokwi.tomlplatformio.ini -
Build the Project
Click the โ Build button in PlatformIO
-
Start the Simulation
Press
Ctrl + Shift + PType:Wokwi: Start SimulatorPress Enter
-
Connect Components
DHT22: VCC โ 3.3V, GND โ GND, DATA โ GPIO4 LED: Anode โ GPIO23, Cathode โ GND (with resistor)
-
Upload Code
Connect ESP32 via USB Click the โ (Upload) button in PlatformIO
Android: Play Store โ โBlynk IoTโ iOS: App Store โ โBlynk IoTโ
-
Create a new Blynk account
-
Go to Templates โ Create New
-
Set the following:
Name:
ESP32 IoT MonitorHardware:ESP32Connection:Wi-Fi
| Virtual Pin | Widget | Purpose |
|---|---|---|
| V0 | Button | LED ON/OFF Control |
| V1 | Label | LED Status Display |
| V2 | Label | Temperature Display |
| V3 | Label | Humidity Display |
- Create a new device from the template
- Copy the Auth Token
- Update the token in
src/main.cpp
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
lib_deps =
blynk/Blynk@^1.3.2
adafruit/DHT sensor library
adafruit/Adafruit Unified Sensor[wokwi]
version = 1
[[parts]]
type = "esp32"
[[parts]]
type = "dht22"
connect = "D4"
[[parts]]
type = "led"
connect = "D23"V0: Button press to control LED Real-time command processing from mobile app
V2: Temperature data transmission V3: Humidity data transmission V1: LED status updates
Real-time sensor data monitoring Cloud connectivity via Blynk Error handling and data validation Non-blocking operation using timers
ESP32 programming with Arduino framework IoT cloud communication protocols Sensor integration and data processing Mobile app integration with hardware Simulation-based development
Bidirectional cloud communication Remote device control Real-time data monitoring Wireless sensor networks
๐ SUCCESS: Connected to Blynk Server!
๐ฑ READ from App: Button V0 - ON | LED: ๐ด ON
๐ค WRITE to App: Temp: 26.5ยฐC | Hum: 45.2%
๐ฑ READ from App: Button V0 - OFF | LED: โช OFF
Real-time temperature and humidity LED control button with status System status indicators
-
Device Offline in Blynk
Check WiFi credentials Verify Auth Token Ensure correct Blynk server configuration
-
Build Errors
Clean project:
pio run --target clean
Check library dependencies in
platformio.ini -
Sensor Read Failures
Verify DHT22 connections Check sensor initialization
Wokwi uses simulated sensor values (e.g., 79.9 ยฐC, 40.0 %) Real hardware shows actual environmental data LED behavior is accurately simulated
[ ] Add multiple sensor support [ ] Implement data logging [ ] Add web dashboard [ ] Include alert notifications [ ] Support multiple ESP32 devices
-
Fork the repository
-
Create feature branch:
git checkout -b feature/new-feature
-
Commit changes:
git commit -am "Add new feature" -
Push to branch:
git push origin feature/new-feature
-
Submit a pull request
Blynk IoT Platform for cloud services Wokwi for ESP32 simulation environment PlatformIO for development tools Arduino Community for libraries and support
Developed for IoT Education and Demonstration Perfect for academic projects and IoT learning ๐
For questions or support, please open an issue in the repository.