Skip to main content

Python library for Grove - Temperature&Humidity Sensor Pro

Project description

Seeed DHT

This is a powerful sister version of our Grove - Temperature&Humidity Sensor Pro. It has more complete and accurate performance than the basic version. The detecting range of this sensor is 5% RH - 99% RH, and -40°C - 80°C. And its accuracy reaches up to 2% RH and 0.5°C. A professional choice for applications that have relatively strict requirements.

This code is for


This driver depends on:

This is easy to install with the following command.

curl -sL | sudo bash -s -

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install seeed-python-dht

To install system-wide (this may be required in some cases):

sudo pip3 install seeed-python-dht

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install seeed-python-dht

Usage Notes

First, Check the corresponding gpio number of the board:

pi@raspberrypi:~/Seeed_Python_DHT $ grove_gpio
Hat Name = 'Grove Base Hat RPi'
<pin> could be one of below values in the pin column for GPIO function
   And connect the device to corresponding slot
 pin | slot
  5  | D5   
 12  | PWM  
 16  | D16  
 18  | D18  
 22  | D22  
 24  | D24  
 26  | D26 

Next, initialize the sersor object:

import seeed_dht
# for DHT11 the type is '11', for DHT22 the type is '22'
sensor = seeed_dht.DHT("11", 12)

Reading from the Sensor

To read from the sensor:

humi, temp =
print('DHT{0}, humidity {1:.1f}%, temperature {2:.1f}*'.format(sensor.dht_type, humi, temp))


If you have any good suggestions or comments, you can send issues or PR us.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seeed-python-dht-0.0.2.tar.gz (4.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page