How to use GPS with DuinoMite
Updated 28-March-2012:
Andrew Rich VK4TEC did his version of this application, and the thread and Video are now posted.

This article is publishing with the help of my friend Mick Gulovsen who edited it and helped me translating it from it’s original Bulgarian-English to Queen’s English 
Global Positioning System (GPS) is a satellite based global navigation system that provides location and time information in all weather, anywhere on (or near) Earth, where there is an unobstructed line of sight to four or more GPS satellites.
You can read more about how GPS was created and how it works in Wikipedia.
Also some theory is available in this web site: http://lea.hamradio.si/~s53mv/navsats/theory.html.
It’s very easy to use GPS with DuinoMite using Olimex’s UEXT GPS module ‘MOD-GPS’ which interfaces using DuinoMite’s UEXT connector.
MOD-GPS is based on the SiRF StarIII chipset which provides high precision, low power and high sensitivity, so MOD-GPS is even able to lock onto satellites inside buildings.
MOD-GPS output is via serial 19200 bps 8bits,1 stop bit, No Parity.
It is easy to access MOD-GPS data with DuinoMite using MMBasic, for example, you can view MODGPS output using this small program:
10 OPEN “COM3:19200″ AS #5
20 PRINT INPUT$(1,#5);
30 GOTO 20
Running this code will generate something like this:
$GPRMC,192157.110,A,4208.3427,N,02445.0243,E,0.13,92.58,211111,,,A*5E
$GPGGA,192158.110,4208.3427,N,02445.0243,E,1,03,2.2,134.8,M,37.1,M,,0000*5C
$GPGSA,A,2,07,23,20,,,,,,,,,,2.5,2.2,1.0*31
$GPRMC,192158.110,A,4208.3427,N,02445.0243,E,0.11,83.24,211111,,,A*58
$GPGGA,192159.110,4208.3428,N,02445.0242,E,1,03,2.2,134.8,M,37.1,M,,0000*53
$GPGSA,A,2,07,23,20,,,,,,,,,,2.5,2.2,1.0*31
$GPGSV,3,1,12,23,63,042,38,20,38,124,35,07,38,197,39,13,72,313,24*70
$GPGSV,3,2,12,04,43,277,22,10,35,306,25,16,20,087,,02,16,316,24*72
$GPGSV,3,3,12,32,14,118,20,30,14,047,,08,10,203,24,01,01,169,*71
$GPRMC,192159.110,A,4208.3428,N,02445.0242,E,0.10,84.84,211111,,,A*5B
This will continue forever, each message starts with $Gpxxx then some data separated with “,” and ends with *xx which is the checksum in Hex.
Some messages contain several ,,, i.e. empty parameters.
When the GPS receiver is started for the very first time or after it was moved any distance without being powered the GPS receiver will have lost connection to some satellites, it takes time to lock onto them again (called `cold start time’ and is usually about 1 minute).
If you are inside a building or the signal is weak due to other obstacles the GPS receiver may not lock to some satellites at all, MOD-GPS can lock onto 12 satellites, but even 4 are enough to calculate it’s correct location.
There are 4 types of messages which MOD-GPS sends:
$GPGGA,192839.000,4208.3343,N,02445.0342,E,1,07,1.5,171.8,M,37.1,M,,0000*56
$GPGSA,A,3,07,23,20,10,13,08,04,,,,,,3.1,1.5,2.7*3A
$GPGSV,3,1,11,13,72,323,37,23,61,046,34,04,43,273,20,07,41,198,37*78
$GPGSV,3,2,11,10,38,307,30,20,35,126,24,16,21,084,25,02,18,314,22*70
$GPGSV,3,3,11,30,13,044,18,08,12,203,36,32,12,119,19*4D
$GPRMC,192840.000,A,4208.3343,N,02445.0342,E,0.00,37.14,211111,,,A*51
These messages are in NMEA0183 format and the prefix $GP means that the message is ordinated from the GPS receiver.
http://www.gpsinformation.org/dale/nmea.htm has an explanation of the different NMEA messages.
RMC – Recommended Minimum Essential GPS Data.
$GPRMC,192840.000,A,4208.3343,N,02445.0342,E,0.00,37.14,211111,,,A*51
let’s decode our message:
$GPRMC – message ID
192840.000 – 19:28:40 UTC time stamp
A – Status A=active or V=Void
4208.3343,N – Plovdiv Latitude 42 deg 08.3343′ N
02445.0342,E – Longitude 24 deg 45.0342′ E
0.00 – Speed over the ground in knots
37.14 – Track angle in degrees True
211111 – Date – 11th of November 2011
(empty field) – Magnetic Variation
(empty field) – Magnetic Variation direction
*51 – The checksum data, always begins with *
With this message we get information about time, date, our location and our speed, the speed is calculated very precisely and you can even calibrate your car or motorcycle speedometer with the value read by the GPS, as the car’s mechanical speedometers usually have about +-5% error.
This immediately leads me to an interesting project: Car performance logger. Having the change of speed of your car and the time, you can calculate the acceleration, and if you know the weight of your car you can also calculate the moment power as P=A*m i.e. you can monitor and log exactly how much horsepower or kw are used when your car accelerates.
GGA – Essential 3D Location Fix Data.
Let’s decode our message:
$GPGGA,192839.000,4208.3343,N,02445.0342,E,1,07,1.5,171.8,M,37.1,M,,0000*56
$GPGGA – Global Positioning System Fix Data
192839.000 – Fix taken at 19:28:39 UTC
4208.3343,N – Latitude 42 deg 08.3343′ N
02445.0342,E – Longitude 24 deg 45.0342′ E
1 – Fix quality: 0 = invalid
1 = GPS fix (SPS)
2 = DGPS fix
3 = PPS fix
4 = Real Time Kinematic
5 = Float RTK
6 = estimated (dead reckoning) (2.3 feature)
7 = Manual input mode
8 = Simulation mode
07 – Number of satellites being tracked
1.5 – Horizontal dilution of position
171.8,M – Altitude, Meters, above mean sea level
37.1,M -Height of geoid (mean sea level) above WGS84 ellipsoid
(empty field) – time in seconds since last DGPS update
(empty field) – DGPS station ID number
*56 – the checksum data, always begins with *
GSA – GPS DOP and active satellites.
This sentence provides details on the nature of the fix. It includes the number of the satellites being used in the current fix and the DOP.
DOP (dilution of precision) is an indication of the effect of satellite geometry on the accuracy of the fix.
It is a unit-less number where smaller is better. For 3D fixes using 4 satellites a 1.0 would be considered to be a perfect number, however for multi-satellite fixes it is possible to see numbers below 1.0. There are differences in the way the PRN’s (Pseudorandom Noise) are presented which can affect the ability of some programs to display this data. For example, in the example shown below there are 5 satellites in the solution and the null fields are scattered indicating that the almanac would show satellites in the null positions that are not being used as part of this solution. Other receivers might output all of the satellites used at the beginning of the sentence with the null fields stacked up at the end.
This difference accounts for some satellite display programs sometimes, not being able to display the satellites being tracked. Some units may show all satellites that have ephemeris data without regard to their use as part of the solution but this is non-standard.
$GPGSA,A,3,07,23,20,10,13,08,04,,,,,,3.1,1.5,2.7*3A
let’s decode our message :
$GPGSA – Satellite status message
A – Auto selection of 2D or 3D fix (M = manual)
3 – 3D fix – values include: 1 = no fix
2 = 2D fix
3 = 3D fix
07,23,20,10,13,08,04 – PRNs of satellites used for fix (space for 12)
3.1 – PDOP (dilution of precision)
1.5 – Horizontal dilution of precision (HDOP)
2.7 – Vertical dilution of precision (VDOP)
*3A – the checksum data, always begins with *
GSV – Satellites in View
Shows data about the satellites that the unit might be able to find based on its viewing mask and almanac data. It also shows current ability to track this data. Note that one GSV sentence only can provide data for up to 4 satellites and thus there may need to be 3 sentences for the full information.
It is reasonable for the GSV sentence to contain more satellites than GGA might indicate since GSV may include satellites that are not used as part of the solution. It is not a requirement that the GSV sentences appear in sequence.
To avoid overloading the data bandwidth some receivers may place the various sentences in different samples since each sentence identifies which one it is.
The field called SNR (Signal to Noise Ratio) in the NMEA standard is often referred to as signal strength. SNR is an indirect but more useful value than raw signal strength.
It can range from 0 to 99 and has units of dB according to the NMEA standard, but the various manufacturers send different ranges of numbers with different starting numbers so the values themselves cannot necessarily be used to evaluate different units.
The range of working values in a given GPS will usually show a difference of about 25 to 35 between the lowest and highest values, however 0 is a special case and may be shown on satellites that are in view but not being tracked.
$GPGSV,3,1,11,13,72,323,37,23,61,046,34,04,43,273,20,07,41,198,37*78
$GPGSV,3,2,11,10,38,307,30,20,35,126,24,16,21,084,25,02,18,314,22*70
$GPGSV,3,3,11,30,13,044,18,08,12,203,36,32,12,119,19*4D
$GPGSV – Satellites in view
3 – Number of sentences for full data
1 – sentence 1 of 3
11 – Number of satellites in view
13,72,323,37
13 – Satellite PRN number
72 – Elevation, degrees
323 – Azimuth, degrees
37 – SNR – higher is better
(for up to 4 satellites per sentence)
*78 – the checksum data, always begins with *
The three messages contain the info for all 12 satellites.
Example:
The following code reads RMC message and extract the time, date, latitude, longitude
10 CLS
20 PRINT “GPS DEMO CODE”
30 OPEN “COM3:19200″ AS #5 ‘open UEXT UART at COM3
40 IF NOT EOF(#5) THEN 60 ‘if something is received
50 GOTO 40
60 C$=INPUT$(1,#5) ‘get character
70 IF C$ = CHR$(10) THEN 100 ‘until LF is received
80 MSG$=MSG$+C$ ‘store in MSG$
90 GOTO 40
100 ‘LOCATE 0,100: ? MSG$ ‘used for debug
110 IF LEFT$(MSG$,6) = “$GPRMC” THEN 140 ‘wait for RMC message
120 MSG$=”"
130 GOTO 40
140 LOCATE 0,100: PRINT MSG$ ‘RMC message received
150 LOCATE 0,20: PRINT “UTC TIME: “;
160 A$ = MID$(MSG$,INSTR(MSG$,”,”)+1)
170 PRINT MID$(A$,1,2);”:”;MID$(A$,3,2);”.”;MID$(A$,5,2)
180 GOSUB 500
190 GOSUB 500
200 LATITUDE$ = LEFT$(A$,INSTR(A$,”,”)-1)
210 LOCATE 0,50: PRINT “LATITUDE :”;LATITUDE$;” “;
220 GOSUB 500
230 NS$ = LEFT$(A$,1)
240 PRINT NS$
250 GOSUB 500
260 LONGITUDE$ = LEFT$(A$,INSTR(A$,”,”)-1)
270 LOCATE 0,60: PRINT “LONGITUDE :”;LONGITUDE$;” “;
280 GOSUB 500
290 EW$ = LEFT$(A$,1)
300 PRINT EW$
310 GOSUB 500
320 SP$ = LEFT$(A$,INSTR(A$,”,”)-1)
330 LOCATE 0,70: PRINT “SPEED KNTS:”;VAL(SP$)
340 GOSUB 500
330 GOSUB 500
340 LOCATE 0,30: PRINT “UTC DATE: “;
350 PRINT MID$(A$,1,2);”-”;MID$(A$,3,2);”-20″;MID$(A$,5,2)
360 GOTO 120
500 A$ = MID$(A$,INSTR(A$,”,”)+1) ‘skip to next ‘,’
510 RETURN
Great job skywodd
This little card does look great, but it does not interest me at the moment
Posted by schizophrenic | February 4, 2012, 20 August 35 02 352
Good evening
What attracted you the Duinomite it particularly?
Does MMBasic is superior to other available Basic already on PIC / AVR / ARM / etc (or other kind BasicStamp Basic open-source)?
Is it more the idea of stand-alone solution (keyboard / screen)?
As I said the other day, here reminds me of the Basic machines of the early 80 (TRS-80, Sinclair, Oric …)
A +
Posted by Barbudor | February 6, 2012, December 48 02,482 0
Level when comparing the perf duinomite a basic stamp or a CUBLOC is also fast.
What seduced me in duinomite is the idea that you can edit / execute its code from the SD card without computer, just with a keyboard and monitor. It feels really "mini computer" and I really like.
Posted by skywodd | February 6, 2012, December 12 35 02 352
Advantage can be used in MPLAB, penguino … for the program.
I got mine yesterday (same supplier as our host) good, I made a mistake, I took a mega, but I also got the adapter I / O, and Arduino shield, with the mega unnecessary They will if I purchase a "normal"
for nostalgia: the TRS80 was for me a Rolls, I started in 77 with a kit motorola MKD2
In fact, I buy lots of stuff and I'm not making much
(Lack of courage)
Too bad it lacks an ethernet connection, it would have been perfect (I have seen with an Olimex card hack, but blah)
I think I'll make a kind of coordinator collecting information for different gear (many interface) and providing both a human interface and transmission of orders to "slaves". I will hang the map on the back of a LCD Monitor 17 "lying around here and insert the power supply on it.
Something marked or almost anywhere: to connect the keyboard is a QWERTY
And thank you for your blog.
Published by John Paul Rouzé | February 11, 2012, 11 November 36 02 362
>> I got mine yesterday (same supplier as our host) good, I made a mistake, I took a mega, but
>> I also took the I / O adapter and arduino shield, with the mega useless, they will if I purchase a "normal"
The adapter shield is usable even with the mega I think.
>> Too bad it lacks an ethernet connection, it would have been perfect (I have seen with an Olimex card hack, but blah)
The duinomite EMEGA-released a few weeks, it will have the same functionality as normal but with the mega ethernet, embedded flash memory, etc. …
http://www.olimex.com/dev/duinomite-emega.html
Something >> marked or almost anywhere: to connect the keyboard is a QWERTY
I had stated in my first video (the music nyan cat).
I planned a full test of the map to the middle of next week
Posted by skywodd | February 11, 2012, February 14 12 02 122
But good news
)
and I do not watch the videos too (the wimax is shitty sometimes
Posted by jean-paul Rouzé | February 11, 2012, July 19 10 02 102
Hello,
I have integrated keyboards FR, GR and IT in the MM Basic v3.1 is available on the website of MM.
Therefore, no need to look for keys on the keyboard
In addition you can remove the line numbers!
@ + +
Fabrice.
Posted by Fabrizio | February 14, 2012, May 17, 17 02 172
Cool, but … the problem MMbasic 3.1 current firmware is not 100% compatible Duinomite mega-(?)
cf: http://www.olimex.com/dev/duinomite-mm-firmware.html
The three new features: EDIT line number optional routines named, modifiable keyboard keymap, etc. … it's really interesting … but here at the moment it seems not to have full support for GPIO, SPI software, etc. …
Posted by skywodd | February 14, 2012, 20 August 15 02 152
Thousand times agree with you!
. The temptation to success would it not to make money?
In addition there is a trick that I do not understand, the license was GPL 3, rewind seems difficult if I read: http://www.gnu.org/licenses/quick-guide-gplv3.fr.html anyone can take over the project to the point and is making a fork. It looks indeed a lot to shoot itself in the foot
Posted by jean-paul Rouzé | February 14, 2012, September 21 28 02 282
@ Jean-paul Rouzé: I know if he wants to "return" code, but switching to GNU GPL owner will not solve its problems of fragmentation of syntax, let alone bring him money.
Posted by skywodd | February 14, 2012, September 21 54 02 542
Thank you for this article.C is all I can say.
Posted by dj animation 76 | February 15, 2012, February 2 38 02 382
Wow, you are on Hackaday!
Posted by vl_ | March 1, 2012, December 23 03,233 0
Yeah I saw, but it's not the first time