Getting an Icom IC-PCR1000 working with Linux Mint

I’ve just got a second hand Icom IC-PCR1000 communications receiver and needed to get it working with Linux Mint.

The Icom IC-PCR1000
The Icom IC-PCR1000

What’s unique to this receiver is that its a standalone unit which connects to a computer via RS232C (it dates from 1999) and covers the entire 10kHz to 1300MHz range (there is a US version which has US mobile frequencies blocked).

Now obviously most modern computers don’t have native serial ports these days so I’m using a USB-Serial adapter to connect it.

Installation

So to get it working with Linux. First ignore the floppies – they only contain software for Windows and even if you wanted to use it, the contents are available online anyhow.

Next plug it in to your Linux box. You’ll need a standard mini-plug audio cable which you’ll plug in to the Ext-SP socket on the radio and the other end into either Line-In or Microphone (some systems they are the same one).

Next you need is a recent version of a utility called pcrd. There’s actually two versions out there but the one I’m using is from https://www.crc.id.au/pcrd-pcr1000-on-linux/

From that page download the source for v0.12 and extract it. This should give you a pcrd-0.12 dircectory. Next you need to compile it:

peter@titan ~ $ cd pcrd-0.12
peter@titan ~/pcrd-0.12 $ make linux

Trying it out

peter@titan ~/pcrd-0.12 $ ./pcrd -d /dev/ttyUSB0 -v 40 89.100 wfm 230

Here

  • /dev/ttyUSB0 is the USB-Serial port.
  • -v is the volume in hexadecimal, so 00 is off, ff is full on.
  •  89.100 is BBC Radio 2 here in the South East of the UK.
  • wfm is the mode, so for broadcast FM radio you need to use Wide FM
  • 230 is the filter to use. If you leave this out it will default to 15 kHz

That’s effectively all that’s needed, sort of.

Here’s a few other stations to try:

BBC Radio Kent

peter@titan ~/pcrd-0.12 $ ./pcrd -d /dev/ttyUSB0 -v 40 96.7 wfm 230

BBC Radio 4 FM

peter@titan ~/pcrd-0.12 $ ./pcrd -d /dev/ttyUSB0 -v 40 93.6 wfm 230

BBC Radio 4 Long Wave – essential for Test Match Special, as long as you have the right antenna 😉

peter@titan ~/pcrd-0.12 $ ./pcrd -d /dev/ttyUSB0 -v 40 0.198

No audio?

You might have a problem with getting the audio being fed to your speakers. This seems to be a common problem with Linux mint, but there’s a solution:

First make sure you have pulseaudio-utils installed:

peter@titan ~ $ sudo apt-get install pulseaudio-utils

Next you need to add the loopback module:

peter@titan ~ $ pactl load-module module-loopback latency_msec=10

You should see a microphone icon appear next to the clock and, hopefully, the audio being fed through to the speakers.

Getting GPS to work on a Raspberry PI

One of the tasks I want to use a Raspberry PI for is to take over the duties of an existing ITX based linux box running my weather station. Now in theory that should be pretty simple as the current setup uses pywws to connect to the station and as that’s written in python it should work.

Now the Raspberry PI has no onboard Real time clock – which means it needs to use an NTP server to get the time when it starts. Usually you would use the default settings and allow the PI to connect to thenet for it’s time. Now this is fine if you have a working net connection but what if you are not connected to the net? You might be in the field running the PI on batteries.

As the other projects I have lined up for it is to connect my Meade LX200GPS telescope to the local network or to work with my (in prototype) radio telescopes so having an accurate clock is going to be required.

Now the obvious solution here is to use GPS as a time source. GPS works by having a constellation of satellites in orbit and each one carries a highly accurate atomic clock & broadcast both their current position and the time. A GPS receiver then receives these signals and, as long as it has enough satellites and workout where you are by comparing the times from those clocks.

So this article shows how to use A GPS receiver with the Rasperry PI – although these instructions are not specific to the PI.

The hardware

For this experiment I’m using a USB GPS receiver from Maplin – product code A73KF. I bought this several months ago when they had it on special offer for £19.99 – it usually retails for £29.99.

Raspberry PI with the A73KF GPS receiver plugged in

Now it comes with a CD for Windows machines but we don’t need it – as the majority of GPS receivers I know of use serial & this is no exception. When plugged in it appears as a serial port.

Plug it in and run lsusb

pi@raspberrypi:~$ sudo lsusb
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

There the Prolific Technology entry is the GPS appearing as a serial port. If you look in /var/log/syslog you will also notice it will have created the port as /dev/ttyUSB0 as it’s the first serial port.

Using the PI as a GPS Receiver

Now the next step is to get the pi receiving data from the satellites. Now there is a suite of tools available for Linux called gpsd which we’ll install:

pi@raspberrypi:~$ sudo apt-get install gpsd gpsd-clients python-gps

Next we need to start the daemon:

pi@raspberrypi:~$ sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock

Ignore any messages from the console or in the log files, you may see it complaining about IPv6 but you can ignore that.

Viewing whats in the sky & your location

Now GPS doesn’t work indoors – as it needs a clear view of the sky so for this I’ve placed the PI on the window sill. Next I ssh into the pi and run cgps.

pi@raspberrypi:~$ cgps -s

The -s flag is there to tell the command not to write raw data to the screen as well as the processed data.

You should then get the following output:

┌───────────────────────────────────────────┐┌─────────────────────────────────┐
│    Time:       2012-06-18T15:05:10.0Z     ││PRN:   Elev:  Azim:  SNR:  Used: │
│    Latitude:    51.231848 N               ││  14    43    249    40      Y   │
│    Longitude:    0.514014 E               ││  25    75    283    37      Y   │
│    Altitude:   132.3 m                    ││   2    26    085    31      Y   │
│    Speed:      0.0 kph                    ││  12    56    070    18      Y   │
│    Heading:    0.0 deg (true)             ││   9    19    133    22      Y   │
│    Climb:      0.0 m/min                  ││  27    09    133    17      Y   │
│    Status:     3D FIX (1 secs)            ││   4    17    045    31      Y   │
│    GPS Type:                              ││  32    05    321    20      Y   │
│    Longitude Err:   +/- 8 m               ││  29    41    192    18      Y   │
│    Latitude Err:    +/- 9 m               ││  31    28    304    42      Y   │
│    Altitude Err:    +/- 27 m              ││                                 │
│    Course Err:      n/a                   ││                                 │
│    Speed Err:       +/- 68 kph            ││                                 │
│                                           ││                                 │
│                                           ││                                 │
│                                           ││                                 │
│                                           ││                                 │
│                                           ││                                 │
└───────────────────────────────────────────┘└─────────────────────────────────┘

Here you can see it’s receiving from 10 satellites and it has the time and your location. The 3D FIX section tells you it has enough data for a 3D fix on your location (i.e. altitude). The Err lines tell you the error in your position. If you leave it running you should see the Err values change every second or so.

Viewing GPS under X-Windows

Now above I showed how the GPS looks from an SSH connection but you can get a graphical display as well using the xgps client thats also been installed. Now if you have a monitor connected to the pi simply open a terminal and run xgps. However as I’ve not got a monitor against the window I’ve used ssh to connect to it from another machine. To get this to work you need to add -Y to the ssh command.

peter@somehost:~ $ ssh -Y pi@raspberrypi
pi@raspberrypi:~$ xgps

You should now get a window like the following open on your local machine – don’t worry if it takes a little while, it might take a second or two:

xgps running on a PI but being displayed on Mac OS-X

Setting the computer time using GPS

Now we have a working GPS we can now get the PI to use it for setting the time. To do this we need to configure ntp to use the GPS satellites as a time source. Now you should already have ntp installed but if not then you need to install it:

pi@raspberrypi:~$ sudo apt-get install ntp

Next you need to edit the file: /etc/ntp.conf and add a few lines to it defining the GPS. This can be either before or after the existing lines beginning with server:

# gps ntp
server 127.127.28.0 minpoll 4
fudge  127.127.28.0 time1 0.183 refid NMEA
server 127.127.28.1 minpoll 4 prefer
fudge  127.127.28.1 refid PPS

Now restart ntp:

pi@raspberrypi:~$ sudo service ntp restart

Now if you query the server you should after a while see it synchronize:

pi@raspberrypi:~$ ntpq -p
remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*ns1.luns.net.uk 33.117.170.50    2 u   54   64    7   65.454    2.666   5.800
+resntp-b-vip.lo 127.151.91.34    3 u   45   64   17   55.704   -5.169   8.482
+bart.nexellent. 194.242.34.149   2 u   17   64   17   76.585   -4.271  57.595
+v01.s01.be.it2g 193.190.230.65   2 u   20   64   37   86.464   -2.374 228.460
xSHM(0)          .NMEA.           0 l   11   16  377    0.000  144.714   3.026
SHM(1)          .PPS.            0 l    -   16    0    0.000    0.000   0.000

A couple of notes:

You might find that ntp doesn’t connect to the gps at first. It appears that it starts gpsd up without the link to the serial port. What I find I have to do is:

pi@raspberrypi:~$ sudo killall gpsd
pi@raspberrypi:~$ sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock
pi@raspberrypi:~$ sudo service ntp restart

Once I’ve done this then after it gets a fix then it starts working. Sometimes running cgps and waiting for it to get a fix also fixes this.

I don’t know why this happens but it’s an issue I’ve yet to solve.

Square Kilometre Array Telescope mentioned in Parliament

Whilst checking hansard (the official publication of the UK Parliament) for Trainwatch I spotted this set of written answers published yesterday (26 March 2012) about the Square Kilometre Array Telescope:

Roger Williams: To ask the Secretary of State for Business, Innovation and Skills what his policy is on implementation of the recommendations of the Square Kilometre Array Site Advisory Committee; and if he will make a statement. [101678]

Mr Willetts: Members of the Square Kilometre Array (SKA) Organisation will consider the report and recommendation of the SKA Site Advisory Committee, and agree on next steps and actions. The Science and Technology Facilities Council (STFC) represents the UK in the SKA Organisation and it liaises closely with the Department on SKA discussions.

Roger Williams: To ask the Secretary of State for Business, Innovation and Skills if he will publish the location recommended by the independent Square Kilometre Array Site Advisory Committee; and if he will make a statement. [101956]

Mr Willetts: The Square Kilometre Array (SKA) Site Advisory Committee has undertaken a detailed evaluation of the two candidate sites and has presented its report and recommendation on the preferred site for the SKA to the SKA Board.

All parties involved have agreed that this information should remain confidential while the process for arriving at the SKA site location decision is under way.

Roger Williams: To ask the Secretary of State for Business, Innovation and Skills

  1. whether the independent Square Kilometre Site Advisory Committee has completed its evaluation of the cost and infrastructure implications of the African and Australian and New Zealand bids to host the Square Kilometre Array telescope; and if he will make a statement; [101957]
  2. whether the independent Square Kilometre Array (SKA) Advisory Committee has submitted its recommendations regarding the location of the SKA; and if he will make a statement. [101958]


Mr Willetts: The Square Kilometre Array (SKA) Site Advisory Committee has undertaken a detailed evaluation of the two candidate sites and has presented its report and recommendation on the preferred site for the SKA to the SKA Board.

© Parliamentary material is reproduced with the permission of the Controller of HMSO on behalf of Parliament. Licence No: P2011000006

%d bloggers like this: