Connect the RF Sensor to PrivateEyePi

At this point you should have built the base station receiver and at least one sensor.  

You will be using the serial communications so you need to install the Python serial libraries. At the Raspberry Pi command prompt type:

  apt-get install python-serial

Next make sure you are on the latest PrivateEyePi software. Follow the following tutorial to install or upgrade your system: PrivateEyePi Installation

If you have not already created a PrivateEyePi account then follow this tutorial:

  Create a PrivateEyePi Username and Password

Each RF transmitter is pre-configured with a unique sensor number (DeviceID). You would have seen the ID earlier when you were testing your sensor. 

pi@raspberrypi:~/rf_tools $ python serial_mon.py 9600

Sat Oct 28 21:05:03 2017 a02STARTED--

Sat Oct 28 21:05:03 2017 a02STARTED--

Sat Oct 28 21:05:03 2017 a02STARTED--

Sat Oct 28 21:05:03 2017 a02STARTED--

Sat Oct 28 21:05:03 2017 a02STARTED--


The Device ID in the above messages is 02. You will see this ID show up in PrivateEyePi once you connect your Raspberry Pi to the server.

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

If you have a tempature sensor then wait for 5 minutes for the next reading to be sent, or if you have a wireless switch sensor then open and close the switch a few times and then log into your dashboard at www.privateeyepi.com to view the sensor reading on your dashboard.

You exit from rfsensor.py by pressing Ctrl-x.

If you want to see the messages being processed and sent to the server then quit rfsensor.py and edit globals.py and set PrintToScreen=True. Then re-launch rfsensor.py. This setting is around page 4 of the file. Below is the typical output for a temperature sensor reading being sent to the server:

pi@raspberrypi:~ $ python rfsensor.py
AWAKE----
TMPA21.75
Host Update: https://www.privateeyepi.com/alarmhostr.php?u=*************&p=*************&function=14&opcode0=21.75&opcode1=0&opcode2=02
SLEEPING-

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 join our support forum where you can get help from us and others in our community.