This repository contains code for an Arduino project that reads ambient temperature and humidity using a DHT22 sensor and displays the data on an LCD screen. This project is perfect for beginners learning about sensors, displays, and microcontroller programming.
- Reads temperature (°C/°F) and humidity (%) using the DHT22 sensor.
- Displays the readings on a 16x2 LCD screen with real-time updates.
- Easy-to-follow wiring and setup instructions.
-
DHT22 Sensor
Measures ambient temperature and humidity. -
16x2 LCD Display
Displays the temperature and humidity readings. Uses the I2C backpack for easy connection. -
Arduino Board
Compatible with boards like Arduino Uno, Nano, or Mega. -
Miscellaneous:
- Breadboard
- Jumper wires
- Resistors (if needed)
Connect the components as shown below:
Component | Arduino Pin |
---|---|
DHT22 Data Pin | D2 |
LCD SDA | A4 |
LCD SCL | A5 |
Power (VCC/GND) | 5V/GND |
Note: Pins for SDA and SCL may vary based on your Arduino board.
-
Adafruit DHT Library
For reading data from the DHT22 sensor. -
LiquidCrystal_I2C Library
For controlling the LCD display via I2C.
-
Clone this repository:
https://github.com/Kirroslink/simple-weather-checker/blob/main/Code%20file
-
Install the required libraries via Arduino IDE:
- Open Library Manager (
Sketch > Include Library > Manage Libraries...
). - Search for "DHT" and install the Adafruit DHT sensor library.
- Search for "LiquidCrystal I2C" and install the library.
- Open Library Manager (
-
Open the
dht22_lcd.ino
file in the Arduino IDE.
- Wire the components as described in the circuit diagram.
- Upload the code to your Arduino board.
- Open the Serial Monitor (optional) to see real-time temperature and humidity readings.
- The LCD screen will display the following:
Temp: 25.3°C Humidity: 60.5%
- Modify the code to:
- Switch between Celsius and Fahrenheit.
- Add alerts for specific temperature or humidity thresholds.
- Use a different display or sensor as needed.
-
If the LCD doesn't display anything, ensure:
- The I2C address in the code matches your LCD's address (default:
0x27
). - The SDA/SCL pins are correctly connected.
- The I2C address in the code matches your LCD's address (default:
-
If the sensor readings are incorrect, check:
- The wiring and power supply to the DHT22.
- Sensor compatibility with the library version.
Feel free to fork this repository, make improvements, and submit pull requests! Any contributions are welcome.
This project is licensed under the GNU General Public License. See LICENSE
for details.
Happy coding! 😊