It may be helpful to discuss a few details about the initialization and output of the Seeed GPS Module for .NET Gadgeteer. The first time I tried to use this module, I wasn’t patient enough to let the device initialize and start producing data.
This example uses the Seeed GPS Module and prints to the Debug output window of Visual Studio. Add the GPS module in the Designer window like this:
The following code simply writes output to the debugger, but don’t expect it to start in thirty seconds.
using Microsoft.SPOT; using Gadgeteer.Modules.Seeed; using Gadgeteer.Modules.Sytech; namespace GPS_CellularRadio { public partial class Program { // This method is run when the mainboard is powered up or reset. void ProgramStarted() { gps.PositionReceived += new GPS.PositionReceivedHandler(gps_PositionReceived); gps.NMEASentenceReceived += new GPS.NMEASentenceReceivedHandler(gps_NMEASentenceReceived); button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed); Debug.Print("GPS enabled? " + gps.Enabled.ToString()); Debug.Print("Program Started"); } void button_ButtonPressed(Button sender, Button.ButtonState state) { if (button.IsLedOn) button.TurnLEDOff(); else button.TurnLEDOn(); } void gps_NMEASentenceReceived(GPS sender, string nmeaSentence) { if(button.IsLedOn) Debug.Print("NMEA Sentence: " + nmeaSentence); } void gps_PositionReceived(GPS sender, GPS.Position position) { Debug.Print("Latitude: " + position.LatitudeString + " Longitude: " + position.LongitudeString); } } }
The first thing you are likely to see in the output window after the program starts is a series of NMEA Sentences:
The thread '<No Name>' (0x2) has exited with code 0 (0x0). Using mainboard GHIElectronics-FEZSpider version 1.0 GPS enabled? True Program Started NMEA Sentence: $GPTXT,01,01,02,u-blox ag - www.u-blox.com*50 NMEA Sentence: $GPTXT,01,01,02,HW UBX-G60xx 00040007 FF7FFFFFp*53 NMEA Sentence: $GPTXT,01,01,02,ROM CORE 6.02 (36023) Oct 15 2009 16:52:08*56 NMEA Sentence: $GPTXT,01,01,02,ANTSUPERV=AC SD PDoS SR*20 NMEA Sentence: $GPTXT,01,01,02,ANTSTATUS=DONTKNOW*33 NMEA Sentence: $GPRMC,,V,,,,,,,,,,N*53 NMEA Sentence: $GPVTG,,,,,,,,,N*30 NMEA Sentence: $GPGGA,,,,,,0,00,99.99,,,,,,*48
There are so many of these statements that I added the button to turn them off after a while so you can see the position statements without the continuous stream of NMEA Statements.
void button_ButtonPressed(Button sender, Button.ButtonState state) { if (button.IsLedOn) button.TurnLEDOff(); else button.TurnLEDOn(); } void gps_NMEASentenceReceived(GPS sender, string nmeaSentence) { if(button.IsLedOn) Debug.Print("NMEA Sentence: " + nmeaSentence); }
It may take fifteen minutes after you start the program for PositionRecieved events to start. Then you can push the button to stop the NMEA Statements. The position statements will look like this:
Latitude: 4740.56880 N Longitude: 12206.67188 W Latitude: 4740.56813 N Longitude: 12206.67063 W Latitude: 4740.56727 N Longitude: 12206.66911 W Latitude: 4740.56681 N Longitude: 12206.66839 W Latitude: 4740.56616 N Longitude: 12206.66734 W Latitude: 4740.56365 N Longitude: 12206.66310 W
The key to using the numbers in Bing or Google mapping or Google Earth is noting that North (N) and West are positive from the equator and the Prime Meridian, Greenwich, UK. To use the numbers in Google Maps, separate the last two digits before the decimal point from the earlier digits and put a minus sign before the Latitude if it is below the equator, and a minus sign before the Longitude if the position is west of Greenwich.
47 40.56880,-122 06.67188 47 40.56813,-122 06.67063 47 40.56727,-122 06.66911 47 40.56681,-122 06.66839 47 40.56616,-122 06.66734 47 40.56365,-122 06.66310
Using these coordinates in Bing Maps has the following result:
#1 by zazkapulsk on May 15, 2012 - 10:04 AM
Michael, great site. Simple language, straightforward application. Thanks.
It seems strange that the GPS module doesn’t provide altitude as well. Besides using a brometer (which is not good enough for control), any ideas how to analyze the altitude of a Gadgeteer-build thingy?
Thanks
Gabriel
#2 by Michael Dodaro on May 15, 2012 - 10:27 AM
Have you seen this example?
http://www.netmf.com/showcase.aspx?ShowcaseID=2&id=197
#3 by zazkapulsk on May 15, 2012 - 10:32 AM
Yup, but I’m trying to build a quadrocopter, and the wind from the propellers and the ambience will screw up the barometric readings…
Real strange about the altitude reading in the GPS.
#4 by Michael Dodaro on May 15, 2012 - 10:34 AM
The word on the street is that the GPS module is being upgraded. You might get some discussion on the Seeed Web site.
#5 by zazkapulsk on May 15, 2012 - 10:36 AM
Molte grazie