Saturday, 1 June 2013

Radio Astronomy Station. Part 4.

The Software Defined Radio.

In Part 2, I discussed the various parts of the Radio Astronomy Station and the Raspberry Pi with a USB Software Defined Radio (SDR).

In Part 3 we went through getting the Raspberry Pi working. You should now have a RasPi with a USB Keyboard and Mouse plugged in, power connected with a micro USB mobile phone charger and a screen plugged in to either the composite video RCA socket or getting an awesome picture through the HDMI connector.

If you successfully reached the Linux Rasbian login prompt you should see:

raspberrypi login :

Enter your username which should have defaulted to 'pi'.
Enter your password which is 'raspberry' if you didn't alter it with raspi-config.

You should now see the login message telling you when you last logged in and the GNU/Linux message telling you about free software!

If you have an ethernet cable from your RasPi to your router you should have an active internet connection. The login message we saw earlier shows the IP address of the RasPi. Most likely something like '192.168. something dot something'. It depends on how your router is set up.

We can now do some cool stuff to test our RasPi. On the command line type 'top' (without the quotes) and hit enter. You'll see the current time, how long your RasPi has been active for, how many users are logged in and also the amount of hard work your RasPi is doing. To exit from 'top' just hit 'q' and you should end up back at the command line prompt.

Raspberry Pi running 'top'

The picture here shows two active logins, one from the keyboard and one remote login.







Remote Login

The ability to log in remotely to the Raspberry Pi or in fact any Linux computer is a pretty cool thing to do. You might want to look at installing a program on your PC for logging in with SSH (unless you already use a Linux computer and have all the tools you need). On a Windows PC I use a program called PuTTY (www.putty.org) to log in. Its fairly easy to use. Just dont be put off by the options for using it. Only need three things. IP address, Username, Password to do a remote login. Make sure you use the 'SSH' option.

If you have a Linux PC, just open a terminal window and type 'ssh -l pi (ip address)'. Thats a lower case L not a 'one'.
Update Your Pi.

Ok so thats the hard part over. Your Raspberry Pi is running, you've seen 'TOP' give you a rundown of whats going on. If you haven't done so yet, now might be a good time to Update your operating system. Assuming you have a working internet connection enter the following:

sudo apt-get update

*(Note - 'sudo' means 'superuser do' and 'apt-get' is the cool updating and software installing tool).

Linux being the secure operating system it is, you'll be asked for your password. You should then see your Linux Raspbian querying a bunch of different websites asking for updates on files etc. You can now go ahead and run those updates by entering the following:

sudo apt-get upgrade

Your RasPi already knows your password was entered so it should now start downloading all the relevant updated files for your Linux Raspbian operating system. You were probably also asked if it is ok to download and install xxx Megabytes of updated files.

Once the downloading and upgrading is finished you may want to restart your Linux Raspbian. If you are remotely logged in your connection will be cut so you'll need to reconnect. If you are using keyboard and screen you'll just get a restart. Go ahead and type the following:

sudo shutdown -r now

Wait about 60 seconds while your RasPi goes through its reboot. 'Shutdown' with the -r means 'Shutdown and Reboot' and the 'now' means do it NOW.

If you have a keyboard and screen you'll be seeing the normal restart stuff. If you are using a remote login you'll have to go through the PuTTY login sequence again.

Once back at the command line we're ready for setting up the Software Defined Radio.

Setting up the SDR.

You may find it just as easy to go through Peter Goodhalls web page on setting up the Raspberry Pi. You can read his page here. http://m3php.com/2012/10/10/remote-sdr-using-raspberry-pi-rtl_tcp/

Otherwise, if you want to follow it here, here's what we need to enter.

  1. sudo apt-get install git
  2. git clone git://git.osmocom.org/rtl-sdr.git
  3. sudo apt-get install cmake
  4. sudo apt-get install pkg-config
  5. sudo apt-get install libusb-1.0
  6. cd rtl-sdr/
  7. mkdir build
  8. cd build
  9. cmake ../ -DINSTALL_UDEV_RULES=ON
  10. make
  11. sudo make install
  12. sudo ldconfig

If you have completed the steps above you should now have a Raspberry Pi with all the software needed to use the Software Defined Radio USB stick. You should now do another restart so repeat our shutdown sequence from before.

When you get back to the command line and you are logged in, plug in the DVB SDR stick into the spare USB port where the keyboard is. If you are remotely logged in this will be a lot easier without the keyboard connected. You may also want to consider an external powered USB Hub to provide extra USB ports and extra power for USB devices.

Ok lets start up our SDR stick. Type in the following:

lsusb

You should see a list of USB devices that are plugged in. One of them should be a Realtek RTL2832U which is our Digital Radio device. If you can successfully see this in the USB device list then go ahead and start the SDR.

rtl_tcp -a 192.168. (whatever your RasPi IP address is).

Our SDR is now receiving and ready
You might like to try an App on your Android phone called SDR Touch. While still buggy and prone to crashing it will interface with your SDR radio tuner and produce received audio from your phone.

On your Windows PC try using SDR Sharp (www.sdrsharp.com). This makes a good, easy to install application for Windows users. Go to this page http://rtlsdr.org/softwarewindows and follow the instructions for installing SDR Sharp on a Windows PC.


SDR Sharp running on Windows 7 connected via the network to my Raspberry Pi and SDR receiver
Spend some time getting used to how SDR Sharp works. For now, this makes a great testing program for your SDR receiver. Later on we should look at other SDR software that can give us even more flexability.

Thats one of the advantages with a system like this. We can swap and reconfigure different parts to get better results. At a later stage we could replace the whole Raspberry Pi and SDR receiver with a different SDR package that could work on frequencies as high as 10 GHz.

I hope for now you have fun with your SDR receiver.

Cheers.