Measure Temperature and Humidity with a DHT11 Sensor
- Raspberry PI 3 running Raspbian
- 1 - DHT11 Temperature Humidity Sensor
- 2 - male - male short jumpers
- 3 - male - female long jumpers
A graphical representation of the Temperature and Humidity Sensor Circuit.
- Insert a male - female long jumper in the hot (red) column
- Insert a male - female long jumber in the ground (blue) column
- Insert the Obstacle Avoidance Sensor into rows 15 (GND) through row 17 (VCC)
- Refer to the wiring image for module orientation
- Insert a male - male (short) jumper into the ground (blue) column and row 15 (GND)
- Insert a male - male (short) jumper into the hot (red) column and row 17 (VCC)
- Insert a male - female (long) jumper into row 16 (DATA)
- Power down your Raspberry PI
- Open a terminal window and type
sudo halt - Unplug the Raspberry PI
- Open a terminal window and type
- Connect the hot female connector to Pin 2 (+5v)
- Connect the ground female connector to Pin 6 (Ground)
- Connect the female jumper from row 16 (S) to Pin 7 (GPIO 04 (GPIO_GCLK))
- Verify your wiring! Mis-wiring will destroy the sensor!
- Boot your Raspberry PI
- Open a terminal window
- Execute ...
- dht11.py
Note: You may need to compile the program.
Can you modify the included code to change its behavior?
- Change a while loop to a for loop
- Change how temperature and humidity is reported
Challenge: Can you get the program to report in Fahrenheit?
