How to use a Grove Temperature and Humidity Sensor Pro with a Raspberry Pi

In my previous post, I have explained how to mount a Grove Base Hat onto your Raspberry Pi and install the Seeed Studio provided grove.py software. In this post, I’m going to show you how to use a Grove Temperature and Humidity Sensor Pro with your Raspberry Pi.

Connecting the Grove Temperature and Humidity Sensor Pro with the Grove Base Hat for Raspberry Pi

Connecting the sensor with the base hat is straight forward.

Gove Temperature & Humidity Sensor Pro
Gove Temperature & Humidity Sensor Pro
Grove Temperature & Humidity Sensor Pro with connecting cable

First, put the cable into the sensor. There is only one way the cable fits, you will see two guiding tracks on one side of the cable that you have to fit into the socket accordingly.

Grove Temperature & Humidity Sensor socket and cable socket
Grove Temperature & Humidity Sensor Pro with cable attached

On the Grove Base Hat, you have to attach the cable into the PWM socket, which is the top left one in the picture below. Just like the sensor, the cable only fits one way into the socket, watch out for the guiding tracks.

Grove Base Hat
Grove Base hat with Grove Temperature & Humidity Sensor Pro cable attached
Grove Base hat with Grove Temperature & Humidity Sensor Pro cable attached
Grove Base Hat with Grove Temperature & Humidity Sensor Pro attached

Reading the temperature and humidity from the sensor

Once the sensor is connected and the Raspberry Pi is powered up, you can reach your sensor on pin 12 (marked asPWM on the Grove Base Hat). However, before you can read the sensor, you will have to install one additional Python package called seeed-python-dht. You can install it with the following command: pip3 install seeed-python-dht

pi@gvenzl-raspberrypi-1:~ $ pip3 install seeed-python-dht
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting seeed-python-dht
Downloading https://www.piwheels.org/simple/seeed-python-dht/seeed_python_dht-0.0.2-py3-none-any.whl
Installing collected packages: seeed-python-dht
Successfully installed seeed-python-dht-0.0.2

Once the package is installed, import it into your Python script, instantiate a new DHT object for sensor type DHT22 and pin 12, and read the sensor reading via the .read() method:

The result will look like this:

pi@gvenzl-raspberrypi-1:~ $ ./Grove_Temperature_Humidity_Sensor_Pro.py
DHT22, humidity 42.2%, temperature 23.0C
DHT22, humidity 42.2%, temperature 23.0C
DHT22, humidity 42.1%, temperature 23.0C
DHT22, humidity 42.2%, temperature 23.0C
DHT22, humidity 42.1%, temperature 23.0C
DHT22, humidity 42.2%, temperature 23.0C
^CExiting program.

Notice: Unfortunately the Temperature and Humidity Sensor Pro doesn’t seem to be very reliable over a longer period of time. After a while, the sensor, or the provided Python library, it is still to be determined, stops reporting new readings and continues to report the last successful one. The only way that I have currently found to remedy the issue is by unplugging and plugging the sensor into the base hat again. I’m in contact with Seeed Studio Support on the matter and will update this post once we get to the root cause.

If you want to get your own Grove Temperature and Humidity Sensor Pro you can buy it here from Seeed Studio.

Author: Gerald

Developer, Oracle expert, performance enthusiast and genuine technology geek.

One thought on “How to use a Grove Temperature and Humidity Sensor Pro with a Raspberry Pi”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.