Note: There is a newer tutorial that replaces this one that supports multiple temperature sensors.
This tutorial will guide you through the process of building a digital temperature gauge with your Raspberry Pi that can be viewed on the WWW or your smart phone.
For support, queries or suggestions please email firstname.lastname@example.org or leave comments in our blog.
Step 1: Build and test the Electronics:
Once built, follow the following steps to test that it is working:
Log in to your Raspberry Pi
At the prompt pi@raspberrypi / $
sudo modprobe w1-gpio
sudo modprobe w1-therm
You will see a listing of the current directory. There should be a directory that is the serial number of your temperature gauge. The serial number of my thermometer 28-0000040be5b6, but every one will be unique. Make a note of yours as you will need it later in step 4.
If you don't see a directory with lots of numbers and letters like the one above then:
If you do see the directory then type cd followed by the directory name:
You will now see a dump of the w1_slave file that contains the temperature data in celcius. 20812 is 20.812 degrees celcius. The dashboard does support a Fahrenheit setting that we will cover later if that is your preference.
Step 2: Register user and password
If you have not yet registered a user and password with PrivateEyePi follow the following steps, otherwise proceed to Step 3. Note this is a completely free service and has no trial period.
Step 3: Configure GPIO 4
This configuration tells the system that you have connected a temperature gauge to GPIO 4 and to display it on your dashboard.
Step 4: Download version 2 of alarm.py
sudo wget www.privateeyepi.com/downloads/alarm.py
Step 4: Configure the alarm.py
sudo nano alarm.py
Make sure that the version at the top of the program is version 2
Page down and enter your user, password, and SMTP details. The SMTP details are not relevant for the temperature gauge, but if you have email alerts configured for the alarm system project then you need to enter the SMTP details here.
Lastly configure the temperature gauge directory you made note of in step 1 above. So in the diagram below you would replace "28-0000040be5b6" with the serial number of your temperature gauge.
If you want your temperature to be display in Fahrenheit instead of Celsius then find the following line:
#Indicator to record temperature in Farenheit
And change Farenheit=True
Then press Y to save the file
Step 5: Run alarm.py program
sudo python alarm.py
If you are getting errors or problems see here for diagnostic steps.
Step 6: View your dashboard