Skip to content

Cpd879/Temperature-Interfacing-With-ESP32

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Temperature-Interfacing-With-ESP32

Temperature Interfacing With ESP32

DHT22 Interfacing with ESP32

This Arduino C code is designed to interface with the DHT22 sensor and an ESP32 microcontroller. It reads temperature and humidity values from the DHT22 sensor and prints them to the Serial Monitor.

Requirements

Wiring Instructions

Connect the DHT22 sensor to the ESP32 as follows:

  • Connect the positive (VCC) pin of the DHT22 to the 3.3V pin on the ESP32.
  • Connect the negative (GND) pin of the DHT22 to the GND pin on the ESP32.
  • Connect the data pin of the DHT22 to pin 2 on the ESP32.

Installation

  1. Open the Arduino IDE.
  2. Install the ESP32 board support by following these instructions.
  3. Install the DHT Sensor Library by going to "Sketch" -> "Include Library" -> "Manage Libraries..." and then searching for "DHT".

Upload the Code

  1. Connect the ESP32 to your computer using a USB cable.
  2. Select the correct board and port in the Arduino IDE.
  3. Upload the code to the ESP32.

Serial Monitor

  1. Open the Serial Monitor in the Arduino IDE.
  2. Set the baud rate to 115200.
  3. Observe the temperature and humidity values printed every 2 seconds.

Code Explanation

  • The code initializes the DHT22 sensor and the serial communication.
  • In the loop, it reads temperature and humidity values every 2 seconds.
  • If the readings are valid, it prints them to the Serial Monitor.
  • If readings are invalid, it prints an error message.

Feel free to customize the code according to your specific requirements.

About

Temperature Interfacing With ESP32

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages