just another web log

01 Jul 2013:
greping a stream then you might need a line buffer
When I tried to capture the live GPS data from gpspipe with grep I hit a strange problem, grep would not return any results.
Now normally I use grep on static files and it just "works" but here we are using a stream as the input not a file. The --line-buffered reduces performance but makes sure no buffering confuses your hacker.
gpspipe -w |grep --line-buffered -o \"PRN\":[0-9]* | tee satPRN.list

01 Jul 2013:
Grep your GPS satellites
A couple of thing s I missed off the last post about GPS.
For one thing the GPS unit is magnetised, which I only realised after it stuck to the Pi.
The other thing was I specially noted that I plugged it in to a "recommended USB 2.0 HUB" but when I measured the voltage across TP1 and TP2 there was no change in voltage, it was using less than 0.01 volt!
Which means it should be ideal for a car project.
I was also interested in how many satellites it might spot sitting on the window sill for 20 hours.
gpspipe -w |grep --line-buffered -o \"PRN\":[0-9]* | tee satPRN.list
Where gpspipe is just an interface to the constant chatter from the GPS receiver, grep filters to the PRN information and tee allows the output to got to the standard display and a file.
20 hours later and a [CTRL+c]
cat satPRN.list | sort -u | grep -o [0-9]* | sort -n
First sort and only return unique lines then get the numbers and finally sort numerically.

01 Jul 2013:
GPS enabling the raspberry pi
After the last fun with the Raspberry Pi and USB receivers using up to much power, I plugged my new USB GPS receiver into my recommended USB 2.0 HUB
photo of my USB GPS receiver next to Pi
usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[ 263.542791] usb 1-1.2: New USB device found, idVendor=067b, idProduct=2303
[ 263.542823] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 263.542839] usb 1-1.2: Product: USB-Serial Controller
[ 263.542852] usb 1-1.2: Manufacturer: Prolific Technology Inc.
[ 263.636431] usbcore: registered new interface driver usbserial
[ 263.638140] usbcore: registered new interface driver usbserial_generic
[ 263.639810] USB Serial support registered for generic
[ 263.639852] usbserial: USB Serial Driver core
[ 263.649830] usbcore: registered new interface driver pl2303
[ 263.650487] USB Serial support registered for pl2303
[ 263.650603] pl2303 1-1.2:1.0: pl2303 converter detected
[ 263.664213] usb 1-1.2: pl2303 converter now attached to ttyUSB0

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

So it is a serial device ...
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gpsd gpsd-clients python-gps

That gets me lots of GPS related stuff to play with ...
sudo killall gpsd
sudo rm /var/run/gpsd.sock
sudo gpsd -n /dev/ttyUSB0

[CTRL+c] will quit cgps.
If you are happy your GPS is working you can kill all the chatter by running it in silent mode.
cgps -s
When running (in either mode) the right hand box is the Satellites and the left is current status.
PRN: Elev: Azim: SNR: Used:
PRN is the Psuedo Random Number that differentiates the satellites from one another also referred to as Gold Codes, just think of it as the GPS satellites ID
Elev is Elevation and Azim is Azimuth
SNR is Signal to Noise Ratio and if too low the satellite information should not be used.
and Used is flag indicating if this satellite is being used in the calculations.

After a bit I had no satellites and a cat sitting on the GPS receiver, it needs unobstructed line of sight to the GPS satellites.
You need 3 satellites for basic location and a minimum of 4 for full 3D location, more the merrier.
loading results, please wait loading animateloading animateloading animate
[More tags]
rss feed



flog archives

This page is by me for me, if you are not me then please be aware of the following
I am not responsible for anything that works or does not work including files and pages made available at www.jumpstation.co.uk I am also not responsible for any information(or what you or others do with it) available at www.jumpstation.co.uk
In fact I'm not responsible for anything ever, so there!

[Pay4Foss banner long]