Setting up DHT11 on Raspberry Pi
The following tutorial is meant to setup the DHT11 humidity and temperature sensor to work on the Raspberry Pi 3

sudo apt-get update && upgrade -y Last updated
The following tutorial is meant to setup the DHT11 humidity and temperature sensor to work on the Raspberry Pi 3

sudo apt-get update && upgrade -y Last updated
sudo apt-get install python3-dev python3-pip
sudo python3 -m pip install --upgrade pip setuptools wheel
sudo pip3 install Adafruit_DHTimport Adafruit_DHT
import time
DHT_SENSOR = Adafruit_DHT.DHT11
DHT_PIN = 4
while True:
humidity, temperature = Adafruit_DHT.read(DHT_SENSOR, DHT_PIN)
if humidity is not None and temperature is not None:
print("Temp={0:0.1f}C Humidity={1:0.1f}%".format(temperature, humidity))
else:
print("Sensor failure. Check wiring.");
time.sleep(3);