Temperature Sensor and Raspberry PI

So I was playing around with my PI and Temperature sensor, mainly because I spent a considerable amount of time watching one my dear friends (*Lewis Greyson*) attempting to get a Phidget USB device and a temperature sensor working. This was a much bigger project about monitoring temperatures inside homes.  Anyway I wanted to see how easy it would be to get a temperature sensor working through the GPIO alone.

For this task I brought a DHT11 (Link) sensor, which was around £1. It is also recommended to use a 4.7 – 10k resister between the data pin and VCC pin to avoid burning out your PI, I proceeded to connected it by connecting the VCC to pin 2 and GND to pin 6 then connected the data pin from the sensor to pin 7 (GPIO 4).

2013-03-28 01.06.46

After doing this I downloaded the drivers from Adafruit using the following commands in my home directory (instructions are from here):

apt-get install git

git clone git://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git

cd Adafruit-Raspberry-Pi-Python-Code

cd Adafruit_DHT_Driver

Then ran the sensor with:
sudo ./Adafruit_DHT 11 4
At this point I have a reading:

temp sensor

As you can see it is considerably easy to connect the sensor to the PI and the cost is much lower then using a Phidget device. Not to mention that is saves a USB port and days messing around with power problems. Total time to get this working was around 5 minutes.

Hope it helps someone!

Leave a Reply

Your email address will not be published. Required fields are marked *