Practical 4 - ESP32 DHT Ultrasonic
Practical 4 - ESP32 DHT Ultrasonic
Practical 4
Extend the NodeMCU ESP32 embedded system to read analog input and write analog output.
Objective
Understand how to use NodeMCU ESP32 for setting up a simple IOT solution with Digital
Humidity & Temperature sensor and ultrasonic sensor.
Background
Operating Voltage: 5V DC
Operating Current: 15mA
Measure Angle: 15°
Ranging Distance: 2cm - 4m
Procedure
Step 2: Connect one LED with resistors and one push button on NodeMCU ESP32 pins
- Use 1 Blue LED and 1kΩ registers and connect them to the Pin D25. Negative (-ve) pin
of the LED connects to the common GND.
- Use 1 White LED and 1kΩ registers and connect them to the Pin D5. Negative (-ve) pin
of the LED connects to the common GND.
- Use 1 push button and connect it to the Pin D4. Connect the other pin of the push button
to the common GND.
- Connect the GND to NodeMCU ESP32 GND pin.
Step 3: Connect one DHT sensor module, one active piezo buzzer module, one gas
sensor MQ-2 and one ultrasonic module on NodeMCU ESP32 pins
- Use 1 DHT sensor module and connect it to the Pin D21. The Vcc (+) pin of the DHT
sensor module connects to the common 5v and the GND (-ve) pin of the DHT sensor
module connects to the common GND.
* Wrong connected GND and Vcc will cause the DHT sensor to overheat and melt.
- Use 1 ultrasonic module and connect the TRIG pin to the D23; ECHO pin to the D22.
The Vcc (+) pin of the ultrasonic module connects to the common 5v and the GND (-ve)
pin of the ultrasonic module connects to the common GND.
- Connect the common +ve lines (red) lines to the Raspberry Pi PIN1 3.3V.
- Connect the common -ve GND (blue) lines to the NodeMCU ESP32 GND pin, and to the
Raspberry Pi PIN9 GND pin
BAIT2123 INTERNET OF THINGS Jul 2024
- .
- readDHT
Step 7: Upload the compiled code to NodeMCU ESP32 Module and observe the result.
- Click Sketch > Verify / Compile and Sketch > Upload to compile this modified code and
upload to the NodeMCU ESP32 module.
- Check if all sensors values are sent to the Serial Monitor display
- Check if the Buzzer at PIN26 is responding to the push button or not.