Home‎ > ‎Home Alarm System project‎ > ‎

Wireless Temperature Sensor Project

This project is out-dated has been re-written. Please use the following link which has the latest information.

For a list of all our wireless projects, please refer this page:

Project Description

In this project I will show you how to connect a remote battery operated temperature sensor to your Raspberry Pi. The remote sensor communicates with the raspberry pi over radio frequency (RF) communications to a base station RF receiver. You can connect as many remote transmitters as you like (e.g. inside, outside, fridge, etc…). RF communications can be a complex subject, but I have eliminated all the complexity by using pre-programmed devices that have the RF communication libraries already loaded. The components are plug and play ready to use. 

What you need

All parts can be purchased from the PrivateEyePi Store

  • 1 x Base station RF receiver
  • 1 or many Remote temperature transmitter
  • 1 x  10K Precision Thermistor (NTCLE100E3103JB0)
  • 1 x 10k resistor
  • 2 x AA batteries
  • 1 X Model A or B Raspberry Pi, power supply, HD card, screen, keyboard, network etc… Raspbian Wheezy OS


  • 1 x Base station kit. This is a breakout board for the Raspberry Pi that also has a convenient slot for the RF sensor.
  • 1 x Remote sensor kit. This is a really nice kit that contains the PCB, coin cell battery battery and casing and plug in slot for the temperature sensor.

The above two optional parts, which are pictured above are not mandatory but make your end product much more professional looking.

If you choose not to use the optional extras you may want to consider using a 2mm 10 pin header to plug into the RF sensors in order to avoid having to solder wires directly to the RF sensors.

How it works

The remote temperature transmitter will transmit the temperature at 5 minute intervals to the base station. The transmitter is optimized for extremely low current consumption so that it is able to last over a year on a single set of AA batteries. The receiving RF unit operates on the power of the Raspberry Pi and interfaces to the Raspberry Pi using serial communications. You do not need to know anything about RF communications or serial communications in order to do this project.  The RF units are very powerful and should easily handle communications distances around a residential home. The antennae of the transmitter can be adjusted for longer distances, or for greater strength to compensation for walls or other physical barriers. The transmitter comes preconfigured with a unique number identifier that will be used to associate the sensor with a location defined in the PrivateEyePi system. This enables you to have as many remote temperature sensors as you want (e.g. inside, outside, fridge etc… ). The Python code required to read the temperatures from the serial communications stream is provided. We also provide the code to send the temperature value to the PrivateEyePi server to be displayed on your WWW dashboard; however this is not a mandatory part of this project. If you want a remote temperature sensor for other projects then these steps will help you achieve that goal too.


As shown in figures 1 and 2 there are two electronic circuits that need to be built, one for the transmitter and one for the receiver. Build both circuits according to the diagrams and then proceed to the software section. The RF Receiver and Transmitter look identical to each other so be careful not to mix them up. When delivered, the packaging will clearly distinguish between the two devices. If you do accidentally mix them up you won’t damage a receiver by wiring it like the transmitter, or vice versa. Just swap them around until they work. 

Figure 1 - Wireless Base Station Receiver

Figure 2 - Wireless Temperature Sensor


Now that you have your electronics built we can work on the software. Boot up your Raspberry Pi and navigate to the home directory from the command prompt. Download the rftherm.zip software by typing the following commends:

At the command prompt type:


cd /home

sudo wget -N www.privateeyepi.com/downloads/rftherm.zip

unzip -o rftherm.zip

The unzip command will look something like figure 3 where the three source code files are uncompressed and copied into the /home directory.

Figure 3 - Unzip the three source code files

As per Figure 4 edit the globals.py file in order to enter your user and password. The user is the email address you use to login to www.privateeyepi.com.


 sudo nano globals.py

Figure 4 - Enter your user (email address) and password

To save type CTRL-X, followed by Y and then ENTER.

Each RF transmitter is pre-configured with a unique sensor number. You can use this number to associate the temperature reading with the sensor. The next step is to configure the PrivateEyePi dashboard with the sensor numbers and link them to a location so they can be displayed correctly. Follow figures 5 and 6 in order to complete this configuration.

Go to www.privateeyepi.com, log in or if you are a new user click "new user" and enter your details. Click on GPIO and add a new sensor as per Figure 5.

Figure 5 - Configure the new sensor using the unique number provided with the sensor

Click Update and select Location and enter the location of the sensor as per Figure 6.

Figure 6 - Configure the Location details of the sensor

Click Update and link the temperature sensor to the relevant zone(s). If you have not defined a zone yet then click on Zone and enter the Zone details, then Zonelink and link the sensor to a zone. A sensor can be linked to multiple zones.

Click on Dashboard (top right hand corner) and you will see your dashboard which should now contain a gauge for your new temperature sensor. The sensor will not show a value yet because we have not started sensing the temperature from the Rpi to the server. You will do those steps next.

Configure Serial Port on the RaspberryPi

Next we need to configure the serial port on the Raspberry Pi to be able to receive communications through the UART GPIO pins.

First make a backup of the files we will be editing in case you make a mistake or you want to revert back to the original files.

At the command prompt type:


sudo cp /boot/cmdline.txt  /boot/cmdline.bak

sudo cp /etc/inittab  /etc/inittab.bak

Edit the cmdline.txt file and remove references to “ttyAMA0”

sudo nano /boot/cmdLine.txt

Then look for the following and remove it:

console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 

Exit and save – CTRL x, y, ENTER

Next you need to edit inittab:

sudo nano /etc/inittab

Look for and delete the following line:

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Exit and save – CTRL x, y, ENTER

Now you are ready to test the unit. We included a test program called rfthermtest.py that will read the incoming temperature values. Make sure that the temperature transmitter and the base station are correctly wired and powered. Run the rfthermtest.py and wait for at least 5 minutes for the first temperature reading to come through.

If you have never run a Python program that uses the GPIO pins on your Raspberry pi you first need to install the GPIO library for Python.

You will be using the serial communications so you need to install the Python serial libraries:


apt-get install python-serial

At the command prompt type:

cd /home

sudo python rfthermtest.py

After a maximum of 5 minutes you should see temperature reading along with the unique identifier of the sensor displayed on the screen.

You are now ready to run the rfsensor.py program that will populate your dashboard which can be viewed on-line.

At the command prompt type:


cd /home

sudo python rfsensor.py

Wait for 5 minutes then log into your dashboard at www.privateeyepi.com to view the temperature readings.

Now that your remote temperature sensor(s) are up and running you will want to automate the rfsensor.py program so that is runs as a background process and restarts every time you reboot your Raspberry Pi. Follow this tutorial in order to achieve that.

I hope you have enjoyed this project. For support email support@privateeyepi.com or join the blog on the home page and post questions there.