markdown Copy code
This project demonstrates how to use the DHT11 temperature and humidity sensor with an Arduino. The sensor readings (temperature in Celsius and humidity in percentage) are printed to the serial monitor.
-
Hardware:
- Arduino board (e.g., Arduino Uno)
- DHT11 temperature and humidity sensor
- Connecting wires
-
Software:
- Arduino IDE
- DHT library for Arduino
-
Set Up the Hardware:
- Connect the DHT11 sensor to the Arduino:
- VCC to 5V
- GND to GND
- Data pin to digital pin 0 (can be changed if needed)
- Connect the DHT11 sensor to the Arduino:
-
Install the DHT Library:
- Open the Arduino IDE.
- Go to Sketch > Include Library > Manage Libraries.
- Search for "DHT" and install the library by Adafruit.
-
Upload the Code:
- Copy the provided code into the Arduino IDE.
- Select the appropriate board and port from the Tools menu.
- Click the Upload button.
-
Open the Serial Monitor:
- After uploading the code, open the Serial Monitor from the Arduino IDE (Tools > Serial Monitor).
- Set the baud rate to 9600.
-
View the Output:
- The Serial Monitor will display the current temperature and humidity readings from the DHT11 sensor.