Today we will use DHT11 or DHT22 for measuring temperature & humidity using Raspberry Pi.
This sensor have three parts,
- capacitive humidity sensor,
- thermistor
- basic chip that does some analog to digital conversion and spits out a digital signal with the temperature and humidity. The digital signal is fairly easy to read using any microcontroller.
Difference between both sensors
DHT11 | DHT22 |
Ultra low cost (Around 0.8 USD) | Low cost (Around 2.5 USD) |
3 to 5V power and I/O | 3 to 5V power and I/O |
2.5mA max current use during conversion (while requesting data) | 2.5mA max current use during conversion (while requesting data) |
20-80% humidity readings with 5% accuracy | 0-100% humidity readings with 2-5% accuracy |
0-50°C temperature readings ±2°C accuracy | -40 to 125°C temperature readings ±0.5°C accuracy |
No more than 1 Hz sampling rate (once every second) | No more than 0.5 Hz sampling rate (once every 2 seconds) |
Note: Sensor grabs reading every 2 seconds. Most of location 2 seconds delay sampling is sufficient, and comes with protective cover. For more accuracy may try with SHT75 sensor.
Hardware components:
Raspberry Pi × 1
DHT22 Temperature Sensor × 1
Breadboard (generic) × 1
10kΩ Resistor × 1
Male/Female Jumper Wires× 3