Propeller Based Handheld GPS with Full Code
WBA Consulting
Posts: 2,934
This thread will contain all the code and details for the handheld GPS that I had on my table at UPEW. I have been meaning to post this for others to have access to the code and just kept forgetting. Let me start by stating that 100% of the code was created and/or compiled by forum user Abel for his handheld GPS. He has since moved on to iPhone programming, but I was able to get him to dig out the code from his archives and email it to me.
[post=711079]Abel's Handheld GPS[/post] consisted of a Propeller Demoboard, Serial GPS module, and the 4DSystems uOLED-128-G1 in a case with four AA batteries.
http://forums.parallax.com/discussion/comment/711079/#Comment_711079
His code works very well and utilizes 7 of the propeller's 8 cogs. He stopped working on the code before he implemented the serial input from the keypad, so the destination coordinates are hardcoded in the code so that the directional/distance calculations can still work.
Attached is the zip file that Abel sent me that has all of his code for the GPS. There are helpful comments here and there. The program I have loaded into my unit is the "GPS_uOLED II.spin". Also in the zip file and attached here, is a schematic that he threw together for what would have been his second version using a Propstick USB.
The code refreshes the display by doing a full screen erase and full screen write, so there is a noticable screen blanking once every 2 seconds. Obviously this could benefit from some optimization. Also, updating the code with working keyboard input would allow you to input destination coordinates on the fly which would make this ideal for Geocaching.
My version of the Handheld GPS is in the next post
[post=711079]Abel's Handheld GPS[/post] consisted of a Propeller Demoboard, Serial GPS module, and the 4DSystems uOLED-128-G1 in a case with four AA batteries.
http://forums.parallax.com/discussion/comment/711079/#Comment_711079
His code works very well and utilizes 7 of the propeller's 8 cogs. He stopped working on the code before he implemented the serial input from the keypad, so the destination coordinates are hardcoded in the code so that the directional/distance calculations can still work.
Attached is the zip file that Abel sent me that has all of his code for the GPS. There are helpful comments here and there. The program I have loaded into my unit is the "GPS_uOLED II.spin". Also in the zip file and attached here, is a schematic that he threw together for what would have been his second version using a Propstick USB.
The code refreshes the display by doing a full screen erase and full screen write, so there is a noticable screen blanking once every 2 seconds. Obviously this could benefit from some optimization. Also, updating the code with working keyboard input would allow you to input destination coordinates on the fly which would make this ideal for Geocaching.
My version of the Handheld GPS is in the next post
Comments
Pictures of the outside case (Front, close up of display, side with power switch, and side with USB port):
The top end showing how things are stacked "neatly" inside and it partially opened:
The GPS laid out and a zoom in of the GPS and uOLED connections:
Showing how nicely the Propeller Platform form factor fits perfectly into the Polycase VM-36 case:
-Phil
Quick video of the inside
Quick video of the front while it is on
Album link of the rest of the pics.
I've got a project in mind similar to this that I was hoping to get some feedback on: Bought my Grandpa's last old Jeep, a 1946 Willy's CJ2A, and the speedometer doesn't work. After engine & transmission swaps, plus lift and larger tires, even if I got it working again or replaced it, no chance it would be accurate without a speedo gear change as well.
I've toyed with the idea of a drop-in replacement GPS speedo that they sell for refurbing old cars, etc, but ultimately I'd like more info than just MPH if I'm going to have a GPS in there. Here was my thought:
A small screen like you have here, displaying a compass with N,S,E,W on the edge of the circle and a pointer for current direction of the Jeep compared to N on the circle.
MPH - speed over ground from GPS
Trip Meter A - push button to reset at beginning of trail for overall distance
Trip Meter B - push button to reset between way points
Possibly altitude for plotting on topography map later? - I think most GPS output altitude fairly accurately
Would this be pretty doable with the Prop and Parallax's Waveshare NEO-7M-C GPS?
Also, does anyone know how accurate the "compass" feature of the GPS is, or would I need a separate electronic compass module? I would think it should be fairly accurate, but?
Eventually, it would be pretty sweet to have some kind of a data-logging function to save the GPS coordinates to an SD card every 30 seconds or whatever speed was appropriate, to plot on a map at some point. Then people could see the entire trail in context, and the length of time it took to traverse if desired. (This helps in fuel logistics because MPG doesn't really apply, it's more like gallons per hour burn out there).
First, there will be a delay with the GPS reporting accurate speed when first taking off or making sudden speed changes (like braking for a stop). Not usually a major issue, but something to note.
Second, GPS accuracy will be a factor in determining clean speeds if you use software to determine speed. Speed can be calculated in software, but most NMEA sentences support reporting speed, so that of course would be best/easiest. Keep in mind that speed is reported in knots. Kalman filtering will help greatly with software based speed calcs, but I am not aware of any clean implementations with the Propeller and GPS (but I am sure it's been done already)
Third, GPS update frequency and overall accuracy. The Parallax module is defaulted to 1 Hz which would be fine in most cases, but at least take a look at some modules that report 10x per second like Adafruit's Ultimate GPS breakout so you can determine what fits your needs. HOWEVER, the one Parallax sells, Waveshare NEO-7M-C, does support a 10Hz update frequency according to the User Manual from the wiki, even though the Waveshare Wiki page for the module shows 5Hz. I was unable to locate anything documenting how to change the rate, but a quick Google search came up with this page, that details the configuration is done by Waveshare's U-Center software.
Compass: The GPS heading is only accurate when you are moving, so for a bulletproof directional display, I would add a compass chip. You could only update direction after true movement of the GPS unless you want/need accurate heading when the Willys is sitting still. Based upon the concept of "if you come to a stop heading north, you should remain north until you start moving again".
Trip Meter: With proper filtering of location data, appropriate distance measurements could be made to increment an odometer. However, you need to use data points that are greater than the GPS's positional tolerance. In other words, the NEO-7M-C GPS has an accuracy rating of "2.5mCEP (SBAS:2.0mCEP)" so you should use caution when logging distance for GPS readings less than 2.5m from each other. Using multiple readings, filtering, etc., you could increment the odometer for each distance reading that is over 2.5m so that you are not logging "movement" that is simply the variations in the accuracy of the GPS module itself (typically called "GPS static drift").
As for datalogging, KML logging for use with Google Earth is very easy as seen here. Google Earth can still import KML files even though newer standard formats are preferred (.gpx and .loc). The GPX format is a pretty simple XML structure, so it would not be a major challenge to have the Propeller log to a GPX file instead of a KML file.
1946 CJ2A! Talk about bring back memories, My first car was a 1948 CJ2A that somone had cobbled on an uninsulated aluminum cab. The heater had been removed from under the dash and mounted between the seats. That ment no defroster. Many hours of fun summer and winter!
Jim
Yeah, the CJ2A is something else - major "bare bones", but have done some pretty serious upgrades for wheeling it, so we'll see how it goes!