Learning Objectives
By the end of this lesson, students will be able to:
-
Use Wokwi simulator to virtually prototype ESP32 projects.
-
Correctly wire a DHT22 sensor, LED, and buzzer to the ESP32.
-
Apply resistors properly in series with LED anode.
-
Set and test alert thresholds for temperature and humidity.
-
Trigger outputs (LED and buzzer) when environmental conditions are exceeded.
Key Concepts
-
Virtual Prototyping
-
Why we use simulators before real hardware (saves cost, safe for beginners, quick testing).
-
Benefits of Wokwi for IoT and Arduino learning.
-
-
DHT22 Sensor
-
What it measures: temperature and humidity.
-
Connections: VCC → 5V, GND → GND, DATA → GPIO pin (e.g., 25).
-
-
LED with Resistor
-
LED as a visual alert.
-
Wiring: GPIO pin (e.g., 32) → Resistor → LED Anode (+); LED Cathode (–) → GND.
-
Why the resistor is important (limits current, protects LED).
-
-
Buzzer as an Actuator
-
Produces sound when triggered.
-
Connections: GPIO pin (e.g., 27) → Buzzer +; Buzzer – → GND.
-
-
Programming Logic
-
Read temperature and humidity values from DHT22.
-
If humidity > 70% or temperature > 30°C → turn ON LED + buzzer.
-
Else → keep them OFF.
-
Hands-On Activity in Wokwi
-
Open https://wokwi.com.
-
Create a new ESP32 project.
-
Add DHT22, LED, resistor, and buzzer from the part library.
-
Wire components as described.
-
Copy the provided code into the editor.
-
Click ▶ Play to run the simulation.
-
Adjust sensor values in Wokwi (DHT22 properties) to test different conditions.
Code Example
Wrap-Up
-
Students can now simulate a basic smart environment monitoring system.
-
This experiment introduces the concept of sensors + actuators + logic, which is the foundation of IoT projects.
Comments
Post a Comment