RAJESH SINHA
Published © CERN-OHL2

Temperature (DHT22) monitoring using Raspberry Pi

In this project, we are going to construct a temperature monitoring system using DHT22.

IntermediateFull instructions provided5 hours365
Temperature (DHT22) monitoring using Raspberry Pi

Things used in this project

Story

Read more

Schematics

ras_with_dh22_v5UZyUrLvS.png

Code

Installation of dht library

Python
This is the command installation of dht library in raspberry pi.
git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT
sudo apt-get update
sudo apt-get install build-essential python-dev
sudo python setup.py install

Code for DHT

Python
#Libraries
import Adafruit_DHT as dht
from time import sleep
#Set DATA pin
DHT = 4
while True:
    #Read Temp and Hum from DHT22
    h,t = dht.read_retry(dht.DHT22, DHT)
    #Print Temperature and Humidity on Shell window
    print('Temp={0:0.1f}*C  Humidity={1:0.1f}%'.format(t,h))
    sleep(5) #Wait 5 seconds and read again

Credits

RAJESH SINHA

RAJESH SINHA

14 projects • 8 followers
Hey there! I'm Rajesh. I'm passionate about building innovative projects that solve real-world problems and make people's lives easier.

Comments