Skip navigation
1 2 Previous Next


29 posts

Setting up the system

Posted by pvalyk Oct 15, 2015

     First off, let say thanks for being part of this project. Sorry for the late post.

     A couple of weeks ago I started assembling my project. For starters I choose to setup just the GPS module. The LCD display will come after. I put the system on my fridge, right near the wifi router.



     When I first booted into latest version of Raspbian I ran the Configuration menu . In Advanced Options>Serial  set disable serial. I rebooted, and the ran:

Screen Shot 2015-10-07 at 7.54.32 PM.png

sudo apt-get update && sudo apt-get upgrade


Screen Shot 2015-10-07 at 7.54.16 PM.png

sudo apt-get install python3-microstacknode



 sudo apt-get install gpsd gpsd-clients python-gps

Screen Shot 2015-10-07 at 8.38.05 PM.png

     Then I comment out the following line in /etc/inittab by putting # in front of it so that it goes from this:

#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100


     And remove all references to ttyAMA0 in /boot/cmdline.txt so that it goes from this:


dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2


     I removed console = tty1 too.

     Now I configured GPSD:

 sudo dpkg-reconfigure gpsd


     -Choose Yes for automatically start gpsd.

     -Choose No for “should gpsd handle attached USB GPS receivers automatically”

     -Enter /dev/ttyAMA0 when asked “Device the GPS receiver is attached to”

     -Choose default for the other options.

sudo poweroff


     I unplugged the Raspberry Pi and attached the GPS module.

     My first mistake was that I replaced the GPS antenna with a wifi antenna or did not attached an antenna at all. That didn’t got any fix on satellite.

     I attached the antenna from the kit and got gps location.

     Now I ran

sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock


cgps –s


     and got the latitude and longitude of my location.


     Use this as a great resource:


     To follow: load saved locations and display on the screen. I got a problem with module's switch. It came broken. Any Ideas?


A few weeks since the last post, mainly due to the tenacious cold & flu-like bug circulating around the family. Since that's now gone I was keen to look at more GPS coding on the Pi.


My last attempt had reading of the serial port running fine until it was interrupted, then it produced errors on reading caused by the serial stream being read off of a character boundary.

Furthermore once the stream has been read for a while it then only produced 8 or so characters per read - pointing to a buffer starvation as the read terminated before the characters from the GPS could be read in. Both of these were fixed by treating the GPS as a serial stream device with a defined timeout:


gpsStream = serial.Serial(gpsDevice, 9600, timeout=1)


At this point I wanted to auto-mount my USB device so I edited the /etc/fstab and added a line for the USB drive, now this mounts automatically.

Then being conscious of the need to keep software up to date I then performed a apt-get update/upgrade cycle, noting that the microstack code was listed among the packages being updated.


Bad move. Once the new software had installed my code now refused to run - an error being reported at the GPS module import...


import microstacknode.gps.l80gps


and saying this module could not be found.

After an hour or so of googling this and not getting anywhere I had a look inside the /usr/lib structure where all of these libraries live and found the microstacknode folder area.

I noticed that the folder path to the l80gps module included a 'hardware' folder that wasn't represented in the import path.

Sure enough once I changed the import statement to:


import microstacknode.hardware.gps.l80gps


... and the code once again ran happily. I have no idea if the update actually changed anything in the folder path - all I know is that it ran OK prior to the update and didn't afterwards until I made the change to the import statement, so if this also happened in your project that might help you out.


Now I was able to modify and debug the code to watch for an active fix, extract the lat and long and save these to a file for the client to inspect as well as display these on the LCD. At the same time I experimented with using the piFace switches so that rather than killing the code from a Ctrl-C I can now exit gracefully by pressing a LCD board button. All pretty much Pi-101 I'm sure for most but new to me and useful in working out what I can and can't do with this set of boards.


This means that the GPS interface code is fairly complete for now and I need to remove its access to the LCD and package it up to be run automatically when the Pi boots. It will write its results to a file for the client to read. It also writes a log file to the USB so that if I ever need to see what the GPS is outputting I have a trace of that (and with a 64GB USB stick to play with there's plenty of space for logs!).


The next job is to think more about what the GPS client is going to look like. Like some of the other examples I'm thinking of reading in a list of caches and allowing the user to select one using the switches on the LCD board, whereupon the distance to the cache will be calculated. This is where I might add some electronics to display a LED bar graph based on the distance to go once the unit is within, say, 50m of the cache. I'll think some more about that and post something next week...

Original article at:


Here are the updates:

I’ve bought an extender for the RP pins from Jola Engineering and soldered the shim onto it. Now I can put everything together nicely.

After that I’ve started playing with the PiFace using the pifacecad library.



The initial test was just to show stuff on the screen, and then I wanted to use the buttons to do something with them, but…. apparently, I couldn’t. It seems that the Linux kernel 4.1.6-v7+ on the latest Rasbian, has a bug with the epoll system call that causes it not to react to hardware interrupts on GPIO25 (RP pin 22).

More info and explanation can be found in this bug report.

Here’s the sample code I’ve used from the pifacecad documentation:

>>> import pifacecad
>>> def update_pin_text(event):
...     event.chip.lcd.set_cursor(13, 0)
...     event.chip.lcd.write(str(event.pin_num))
>>> cad = pifacecad.PiFaceCAD()
>>> cad.lcd.backlight_on()
>>> cad.lcd.write("You pressed: ")
>>> listener = pifacecad.SwitchEventListener(chip=cad)
>>> for i in range(8):
...     listener.register(i, pifacecad.IODIR_FALLING_EDGE, update_pin_text)
>>> listener.activate()

Because of this, I’ll put the piface on the side for now and continue to play with the GPS module.

I’ve yet to find a good battery that I can use, to make the RP portable.


Previous posts:


An Ill Wind...

Posted by dmedlow Sep 14, 2015

Alas winter has hit the old homestead hard, with most of the family down with or recovering from variations of head, chest and other colds.

Hence not much fun stuff happening.....


However I did start thinking about how to get diagnostic info to a gps client program, and again came to the conclusion that it still might be better to read the gps stream myself as the other parsers generate errors without a fix present. So I modified my last software to add more diagnostic info to a file and took the GPS board for a walk. Within about 30 seconds a valid fix was reported and all seemed to be well, except that the LCD froze and didn't display the (expected) location information. Initially I thought this was my code doing something unexpected so I brought the unit indoors and plugged it into the monitor.


It turns out that a Python exception had occurred so the code was no longer executing. The exception was easy to fix but it highlighted that the LCD buffer continues to display what it was last sent and will continue to display that data even if the PI is shutdown. Therefore any code writing to it should have a high level exception handler and closing code to gracefully clear the display and power off the backlight. I'm new to Python and will need to think about how to do this elegantly and will try to incorporate this in the next version.

Having now resolved (hopefully) the hardware issues with the GPS and display mounted simultaneously it was time to check out the GPS reception and ensure that I was seeing good NMEA data on the serial interface.

My problem is that the area where I do most of the experimentation has no close area where GPS signals would be available, and the Pi display currently is shown on a large 27" display I can't relocate.

The solution of course is to use the Pi LCD display as there are Python libraries to write to this. But I need to display something meaningful on the LCD - I picked the number of satellites available as the data for this - it doesn't mean you have a fix, but it does indicate if your GPS receiver is able to receive the sat's signal.

# Simple routine to read GPS data from the serial stream and search for
# the number of sats in view in the GPGSV sentence.

import sys, math, time
import microstacknode.gps.l80gps
import pifacecad


while a:
    with open("/dev/ttyAMA0") as gpsData:
        for line in gpsData:
            sentence = line.split(',')
            if (sentence[0][:6] == '$GPGSV'):
                cad.lcd.write("Sats= " + sentence[3])


Therefore I wrote a small program that read from the GPS library and displayed the output. Unfortunately these libraries raise exceptions when a GPS fix is not available. (To me this is not a good thing, these libraries should be a little more defensive. For instance if you ask for the GSV data (GPS Satellites in View) with no fix the library effectively gets an array out of bounds exception as the GSV sentence returns less data points when there is no fix.)


The next best thing was to read the NMEA serial port (/dev/ttyAMA0) directly as a file. A few versions later I had something that would start-up, read the NMEA stream, look for a $GPGSV sentence header, decode it and report the number of visible satellites on the Pi LCD display. Running this via a battery box USB supply allowed me to take the entire assemblage outside and check that yes, indeed I was seeing one, 2, 3, ... up to 10 satellites using the high gain antenna.


Therefore I was happy I can accept input from the GPS and will probably go back to using the gps client libraries but I will have to trap exceptions when a fix isn't available. However the libraries do do a lot of the heavy lifting with respect to data element decoding. This is what others have done in their code and this exercise helped me to understand why that was needed.


The other interesting thing was that after some time I found my 4xAA battery box could no longer support the PI, to the extent it would refuse to boot. This was only after ~1.5 hours of use, so I am curious now as to the power consumption of the Pi, GPS & LCD configuration. At some point I'll put my meter on this to measure it.


Next step is to store the GPS data in a file and make this process auto-running in the linux environment. Then I can move the LCD display code to a client process that interrogates the data file.

I was quite happy to get the Pi LCD display working by following the blog posts, but was disappointed to find that when I had both the MicroStack GPS module and the Display Board connected, the GPS Board stopped working. By a few elementary tests this was found to be caused by the shim board power connections (and probably data as well) not making positive connection on the side connector (the one to which the GPS was connected).


A number of others have commented on this and the solution seems to be to solder the shim onto a 2x20 pin header. I duly went out and procured same, soldered on the shim and, voila.. working GPS on the side connector. On reflection the shim idea is probably OK if it works for people, but I think it is a solution that relies too much on the vagaries of the mechanical setup of the boards on the Pi. Supplying the shim kit with the aforementioned header would resolve the problem.


Now I can progress with writing some software - however an idea occurred to me that in addition to the display, you could also utilise a LED bar graph that is slaved to the distance from the cache point - a kind of 'getting hot, getting cold' indicator that might be more fun for the junior cachers rather than reading GPS coordinates. I'll think about adding that a bit later and see how well it works.

Today was spent soldering the Pi Shim and finding out exactly how bad my soldering skills were. Overall though not too bad and once completed it was time to mount the GPS on the microstack and the subassembly onto the Pi.


Once powered up I followed Charles Mao's second Geocaching blog post (link)  and updated the O/S, PI firmware and installed app software. Unfortunately I missed a step which was to cause some pain later...


After configuring the GPS Daemon and rebooting the system I looked at the port the GPS was supposed to be outputing text on (/dev/ttyAMA0) and found nothing. Not to be deterred I powered down, removed the shim and tried again... nothing. Powered down again, looked carefully at the config, ensured the microstack was located correctly and the GPS daughter board mounted correctly and tried again... nothing.


Hmmmm. At this point I remembered reading the MicroStack documentation about the GPS Board. I went back and followed their instructions to see if there was anything there that might shed light on the problem. Their instructions included using the config utility to turn off serial port access to the Pi ( the step I had missed earlier). I did that and rebooted the Pi and ... voila... NMEA strings pouring out of the serial port...


So the moral of this story is (1) follow the posts of others more carefully and (2) sometimes looking at other documentation can give you a lead on what you might have missed.




Anyhow the GPS hardware is now up and running (with the patch antenna) and the software loaded for a Python dev environment, next step (for me as a non-Python person) is to run through the dev process with some simple apps to read the GPS data.

In Part II: OS Configuration and Software Installation & Update, I showed how I configured the OS and installed software. In this part III, I will show the problem of SHIM and how I made it work.


To test the kit, I first tried cgps program a few times and each time the program timed out and quit in a couple of seconds. Basically there was no GPS fix at all.



Then I tried to print GPS message but still no luck. I issued poweroff command to brought down the kit and started trouble-shooting.



The first thing I did for trouble-shooting was remove the PiFace and still didn't get a fix.



Next, I directly plugged Microstack baseboard onto GPIO pins. And I got the first GPS fix after powering up the kit for a while.



At this point, I was convinced that I had the same SHIM issue like others had. To solve the problem but not touch the Pi2, I ordered a connector (ESW-120-14-G-D from Samtec) and soldered the connector on the SHIM board.



Put all things together and powered the kit up and got GPS fix in a few seconds.



Next, a quick test with the PiFace



Up to this point, I am confident my kit is ready for the fun of programming. If you have any question or comments about my step by step building process, please post below. Thanks for your reading.


Getting Started

Posted by dmedlow Aug 16, 2015

Finally got to unboxing the hardware and seeing what was supplied for the geocaching build.


The Pi2 looks good, particularly with the additional USBs and the reduced footprint with the micro-SD card. I mounted the Raspberry on a board that I can use as a prototyping platform until I decide what the physical packaging of the end result is. Using a wireless keyboard/mouse (logitech) allows more physical flexibility. Its awesome how much processing capability is now available in the platform of that size.


The Pi is very easy to set up with the supplied SD software. Charles Mao has documented this very well (see It all fired up first time without a problem...


First time the PI Powers up.


In addition to his steps I added a spare WiPi USB 802.3 dongle to enable wireless comms. This requires you to edit the interfaces file in Linux which takes about 5 minutes and restart the networking processes. Once up I was on the net and able to update the Raspberian software (only 173 MB). This is clearly a faster platform than the previous P'is I've owned.


I initially wasn't sure which way to solder the Pi Face Shim (but the other blog posts have made this clearer) and will be looking at this job next, along with mounting the GPS & Display and loading the necessary drivers for the display & GPS. I will be looking at other postings for guidance on the best dev environment to use. The final application for the kit is still not clear, but now that I am clear on the hardware supplied I can start to consider the options.

In the first part Step by Step Building the Raspberry Pi 2 GPS Geocaching Kit - Part I: Put Hardware Together, I recorded how I put the hardware together step by step. In this part, I will show the basic OS configuration and software installation & update.


After the first time boot-up completes, the Pi 2 will automatically run raspi-config program (you can always run this program again after first time boot-up by typing command sudo raspi-config). In this configuration interface, you can customize the locale settings, password, enable/disable some peripherals, etc.


I think Raspbian has been installed on the MicroSD card came with the kit, so you don't need to expand file system. If you try to do it, it will give you a message like this


The default user name is "pi" and password is "raspberry" (without the quote signs). You can change the default password by typing new password twice as shown in the bottom left corner of the second picture below.

You can choose the OS boot into Desktop or Console interface. I chose Desktop option as shown below.


You can customize your locale, timezone and keyboard layout (entering items 4 in the first picture of this blog).


I did overclock to Pi 2 option.


I also customized a few advanced options. First, enable SSH


Next, I enabled kernel automatically load SPI module


I also enabled automatically load I2C module


The last OS configuration was disable login shell on serial port


After OS configuration, the program will ask for a reboot.


After reboot, the desktop showed up. If you chose boot into console mode, the desktop won't show up. Instead, a login console shows up.


Next, I opened a terminal window and started upgrading the OS by typing the following commands in sequence (some commands may take a long period of time to complete).

sudo apt-get update

sudo apt-get upgrade -y

sudo apt-get dist-upgrade -y

sudo rpi-update

sudo reboot



After reboot, I installed python3 and other GPS support software, etc. Then reboot again after the software installation completed.



Next, configure gpsd and reboot again.




Up to this point, all software installation and update is completed. In part III Step by Step Building the Raspberry Pi 2 GPS Geocaching Kit - Part III: Trouble-shooting and Get It Work, I will show how I test, trouble-shoot and get it work.

Thanks to the Geocaching community and Christopher Stanton. I am one of the Winners of  10 Raspberry Pi 2 GPS kit. The kit arrived at my front door on Aug. 7th, 2015. Since then, I followed Chris' blog Putting Together the Pieces - Raspberry Pi 2 GPS Geocaching Project and built up my kit. In general, it's a quite smooth process except like many others, I ran into the SHIM connection problem as well. In this blog, I will show my procedure step by step with lots of pictures and screen captures (I don't have a HDMI monitor, so I used my HDTV as the display).


The kit came in within a neat package.



A white 5V 2A output power adapter with changeable world-wide plugs is included. I changed the plug to North American version (push down the cutout section to release the plug from the adapter).



Raspberry Pi 2 has a printed manual in 16 different languages.



The kit includes a SHIM board which can be used to connect a Microstack GPS module (on top of a Microstack Baseboard) to the GPIO pins with a male-to-male connector.



I soldered the male-to-male connector on the SHIM board and plug the SHIM onto GPIO pins. Like other people reported, the connections between SHIM and GPIOs weren't reliable. Keep reading and I will provide a solution.



Plug the GPS module on top of Microstack baseboard and plug the baseboard into the male-to-male connector.



Plug the PiFace on top of Pi 2



Check the UFL to SMA RF cable - conductivity for both shield and center (I have seen factory problem on this type of cable) and carefully plug the UFL end (UFL connector is very fragile) to the GPS module. Then screw the SMA end to the GPS antenna cable. Please rotate the connectors instead of the wire when you screw two SMA together. Otherwise, too much tension on the wire may damage the UFL connector at the other end.



Plug USB adapter for wireless keyboard and mouse, HDMI cable, Ethernet cable and microUSB power plug. Then power it up.



Continue on Step by Step Building the Raspberry Pi 2 GPS Geocaching Kit - Part II: OS Configuration and Software Installation & Update

For those of you who want to get into lower level programming and high speed applications, c++ is a magnitude faster than Python.  Especially when it comes to parsing NMEA strings.  At 1hz 9600 baud the performance gain isn't noticeable, but going up to 115200 baud with updates 2-3 time per second I think python will start lagging.


I have written a C++ library by porting the TinyGPS++ from arduino over to the Pi.  I used PThreads so that the library is multithreaded and will take advantage of all those cores the Pi 2 has.


Please have a look at my blog and I am glad to help with tech support.  I am using the library for my quadcop_project in the sci fi your pi contest.  Basically create a GPS object, start it, and off it goes.  It reads directly from the Serial port, not GPSD.  it is currently In the beta stage and some parameters have to be changed in the code such as baud rate, but when finished this will be easily changeable.


Microstack GPS - A Multi-threaded approach for GPS users.


Also check out bobalexander's post here for setting up the Micrstack and changing the settings.

If you want to use your GPS for more real time applications or for doing some software accuracy improvement you will most likely need a higher output speed.

To get a higher output speed from the L80 GPS module you need to increase the rate/frequency. The default is 1Hz or 1 PPS (pulse per second - for timing applications).

This gives you 1 NMEA coordinate sentence per second (GPGLL - Lat/Lon).

All of these echo commands are performed from the Linux shell/bash prompt.

First, Set Baud Rate

To be able to go above 1Hz you will need to switch to a higher baud rate:

echo -e "\$PMTK251,57600*2C\r\n" > /dev/ttyAMA0

Supported speeds are:


Don't forget to update your tools connection speed to 57600!

    For example /usr/lib/python3/dist-packages/microstacknode/gps/ (line 47)


To go back to 9600bps:

echo -e "\$PMTK251,9600*17\r\n" > /dev/ttyAMA0


Second, Set NMEA Update Speed

This will set the GPS to send 5 pulses per second (5Hz):

echo -e "\$PMTK220,200*2C\r\n" > /dev/ttyAMA0

For some reason I didn't need to change my TTY speed to execute this command even though the GPS should now be in 57.6kbps mode and the terminal *should be* at 9600.

To confirm the change, you can watch the data in Minicom both before and after; just make sure you change the baud rate or you will just see garbage.

If you are having problems perhaps you will need to change the baud on your console?

stty -F /dev/ttyAMA0 57600 clocal cread cs8 -cstopb -parenb


For reading serial port settings use:

stty -F /dev/ttyAMA0 -a

Mine reads this:

speed 57600 baud; rows 0; columns 0; line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 0; time = 0;

-parenb -parodd cs8 -hupcl -cstopb cread clocal -crtscts

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8

-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke

I have no idea what it was set to before I started. Perhaps it is auto detecting? I doubt it.




Note: According to the datasheet a cold boot (if the GPS loses power and the backup battery is dead or not present) the baud rate and output frequency will go back to the default.

To do this right and make it permanent/reliable, the commands should probably be written into your program or added to the library and ran as part of the initialization/setup routine.

The fact that this is a volatile setting makes me think this is only written to RAM and therefore setting it each time the program runs (once) shouldn't do anything adverse such as prematurely wear out an EEPROM/flash chip.


Other update rates:

100mHz  "$PMTK220,10000*2F" // Once every 10 seconds, 100 millihertz

200mHz  "$PMTK220,5000*1B"  // Once every 5 seconds, 200 millihertz

1HZ  "$PMTK220,1000*1F"

5HZ  "$PMTK220,200*2C"

10HZ "$PMTK220,100*2F"

If you want to keep a lower baud rate and still increase the frequency you can try removing some of the unneeded NMEA sentences and just spit out the relevant position data.

These are the default messages the L80 is spitting out:













Microstack™ GPS Reference

PMTK command packet reference

Handy Adafruit GPS.h file

NMEA data

Raspberry Pi Geocaching System (Pi Hiker)

Author: Bob Alexander

A kid friendly, high accuracy geocaching platform.

  • Accuracy of the GPS location could be improved by putting the L80 into 10Hz mode and then performing an averaging and filtering function such as outlined in this paper:

          An Effective Approach to Improving Low-Cost GPS Positioning Accuracy in Real-Time Navigation

  • With the addition of a magnetometer, a direction indicator could be added that would not be dependent upon movement to show the target azimuth.
  • We would utilize our Makerspace's 3D printer to print an enclosure for this platform to sit in such that it could be used by children.
  • I think the Pi 2 is a good candidate for this project as it should have the horsepower to perform the averaging function and be able to utilize a database of geocaches downloaded before the trip.


Received notification that I won a Raspberry Pi 2 GPS kit from Christopher Stanton on July 17th 2015.

Received kit in mail August 4th 2015.




Look at all the goodies!!


Starting to assemble...


I soldered the right angle header pins to the PiFace GPIO Duplication Board Shim and tacked the shim in place on the Raspberry Pi 40 pin header board by soldering the four outermost pads as I applied pressure against the shim. It was a little loose and didn’t maintain good contact without this. Yes, I soldered the pins on the wrong side and the silk screen is backwards. Oh well. A quick assembly sheet would be nice to prevent this as it wasn’t obvious to me - NOOB!


The footprint is a lot bigger than I expected! How am I going to house all this?!

The Microstack is definitely a nice system for prototyping but I don’t think it will work for a ‘finished’ project.

Ben Heck style chopping/hacking in store?


Maybe a game pad style case will accommodate the assembly as is? It will need to accommodate a 1S 3.7V battery - perhaps a 5,000mAh.



Connected to GPS antenna sitting on the window sill. Retractable reel for the GPS antenna?


Ready to power up! Note the DVI-HDMI adaptor for my DVI only monitor.


It works!


After downloading the PiFace Control and Display software and enabling the SPI bus I ran the sysinfo demo.


Just a quick tweak and it displays my local weather!

August 5th 2015: GPS testing

Following along with Christopher Stanton’s blog:

Putting Together the Pieces - Raspberry Pi 2 GPS Geocaching Project

After not having luck with

cat /dev/ttyAMA0

and ‘cgps -s’ just returning “cgps: GPS timeout”

I unplugged the PiFace CAD and moved the GPS Microstack to the direct connection instead of going through the shim (after powering off the pi).


After booting back up and waiting for the GPS to initialize, I reran ‘cgps -s’ and BINGO!


│    Time:       2015-08-06T02:07:10.000Z   ││PRN:   Elev:  Azim:  SNR:  Used: │

│    Latitude:    3X.650558 N               ││  15    78    169    41      Y   │

│    Longitude:   7Y.667636 W               ││  20    71    001    32      Y   │

│    Altitude:   214.9 m                    ││  21    45    311    29      Y   │

│    Speed:      0.4 kph                    ││  29    44    220    36      Y   │

│    Heading:    252.9 deg (true)           ││  18    26    274    36      Y   │

│    Climb:      0.0 m/min                  ││  24    08    163    00      N   │

│    Status:     3D FIX (1 secs)            ││  43    00    000    00      N   │

│    Longitude Err:   +/- 173 m             ││                                 │

│    Latitude Err:    +/- 20 m              ││                                 │

│    Altitude Err:    +/- 478 m             ││                                 │

│    Course Err:      n/a                   ││                                 │

│    Speed Err:       +/- 1251 kph          ││                                 │

│    Time offset:     -0.511                ││                                 │

│    Grid Square:     FM08pp                ││                                 │


Now, I just need to troubleshoot the shim…

Even though I soldered the connector on backwards shouldn’t the one for one pinout be the same? Or, maybe the serial port connections are not making contact?

Time to ohm it out and check!


Nope, pinout is fine - but the gap around the solder pads on the shim and the pins themselves seems to be too big and is not making a connection with the board.


This is probably a symptom of me soldering the right angle pins on the wrong side of the shim. Perhaps the holes drilled and plated on the other side of the shim (where the right angle pins are now) are smaller? Rather than desolder the shim/header pins and do it all over again (never have had much luck desoldering right angle pins without destroying the board and the pins) I just soldered the shim VERY carefully to the Pi’s headers with a tiny amount of solder so as to not interfere with the rest of the GPIO pin on the board itself. I want it to be reliable and at least somewhat durable anyways! A quick run through with the continuity tester verified this fixed the problem.


Reassemble and power back up the system and continue with the testing!

The cgps command checks out - I get a fix! 

Running the weather python script displays the data to the screen but it isn’t acting the same. The buttons/city toggle aren’t working now! 

Unplugging the microstack/GPS module doesn’t seem to help matters any.

Looks like more troubleshooting is needed. Perhaps the shim/my soldering is preventing the CAD from seating all the way? It looks fully seated.

Running through the print(cad.switches[x].value) in Python while toggling the switches seems to be working fine. I’m not sure what has changed at this point as all of the buttons seem to be working but the demo program is not.  Moving on!

August 6th 2015: GPS output to LCD screen


Microstack GPS and Piface Control and Display Geocaching by callum smith

This code will simply get the coordinates and time from the GPS and display them on the LCD:

#!/usr/bin/env python3
Grab data from GPS and spit it out to LCD

import sys
PY3 = sys.version_info[0] >= 3
if not PY3:
    print("Please use `python3`.")

###import libraries and set up gps
from time import sleep
import pifacecommon
import pifacecad
import sys,math,time,microstacknode.gps.l80gps
cad.lcd.write("Obtaining pos...")

while True:
    while current_pos==False:
      try:          # try command used to prevent crash when no response from GPS
          current_pos=gps.gpgll          # gets current GPS position
      except (microstacknode.gps.l80gps.DataInvalidError, microstacknode.gps.l80gps.NMEAPacketNotFoundError):          # if no GPS response or if response is invalid
          time.sleep(1)                    #pauses before retry to connect to GPS
          cad.lcd.write("No GPS Lock\nTry moving or check ant")
    time.sleep(1)                    #pauses before looping to allow user to read output
    #cad.lcd.clear()  #will cause flickering but will ensure no mess is left on screen

August 12th 2015:

This code will grab the coordinates from the GPS and stick them into an array. Once 10 values have been accumulated it will spit out the average and standard deviation.

This is a VERY basic averaging and not the permanent or intended method of obtaining a 'high accuracy' reading. In this mode it takes 10 seconds for the averaging, I intend to speed up the GPS output to 10Hz which will give a simple average once per second.

The goal of this method is to provide a baseline (which will be logged to a CSV file by the Pi) to compare methods of obtaining a highly accurate location.

This method will be called 'Simple Averaging' and will be compared with 'Recursive Averaging', the Kalman filter, the Wiener filter, autoregressive-moving average (ARMA), and the method outlined in the paper referenced above which improves position while moving. Once the data from these methods is graphed I will decide which method to implement for the geocaching tool.

#!/usr/bin/env python3
Grab data from GPS and average it
ToDo: Log to csv for processing

import sys
PY3 = sys.version_info[0] >= 3
if not PY3:
    print("Please use `python3`.")

###import libraries and set up gps
from time import sleep
#from threading import Barrier
import numpy
import sys,math,time,microstacknode.gps.l80gps
lat_pos = numpy.zeros(10)
lon_pos = numpy.zeros(10)

while current_pos==False:
    try:          # try command used to prevent crash when no response from GPS
        current_pos=gps.gpgll          # gets current GPS position
    except (microstacknode.gps.l80gps.DataInvalidError, microstacknode.gps.l80gps.NMEAPacketNotFoundError):          # if no GPS response or if response is invalid
            time.sleep(1)                    #pauses before retry to connect to GPS
#print(current_pos)                                # for debugging
while True:
    if count == 9:
        print(lat_pos)#+" STD: "+numpy.std(lat_pos)                                # for debugging
        print(lon_pos)#+" STD: "+numpy.std(lon_pos)                                # for debugging
        print(numpy.mean(lat_pos, dtype=numpy.float64),numpy.std(lat_pos))                                # for debugging
        print(numpy.mean(lon_pos, dtype=numpy.float64),numpy.std(lon_pos))                                # for debugging
         count += 1
    try:          # try command used to prevent crash when no response from GPS
        current_pos=gps.gpgll          # gets current GPS position
    except (microstacknode.gps.l80gps.DataInvalidError, microstacknode.gps.l80gps.NMEAPacketNotFoundError):          # if no GPS response or if response is invalid
            time.sleep(1)                    #pauses before retry to connect to GPS
#    print(count)



Next step is to implement data logging and then the other methods of improving position.

  Getting excited to let this TB loose in the big wide

Open world. Here it is all dressed up. Have set the

Goal to travel to Wanaka to experience the beauty

Of New Zealand. Maybe I can meet it there one