Connect a DHT11 Temperature/Humidity sensor to a Raspberry Pi

At GCITS we’re getting familiar with the Internet of Things (IoT). To start with, we’re connecting sensors to the cloud to make use of the real time data.

As a quick test, we want to connect a temperature sensor in our office to our dashboard in Power BI. The first step is to get a reading from the temperature sensor via the Raspberry Pi.

I had a bit of trouble getting this working using the some of the suggested wiring diagrams (it may just be an issue with my breadboard) so I’m posting this here in case it helps someone else.

You will need:

  • Raspberry Pi running Raspbian
  • A Breadboard
  • Assorted wires
  • 10k ohm resistor
  • DHT11 Temperature/Humidity Sensor

Wire it all up

First step is to wire up your Raspberry Pi to the DHT11 temperature sensor.

Here’s a drawing of my wiring, as well as two photos that should make it clear.

Set up your Raspberry Pi

Once you’re all set, you’ll need to install a library to easily pull data from the sensor. I’m getting started with Python, so I’m using the Python library provided by Adafruit. I found some great instructions in this PDF: https://learn.adafruit.com/downloads/pdf/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging.pdf

I’ll summarise it here:

Open the terminal on your Raspberry Pi and run the following commands:

git clone https://github.com/adafruit/Adafruit_Python_DHT.git
cd Adafruit_Python_DHT

This will clone the Adafruit Python Library to your Pi

To make sure you have the correct dependencies to use the library, you’ll also need to run these commands:

sudo apt-get update
sudo apt-get install build-essential python-dev python-openssl

Next you’ll need to install the library we cloned earlier:

sudo python setup.py install

To confirm that you’ve successfully installed the library, test the sensor by navigating to the Examples folder and running the test python script:

cd examples
sudo ./AdafruitDHT.py 11 4

This tests pin GPIO 4 for the DHT11 sensor and returns the temperature and humidity values.
 

 

As you can see, the result seems to be pretty accurate.

The parameters at the end can be modified to suit your setup. If you’re using the DHT22 sensor, replace 11 with 22 , or if you’re using another GPIO pin, substitute 4 for the appropriate GPIO pin number.

For example, sudo ./AdafruitDHT.py 22 17 refers to a DHT22 on GPIO17

Stay tuned for future posts on how we’ll connect this data to the cloud and Power BI!

IoT project: wiring diagram
IoT project: Raspberry Pi wiring
IoT project: wiring on a breadboard
Temperature and humidity sensor data visualisation
Temperature and humidity sensor data visualisation

Related posts

Callers cheering and blowing bubbles in the Animal Welfare League Queensland Giving Day call room, with the fundraising tally and the GCIT logo on the projector behind them
BLOG

Our Team on the Phones for Animal Welfare League Queensland’s First Giving Day

We built a pop-up call centre for Animal Welfare League Queensland's first Giving Day on 17 September 2026, then spent the day on the phones beside its staff and volunteers.
Harry Morris, Elliot Munro, Leon Rebello MP, James Munro, Ryan Colombo and Grace Teu from GCIT with the 2026 McPherson Honours Small Business of the Year trophy
BLOG

GCIT Wins Small Business of the Year at the 2026 McPherson Honours

GCIT was named Small Business of the Year at the 2026 McPherson Honours, hosted by Leon Rebello MP. Here is what the Honours are and the community work behind our nomination.
GCIT team at work in the Burleigh Heads office, with the GCIT logo and the Claude Partner Network Certified Services Partner badge
BLOG

GCIT Is Now Certified in the Claude Partner Network

GCIT is now Certified in the Claude Partner Network. Here is how our team trained on Claude, how we use it in our own business, and how gcOS turns AI into measured results.
Ready to secure and simplify your IT? Talk to a GCIT expert today.