DHT11 (Raspberry Pi)

by piddlerintheroot in Circuits > Raspberry Pi

16102 Views, 17 Favorites, 0 Comments

DHT11 (Raspberry Pi)

websitte.png

How to setup a DHT11 sensor to read Temperature and Relative Humidity on the Raspberry Pi.

Parts

vlcsnap-1895-11-10-20h54m15s318.png

PARTS:

RPI 3 - https://amzn.to/2VA9pQY

4 Amp Power Adapter - https://amzn.to/2CTptWu

16GB micro SD - https://amzn.to/2SFMwd3

120 pcs jumper cable: https://ebay.to/2VAb9cY

DHT11 Sensors- https://amzn.to/2RzojYB

CODE

vlcsnap-6708-01-23-05h30m02s903.png

1. SSH into Pi

2. Type "git clone https://github.com/szazo/DHT11_Python.git"

3. cd DHT11_Python

4. sudo nano dht11_example.py

5. edit line 13 and change to "pin=17"

6. add new line 19 and type " print("Temperature: %d F" % ((result.temperature * 9/5) +32)) "

7. save file and run python file

Optional Walkthrough

vlcsnap-7901-09-28-08h26m02s417.png