Tested on:Raspberry Pi 2; Raspberry Pi B+; Python 2.7; Python 3; Raspbian pre Jessie
Prerequisites:Raspberry Pi with Raspbian Jessie and internet connection (see steps 1-7 in the Introduction)
Hardware:10k ohm resistor
DHT22/AM.2302 sensor
Jumper cables and soldering equipment
2

Measure temperature and humidity with the sensor DHT22/AM2302

DHT.AM2302 is a sensor to measure temperature and humidity and Adafruit has implemented a Raspberry Pi driver for the sensor, thanks for that!

Breadboard circuit
The circuit is very simple. Just attach the leftmost sensor pin to the Pin 1 for 3.3V VCC, the second leftmost sensor pin to Pin 15 for data transmission and the rightmost sensor pin to a ground pin like Pin 20 of the Raspberry Pi (all in Board numbering):

Breadboard circuit for DHT22/Am2302

Breadboard circuit for DHT22/Am2302

The assembled DHT22/AM.2302 sensor

The assembled DHT22/AM2302 temperature and humidity sensor

The assembled circruit: temperature and humidity sensor dht22/AM2302

Install sensor drivers
Type in the terminal

Test the installation in python
Open python with sudo python and enter

If everything is fine, this outputs the current temperature and humidity with the first value being the humidity.

Update: Python 3
Execute the following commands for the Python3-version of the Adafruit driver:

Links
Adafruit Industries: https://www.adafruit.com

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.

2 Comments

  1. Thanks for porting the Adafruit DHT driver to python 3! Thank you! Thank you! Thank you!

Comment

Time limit is exhausted. Please reload CAPTCHA.