Wednesday, 21 August 2013

Wireless Serial Communication with the Raspberry Pi - Part 2

Now I'm going to go through how to set up the other end of the wireless serial link. In my case it is a laptop computer on which runs Linux and Windows (and I'll go through how to set up both) but it could be another Raspberry Pi or practically any other computer system.

I'll be using a SFR Stick (available from Ciseco) to provide the wireless link on the laptop:

The SRF Stick is a small plug in USB module, similar in size to a USB flash drive. It can be fitted with a wire antenna to improve the range, but this means taking the case apart and drilling a hole for the wire to pass through.I decided to fit a quarter wavelength wire antenna, which in for 868 MHz is only 82mm long. This article provided guidance on fitting the antenna.

For Linux Users...

I'll start off by considering how to set the hardware up under Linux, because it is simpler than under Windows and no drivers are required.

Simply plug the SRF Stick into a spare USB port on your computer. You should see a flashing red LED. Now if you followed my blog post on how to connect to the Raspberry Pi remotely via a wired serial link then you should already have PuTTY installed and working - if not have a look at this blog post under the "For Linux users..." heading about two thirds of the way down.

Launch PuTTY (the application is called "PuTTY SSH Client"). Click on "Terminal" down the left hand side of the PuTTY Configuration window and select the "Implicit LF in every CR" option, and the "Local Echo: Force on" option (this should be very familiar to you because it's exactly what you did previously on the Raspberry Pi). Your configuration screen should look like this:

Then click on "Session"down the left hand side of the PuTTY Configuration window and select the "Serial" and specify the Serial line as "/dev/ttyACM0" and the speed as "115200". Then click on "Default Settings" and click on the "Save" button on the right. Your configuration screen should now look like this:

Now click on the "Open" button and you should get a blank console window. Now, in the blank console window, type "+++" , but do not press Enter. After a short delay you should get the reply "OK". This puts the SRF Stick into "command mode" so that you can change the configuration.

However, please note that (unlike with the Slice of Radio module installed in the Raspberry Pi) I was able to communicate with the SRF Stick straight away at a baud rate 115200, and did not have to go through the whole process of changing the baud rate, applying the changes, rebooting and then writing the changes to flash memory, but if you find that you can not communicate with the SRF Stick straight away at 115200 bps, you may have to go through the same process for it as you did for the Slice of Radio module...

Leaving the console window open on your Linux system (in my case my laptop), launch PuTTY on the Raspberry Pi and open a console window. Type some text on the console window on the Raspberry Pi. As if by magic, the text will also appear on the console window on your Linux system, and the reverse is also true - if you type into the console window on your Linux system, the same text will appear in the console window on your Raspberry Pi.

The following screenshot was taken from my Linux system. I typed "Hello Laptop" on my Raspberry Pi, and then replied by typing "Hello Raspberry PI" on my Linux system (my laptop).

Congratulations, you've just created a very simple "instant messaging" system... Now close PuTTY on both the Raspberry Pi and the Linux system. Then relaunch PuTTY on the Linux system and change the Terminal settings so that the "Implicit LF in every CR" option is not selected, and set the "Local Echo" option to Auto. The PuTTY configuration screen on your Linux system should look like this:

Save these settings by clicking on "Session", then "Default Settings" and finally "Save". Then click "Open" to start a new session on the Linux system. You should see a blank console window as before.

Now, reboot your Raspberry Pi, and as it reboots, keep an eye on the console window on your Linux system. As the Raspberry Pi boots up the bootup information should appear in the console window on the Linux system. It should look something like this, but may be slightly different depending on how your Raspberry Pi is setup and what peripherals you have connected to it.

Leave the console window open on your Linux system, and log on to your Raspberry Pi. Go into the GUI and open an LXTerminal window. Type "sudo leafpad /etc/inittab" at the command line prompt and press Enter:

pi@raspberrypi ~ $ sudo leafpad /etc/inittab_

Scroll down to the end of the file and reinstate the very last line by deleting the "#" at the beginning of the line. Your file should now look like this:

Save the file, quit Leafpad and reboot your Raspberry Pi. This time, the console window on your Linux system should present you with a login prompt:

Go ahead and login!

You should now be able to access your Raspberry Pi remotely, and wirelessly. With this configuration, the only thing the Raspberry Pi needs to operate is a source of power, which opens up all sorts of possibilities for portable operation, and by using the Ciseco RF modules the range should be much greater than would be possible using WiFi or Bluetooth.


  1. This is a great guide and is working well for me. What I'm now trying to work out is how to stream from the raspberry pi camera module over slice of radio (which I'm sure will need to be at a fairly modest resolution to work) and how to transfer files from the PI to the laptop. tutorial to help would be great.

  2. Hi John, that is on my todo list as well! Initially I'm going to try and remotely trigger the camera to take a photo, transfer the photo over the wireless link and then delete it off the SD card. I'd be interested to hear how you get on.

  3. Why not configuring slip between PC & PI?