Remote control of Raspberry Pi camera using LRPS easyRadios

The electronics package that will be used for my Weather Balloon project is now complete. It consists of a Raspberry Pi Model B+, fitted with a Real Time Clock module and a camera. Power is supplied by a USB power ‘brick’ that provides 5 volts at 2 amps and should do that for 6 to 8 hours. An EA900TRS radio, a WiFi dongle, an 8gb USB memory stick and a GPS consisting of a USB FTDI board connected to a logic level converter then to a Ublox NEO6 GPS.

The total current consumption is about 450ma rising to about 750ma when the camera operates. The total weight is under 400gms and it will be packaged in a container constructed from foam board.

A python program reads the Serial Data stream from the EA900TRS radio. This consists of commands from the ground that can take single images, timelapse video and video files. The location and height can also be sent back to the ground from the balloon.

On the ground a laptop fitted with another EA900TRS radio runs a control programme written in Visual Basic.

This control programme allows the following:

Taking single pictures, Timelapse video and Videos. The interval and runtime for timelapse videos and runtime for videos can be altered from drop down lists.

GPS data showing location and height can be requested and it is a simple matter to input the latitude and longitude readings into Google Earth to show the location of the balloon.

A number of diagnostic data can be sent back from the balloon, the temperature of the EA900TRS, signal strength at the balloon and data from the radio on the PC, temperature, baud rate, channel number, Tx power output and signal strength.

A countdown timer is useful for determining if contact with the balloon has been lost. The balloon sends a response back to the ground when the requested action has been completed. If the signal is lost this response will not be received and the control panel will ‘lock up’ waiting for a signal that will never come. To get around this a BREAK button is provided, pressing this will stop the console looking for a response from the balloon.

A Sync button resets both the ground unit and the balloon to ensure the variables on both units match, this is used after contact has been lost, then regained. A ‘Find Me’ button can be used to confirm that communication exists between the balloon and ground.

The Raspberry Pi runs ‘header less’ and a WiFi Access Point is used in the field to allow the Raspberry Pi to be set up, and to allow an iPad to take pictures using Berrycam. The expected range for this is at least 100 feet.

All images are stored on an 8gb nano USB memory stick.

One example of the need for through testing occurred when I took the unit outside to test the range of the radios. The Raspberry Pi was set up using WiFi, then taken outside, everything went well until I returned inside. The Raspberry Pi did not reconnect to the WiFi and the only way to shut it down was to pull the power plug – not the best thing to do. The answer was to add another button (not shown in the image above) that shut the Pi down. The control panel sends a shutdown command, the Pi receives this and uses

os.system("sudo shutdown -h now")

to shutdown the Raspberry Pi.


Weather Balloon 4 – taking pictures and video using EasyRadio

I need the Raspberry Pi in the balloon to act as a slave, waiting for commands from the master on the ground. The LPRS easyRadio Python example seems to sit in a loop waiting for keyboard entry, it only prints received data after it sends data, or the command flush is sent. If I have missed something then I apologise, so I decided to write my own code.

I took delivery of the new Rasperry Pi 2 and spent the last few days setting it up. I started with a clean install of Raspian and that has had an upgrade, the desktop looks good now. It’s difficult to say if it feels any faster than my B+ but I have not had much time to try it out.

As the easyRadio software is written in Python I decided to use the Python PiCamera software, I did the usual update then tried to install picamera, but I was told I had the latest version. However, when I tried to use the camera it generated an error report that ended in this unit can only be used on a Raspberry Pi! Now I don’t know if this is something to do with the Raspberry Pi2 or the new version of Raspian, but I decided to use Raspivid and Raspistill instead. These have to be called through os.system, I may come back later and look at this, but for now everything is working as I wanted.

The programme sits in a listen ending loop waiting for an input, once it is received the variable incomming holds this data. The easyRadio sends data in packets of 180 bytes and as I only expect to receive short messages only up to 180 bytes is read from the Serial Buffer. I also decided to use capitalisation for commands, it’s not necessary but I thought it might stop commands being sent accidentally. Once incomming has a command it is compared with the list of commands and the correct command routine is called. At the moment PRINT takes a single photograph, VIDEO takes a short video, GPS turns on the GPS and transmits the data back to the ground. STOP shuts the programme down.

GPS has not yet been implemented as I am not sure if I will use an Arduino to gather sensor and GPS data that is then sent over a serial line to the Raspberry Pi for transmission to the ground. The command set can easily be expanded. The programme sends a Balloon ACK back to the ground to show it received the signal.

I have not been able to test the range yet, but I hope to be able to test that during the coming week. The Python code is shown here for Python 2, I can’t say if it will work in Python 3, that’s something else to try.

# easyRadio slave unit. this unit is mounted on the balloon
# it sits in a receive loop waiting for commands

# Chris Rouse February 2015

import serial
import os

def printPicture():
"Takes a single photograph"
os.system("raspistill -vf -hf -o 'image.jpg'")


def takeVideo(numSecs):
"Takes vide for numSecs seconds"
os.system("raspivid -o 'video.h264' -t 3000")

def runGPS():
"Starts the GPS"


def closeProg():
"Shuts this program down it cannot be restarted over easyRadio"

# set up the serial port, this will be ttyUSB0 for the easy radio
ser = serial.Serial("/dev/ttyUSB0", 19200, timeout = 0.5)

# main loop
while True:
numbytes = ser.inWaiting()
incomming = ""
if numbytes >0: # wait for a singnal to come in
# easyRadio sends up to 180 characters
incomming = # read in up to 180 characters
if incomming != "":

# now check for commands

if incomming == "PRINT":
print("Takes a single picture")

if incomming == "VIDEO":
print ("Takes a video")
takeVideo(60) # change this value to suit, this is 1 minute

if incomming == "GPS":
print("Starts collecting GPS data, and send back live data")
runGPS() # could add a time to run here

if incomming == "STOP":
print("WARNING this stops communications")

# end of commands

incomming = "" # reset text string

# now send ACK to master unit to show the command was received

ser.write(">>> Balloon ACK\r\n")

Using LPRS EasyRadio with Raspberry Pi – part 2

This part deals with the program that runs on the PC, any two or more devices can communicate, but the software provided by LPRS will only run on a PC. You should have downloaded and installed the EasyRadio Companion as detailed in part 1. Before running this software, and before plugging in a radio open up Control Panel, go to System Hardware and open up the COM port list. Make a note of the items listed then plug in a radio, Windows will install the necessary drivers. Once these have been installed the radio will show up as a USB serial port, make a note of the COM port number. Now run the EasyRadio companion


You will need to set up several parameters as the program does not do this automatically. Click on Settings in the top menu bar, then click RS232 Settings. Click on the radio button alongside Device 1, in the drop down box alongside Port select your COM port number (the correct port is NOT selected automatically). For the moment leave Baud set at 19200, Data Bits at 8, Stop Bits at 1 and Handshaking at None as these match the values in the Python sketch on the Raspberry Pi. Click on Store, then Exit.


Click on settings again, then Select Device, click on Device 1. Make sure UART Baud Rate is set to 19200 and click Update. Make sure Frequency Channel is set to C0 and click on Update.


Click on the button marked Send Command and the Device I’d will be shown. Click on Read Module and the Serial Number and date of manufacture will be shown. Make sure the tab ERA Modules is highlighted and click on the Communication tab.

Fit a radio to a Raspberry Pi and start up the Pi. Once the desktop is displayed start Idle and load the Python script that you downloaded in part one of this post. run the script.

Type something at the cursor and press enter, this text will appear on the PC in the large box on the Communication Test page. Now type something in the box marked -enter your text here-.

Nothing will appear on the Raspberry as the Python script is waiting for a keyboard entry, however the text sent from the PC has been stored. Type something into the Python script followed by enter. The contents of the received buffer will now be printed.

That’s is it, two way communication has been achieved!

Using LPRS EasyRadio’s and Raspberry Pi


I was looking for a long range system to allow me to communicate with the Raspberry Pi and came across a USB radio system using LPRS EasyRadio. Each unit cost about £40, but offered an easy communication system over a longer range than WiFi. The system I purchased was the Easyradio USB Connect-2-Pi Dongle 900MHz version, designed to work with the Pi, but arrived with no documentation at all.

Searching the internet I found a simple setup sheet here. You first need to download a python script and, if you need it, an EasyRadio Windows Companion from here.

Full details for the setup are given in the setup sheet, and in less than 10 minutes I had it all working. I ran the downloaded Python script and sent the command ER_CMD#TR and received a reply from the radio showing the modules firmware revision number.

The next job is to get the radio working on the PC.