Wednesday, 23 September 2009

GPS with a CVGI-B07 on Eeebuntu

Introduction

This is not part of my travel diaries, but it is part of my preparation of going to India. I know it is not the greenest thing to do, but I am planning on buying a light motorcycle to get about in India with, which in my opinion, having in the past rented a Yamaha RX 100 in Goa, is probably the most enjoyable way of travelling off the tourist trail.  Because I want to avoid the major roads, the chance of me getting lost is probably quite high. So having a GPS system for locating myself as either a last resort or to check that I haven't missed a vital turning, to me sounds like more fun than it is to be ashamed of. In rural India it can be very difficult to ask for directions because often the people are no better at helping me read my map than I am pronouncing a town's name. I probably mentioned in my previous post that I bought an eeepc so that I can jump at the possibility of performing data analysis during my volunteer experiences. So this post is both a record for myself how I set up the GPS, and particularly I hope it will be useful to anyone trawling the internet looking for the solutions to the same problems that I faced.

I still don't know when I am going to India, but it probably will be mid October now. I am still waiting to here if my corrections to my thesis are sufficient, but am about to take the risk of printing it off anyway and leaving it at uni for someone hand in for me.

Apparatus
  • Asus eeepc 1000HD - my netbook
  • Eeebuntu base 3.0 - my Linux operating system
  • CVGI-B07 USB GPS dongle (was the cheapest I could find - £22 incl. p&p from ebay)
  • GMapCatcher - allows you to download Google maps for offline viewing. Also incorporates a GPS marker.
  • python - runs GMapCatcher
  • gpsd - translates the gibberish from the dongle into coords for GMapCatcher
Method
  • Install python and gpsd. I already had python installed and I installed gpsd 2.38 through the Synaptic Package Manager.
  • Download GMapCather and unpack in a suitable place.
  • enter   tail -f /var/log/messages    into a terminal
  • Go outside if you are not already and make sure you have an unobstructed view of the sky.
  • Attach GPS dongle which will flash for some time while it locates satellites.
  • Then look at the text printed to the terminal when you plucgged in the device. Hopefully you have the PL2303 driver and it says sometime like mine: 
Sep 22 23:12:00 onyx kernel: [22297.432119] usb 2-1: new full speed USB device using uhci_hcd and address 17
Sep 22 23:12:00 onyx kernel: [22297.592456] usb 2-1: configuration #1 chosen from 1 choice

Sep 22 23:12:00 onyx kernel: [22297.597554] pl2303 2-1:1.0: pl2303 converter detected

Sep 22 23:12:00 onyx kernel: [22297.615352] usb 2-1: pl2303 converter now attached to ttyUSB0
  • Close tail with Ctrl C and enter   gpsd -bnN -D4 /dev/ttyUSB0   where the last part is taken from the port that was printed earlier - see above in red. Warning: Don't miss out the -b option for the CVGI-BO7 dongle - I'll explain below. Hopefully plenty of exciting gibberish will fly past your eyes and you might even catch a glimpse of some text saying that it has locked onto a Satellite.
  • To make more sense of all gibberish you might like to open xgps, which should have installed with gpsd. xgps will show you a graphical display of the number of locked in sats. Empty circles are not locked in. Red spots are week and green strong signals and yellow in the middle the Signal to Noise Ratio (SNR) is also listed for each satellite.
  • If you have a lock onto three or more satellites start maps.py in the GMapsCatcher folder, select Marker Centre from the GPS drop down menu that only appears when gpsd is correctly installed and running and zoom in and you should be taken to your current location. Oh, did I forget to tell you that you should have run GMapsCatcher before so that you can view the maps offline when you are outside?

Problems

Hopefully you'll have none, but if you do, here are the problems I encountered and how I solved or got around them.

- GPS does not lock onto Satellites.
  • Did you go outside? I never bothered but it does help particularly for first lock-in.
  • It seems to help to not plug the USB dongle directly into the computer but to the end of an extension USB cable.
  • I had the impression that installing/running roadnav or some navigation software once was needed to configure my CVGI-BO7 dongle as on a Windows, Mac and Linux computer it only would work once I had run such software. gpsd can't configure the dongle with the -b option set (I'll explain below). Roadnav only had a debian file for an older version of ubuntu but it still worked for me.
- You didn't listen and ran gpsd without the -b option? I wish I had been told myself! I thought I had bricked my dongle! When I sent the command the dongle light went out and when I next plugged it in the light would stay on and not flash or write anything to the serial port. It no longer could pass for Christmas decoration. The problem is that gpsd tries to optimise the device which obviously does not like it. Luckily there is a solution.
  • I found out that the CVGI-B07 GPS dongle uses a SiRF star III chip and that the company, SiRF, has a tool that you can download to configure their chips. You can download it from this link.  You want the demo tool, not the firmware. Install this on a Windoze PC and enter your dongle on the PC - after of course you have installed the PL2303 chip driver, which hopefully came with your dongle.
  • Open SiRFDemo and select your appropriate port. You can find the port number by clicking Start, right click on My Computer -> Properties, select the Hardware tab, Device Manager, expand Ports (COM & LPT) and you should see the port number there. You can remove the dongle and put it back in to make sure you have the right one.
  • Select the Baud Rate. 4800 worked for me and click the confirm button on that window. The main program should now load.
  • Click the little button that says "Connect to Data Source" when you hover your mouse over it. It should start doing stuff now.
  • Now select   |Action > Initialize Data Source. A window popped up for me at this point asking which software the chip was using. I chose the default one which was first in the list and which I found on this page but I can't remember which it was now - either GSW or GSC. On the next window I selected the option to reset and clicked send. After a few moments the dongle starting flashing again. Hurray! If you don't dare reseting it you probably can wait a week or a month or two until the internal rechargable battery runs down and the memory is cleared.
  • You can find some detailed instructions for using SiRFDemo here.
  • Using the -b option next time with gpsd prevents gpsd writing to the dongle. With the debug level set at -D2 occasionally psd complains, but it still does its job.
- Why do the markers in GMapCatcher look naf?
  • I had to hard code the path to the images  - eg replacing filename = os.path.join('images', 'marker_gps.png') with filename = os.path.join('/home/cjreeve/GMapCatcher/images', 'marker_gps.png') in the file mapGPS.py, mapMark.py, and mapPixbuf.py located in src in the GMapsCatcher directory. The problem was that the program otherwise looks for the folder images where ever you start the program and I use the Cairo Dock to start it and who knows which directory it looks in then...
  • The pin image that points to your markers (if you set any) looked too big for my liking so I scaled it down with some image editing software (The Gimp) but maintained the pixel size dimentions of the image.
Conclusion

That's pretty much it. I would currently recommend the CVGI-BO7 dongle, but this might change if it breaks as soon as I need it. I'll let you know. From my garden it locks onto 8 satellites (with SNRs between 25 and 43) in less than a minute after a days non use. It looks nice but is not branded and does not come with very helpful instructions. It comes with the Prolific 2303 Windows and Mac OS X drivers which work, but only has some old Redhat drivers for Linux. Ubuntu seems to ship with the driver so I had no problem - it just took me some time to realise. Let me know, anyone, if you found any of this information useful.






CVGI-B07 Manufacturer Specifications
  • Primary Function: GPS receiver USB dongle
  • Tracks up to 20 satellites.
  • Receiver: L1, C/A code
  • Max update rate: 1 HZ
  • Acquisition time
    • Reacquisition: 0.1 sec average
      Hot start: 1 sec.
      Warm start: 38 sec.
      Cold start: 42 sec.
  • Position Accuracy
      Non DGPS (Differential GPS)
        Position: 5-25 meter CEP without SA
        Velocity: 0.1 meters/second, without SA
        Time: 1 microsecond synchronized GPS time
      DGPS (Differential GPS)
        Position: 1 to 5 meters
        Velocity: 0.05 meters/second
      EGNOS/WAAS/Beacon
        Position
          < 2.2 meters, horizontal 95% of time
          < 5 meters vertical 95% of time
  • Dynamic Conditions:
      Altitude: 18,000 meters (60,000 feet ) max
      Velocity 515 meters (700 knots) / second max
      Acceleration: 4 G, max
      Jerk: 20 meters/second, max
  • Antenna Type: Built in Patch Antenna
  • Minimum signal tracked: -159dBm
  • Dimensions: 74 x 25 x 14 mm
  • Operating temperature: -40 to +80
  • Storage temperature: -45 to +100
  • Operating humidity: 5% to 95% No condensing.
  • Power consumption: < 80mA at 4.5- 5.5V input
  • Protocol and interface
      NMEA output protocol: V.2.2
        Baud rate: 4800 bps
        Data bit: 8
        Parity: N
        Stop bit: 1
      Interface: USB port
  • Color: Blue
  • Manufacturer Ref: ZMZP1KZL0U

Product Notes

  • **This model is compatible with most brands of GPS software - however hardware specific software such as Garmin may not run on this unit. the manufacturer provides the GPS-enabled hardware only, not the software. No warranty or customer support regarding GPS software. Any software installation you undertake should be performed or supervised by a professional.

Package Contents

  • Model CVGI-B07 GPS Receiver USB Adapter
  • CD (English user guide; drivers for Mac, Linux, and Windows operating systems; GPS testing software)
  • USB cable
  • Display/storage box