element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi Projects
  • Products
  • Raspberry Pi
  • Raspberry Pi Projects
  • More
  • Cancel
Raspberry Pi Projects
Blog GPS Success but with a strange Update Issue
  • Blog
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: dmedlow
  • Date Created: 7 Oct 2015 12:26 PM Date Created
  • Views 389 views
  • Likes 0 likes
  • Comments 0 comments
  • raspberry_pi_geocaching
  • raspberry_pi_projects
Related
Recommended

GPS Success but with a strange Update Issue

dmedlow
dmedlow
7 Oct 2015

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...

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube