Raspberry Pi Python library for DHT20 Temperature and Humidity Sensor with CRC verification.
This library was tested with the following:
- Aosong DHT20 SIP Packaged Temperature and Humidity Sensor
- Raspberry Pi 3 Model B
- Ubuntu Server 22.10, 23.04, 23.10 and 24.04 LTS
Similar configurations should also work.
-
Connect the DHT20 sensor to the Raspberry Pi
Note: If a different Raspberry Pi model and/or operating system is used, it may be necessary to change theI2C_BUSinDHT20_demo.pyand/or enable the I2C interface. -
Install smbus2 Python module that is used for accessing the I2C bus
sudo apt install python3-smbus2 -
If
/dev/i2c*does not exist, enable the i2c-dev kernel module by adding the following line to the/etc/modulesfilei2c-dev -
Test by running the demo
sudo python3 DHT20_demo.py
Refer to the usage example in DHT20_demo.py.