DHT22 is a Temperature and Humidity Sensor. In this project we connect a DHT22 Sensor to a Raspberry Pi with Raspbian OS to measure the Temperature and Humidity. We use Python language and tkinter Library to create Graphics and use Adafruit_DHT Library to read data from DHT22.
for downloading Adafruit_Python_DHT in terminal window issue the commands:
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo python setup.py install
Code walk through:
Now that Adafruit_DHT library is installed we can import it in our code:
- On Raspberry Pi Create a directory
- download DHT22_Bar and unzip them in that folder
- On Raspberry Pi under Menu Programming select Thonny Python IDE
- from menu file open file DHT22_Bar.py
- Connect DHT22 Device to Raspberry Pi
- run the Python file
Tags: DHT22_Bar DHT22 Sensor Raspberry Pi 3 barlib Adafruit_DHT G1.PNG