GPS Speedometer

Thread Starter

ozarkdan

Joined Jan 11, 2010
7
I need some help. My new project is to make a GPS speedometer for my car. I have a GPS Receiver/Antenna that was used with a marine speedometer(which I couldn't salvage). I need help understanding what signal(s) are transmitted by the receiver and how to determine speed from them. My search on the internet has been fruitless so far. I would greatly appreciate any and all guidence or suggestions. Thanks.

Dan
 

davebee

Joined Oct 22, 2008
540
All the GPS receiver-only modules I've seen emit bursts of RS232 data using standard NMEA messages that look like this -

$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47

Lots of people have developed their own displays by having a microcontroller receive these messages, pull out the data they want to use and display it on an LCD.

Some GPS receivers can be configured to send many different messages having different selections of fields, and some have fields that will tell you your speed directly.

Maybe that's the kind of sensor you have. But like beenthere said, the best approach would be to start with the unit's manual, if you can find one.
 

retched

Joined Dec 5, 2009
5,207
You have to take two sets of lat. and long. and figure the distance between the two and then calculate the time it took the receiver to travel from the two points, resulting in speed.(mph if you choose)

There is no easier way. Unfortunately. There may be some systems that xmit an average speed in a rs232 burst, but that would be a company specific option.
 

davebee

Joined Oct 22, 2008
540
Actually, there's an interesting thing I learned about GPS receivers.

Since the incoming GPS signal is so weak, and since the thermal noise in an amplifier is directly related to the bandwidth, they have to use a fairly narrow-bandwidth amplifier to keep amplifier noise from swamping out the signal.

But the Doppler shift of the signal as the GPS satellite is at different points in the sky shifts the signal a greater amount than the bandwidth of the receiver, so the local oscillator has to be shifted in order to place the IF signal into the narrow bandwidth of the amplifier.

But since the amount of shift of the local oscillator is directly related to the relative velocity between the satellite and the receiver, and the velocity of the satellite is known from its orbital parameters, then the velocity of the receiver is a free byproduct of the position decoding, completely independently from position decoding.

I've even read that since the frequency of the signal is less affected by ionispheric fluctuations than the timing of the modulation on the signal, that the velocity output from a GPS receiver is usually less noisy than the position output.
 

retched

Joined Dec 5, 2009
5,207
Humph... So by measuring the dopler shift you can get a stellar speed? I guess you would still have two samples like 25,010mph on sample1 and 25,075mph on sample two subtracting the two gives you the receivers local speed?

Or is it more of a ratio? What does the resulting data look like?
 

Art

Joined Sep 10, 2007
806
You have to take two sets of lat. and long. and figure the distance between the two and then calculate the time it took the receiver to travel from the two points, resulting in speed.(mph if you choose)

There is no easier way. Unfortunately. There may be some systems that xmit an average speed in a rs232 burst, but that would be a company specific option.
Not exactly, in fact exactly the opposite. The speed data in Kmph is right there delivered to your door as RS232 serial data.

Even a USB GPS mouse has a serial terminal if you pull it apart.

To make a machine that is strictly a speedometer only, you are only interested in two NMEA sentences:
$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A


RMC Recommended Minimum sentence C
123519 Fix taken at 12:35:19 UTC
A Status A=active or V=Void.
4807.038,N Latitude 48 deg 07.038' N
01131.000,E Longitude 11 deg 31.000' E
022.4 Speed over the ground in knots
084.4 Track angle in degrees True
230394 Date - 23rd of March 1994
003.1,W Magnetic Variation
*6A The checksum data, always begins with *


$GPVTG,054.7,T,034.4,M,005.5,N,010.2,K*48


VTG Track made good and ground speed
054.7,T True track made good (degrees)
034.4,M Magnetic track made good
005.5,N Ground speed, knots
010.2,K Ground speed, Kilometers per hour
*48 Checksum
Look at the "A" value in the $GPRMC sentence to tell you the GPS unit has a valid position fix so you know the speed value isn't going to be rubbish.

Look at the KMPH value in the $GPVTG sentence, and there's your speed.
Alternatively you can just as easily aquire the speed in knots from the $GPRMC sentence.
You can do a simple calculation to convert Kmph to mph if you wish.

But while you're at it, you might as well get the bearing as well.

A speed logger/playback device I made a few years back:
http://www.youtube.com/watch?v=hWDVA7Sby30

BTW, NMEA sentences are pretty much standard. Variations across brands I've only seen introduce new sentences you can just ignore.


Cheers, Art.
 
Last edited:

BMorse

Joined Sep 26, 2009
2,675
If the GPS antenna is dumping serial data there are 4 main strings you can parse to extract all the info you need, which are standard for almost all brands of GPS receiver antennas....

GPGSA
GPGSV
GPGGA
GPRMC


In the GPRMC string you can extract the SOG (Speed over ground), and multiply it by 1.151 to get MPH....

here is the code I used in my GPS application I wrote for the pocket PC (ported it over to that format) and for Visual Basic 6.0....bold section is for the SOG extraction and calculation routine in the function....

Rich (BB code):
Public Function Extract_RMC(ByVal iText As String)
'to extract and display each data
On Error Resume Next
Dim SearchChar As String
Dim mDir As String
SearchChar = ","
Dim MyPos As Long
Dim SecPos As Long
'to extract the protocol header
If iText <> "" Then
iText = Mid$(iText, 8)
'UTC
MyPos = InStr(1, iText, SearchChar, vbTextCompare)
txtUTC = Mid$(iText, 1, MyPos - 1)
iText = Mid(iText, MyPos + 1)
'Status
MyPos = InStr(1, iText, SearchChar, vbTextCompare)
txtStatus.Text = Mid$(iText, 1, MyPos - 1)
iText = Mid$(iText, MyPos + 1)
'Latitude
MyPos = InStr(1, iText, SearchChar, vbTextCompare)
txtLatitude.Text = Mid$(iText, 1, MyPos - 1)
iText = Mid$(iText, MyPos + 1)
'N/S Ind
MyPos = InStr(1, iText, SearchChar, vbTextCompare)
mDir = Mid$(iText, 1, MyPos - 1)
iText = Mid$(iText, MyPos + 1)
'Longtitude
MyPos = InStr(1, iText, SearchChar, vbTextCompare)
txtLongtitude.Text = Mid$(iText, 1, MyPos - 1)
iText = Mid$(iText, MyPos + 1)
'E/W Ind
MyPos = InStr(1, iText, SearchChar, vbTextCompare)
mDir = mDir & Mid$(iText, 1, MyPos - 1)
iText = Mid$(iText, MyPos + 1)
txtDirection.Text = mDir
'SOG
MyPos = InStr(1, iText, SearchChar, vbTextCompare)
'lblSpeed = "Speed (mph): " & Format(curstr * 1.151, "0.00") & " (" & Format(maxspd, "0.00") & " MAX)"
txtSpeed.Text = Mid$(iText, 1, MyPos - 1)
txtSpeed.Text = Format(txtSpeed.Text * 1.151, "0.00")
iText = Mid$(iText, MyPos + 1)
'COG
MyPos = InStr(1, iText, SearchChar, vbTextCompare)
txtCOG.Text = Mid$(iText, 1, MyPos - 1)
iText = Mid$(iText, MyPos + 1)
'Date
MyPos = InStr(1, iText, SearchChar, vbTextCompare)
txtDate.Text = Mid$(iText, 1, MyPos - 1)
iText = Mid$(iText, MyPos + 1)
'Magnetic Var
MyPos = InStr(1, iText, SearchChar, vbTextCompare)
txtVar.Text = Mid$(iText, 1, MyPos - 1)
iText = Mid$(iText, MyPos + 1)
'Me.Caption = iText
End If
End Function
B. Morse
 
Last edited:

BMorse

Joined Sep 26, 2009
2,675
I basically wrote an app for the PocketPC so I can have basically my own GPS unit in my truck, but it also doubled as a GPS data-logger, whos data I can import to a PC and view the corresponding maps to the locations from the file, I am working on making it a uc based data logger to store GPS data on an SD Card using a Pic32MX UC.....

here is the screen shot of the PC side app and some MAP data it pulled of the web based on the coordinates in the GPS data...

GPS DATA.jpg

B. Morse
 

Art

Joined Sep 10, 2007
806
That must have been quite a "jerky" drive going from 70 to 14 or 80+ to 0 just like that
No, it was the start of a different session.
If I recorded for an hour, and then recorded again for only half an hour from the start of
the EEPROM, that's what can happen at the half hour mark... I didn't erase the whole EEPROM when I started recording.

The thing was done before I saw a commercial GPS unit so had some interesting features
like distance to waypoint
and such, but with a digital digit display.

Later I went on to write a more conventional GPS program for the Sony PSP:
http://www.youtube.com/watch?v=UrahMeju7bY
http://www.youtube.com/watch?v=GzvRohPRR-8
 

Thread Starter

ozarkdan

Joined Jan 11, 2010
7
WOW. Lots of help and great feedback. The RS 232 approach will most likely be my approach, but thanks to all for the info.

The receivers I am looking at are by Falcom and SANAV. They both use NMEA standard formats, but there is a VTG format that provides the SOG data I need I think.

The VB6 info is so inviting, I wish I knew VB and was using it. Right now I am planning a LabView approach with some NI daqs to generate test date for the circuit testing.

Once again, my appreciation to all that contributed to this post.

Dan
 

Thread Starter

ozarkdan

Joined Jan 11, 2010
7
The Receiver/Antenna is a SANAV GM-44-K-FB. I could not find the exact model on their website, but found GM-44's. Spec show various data sentences output.

I do not have Visual Basic and am not familiar with it. However, seems it should be fairly easy to read the rs232 data into the serial port and display it using the Command mode in Windows?
 

BMorse

Joined Sep 26, 2009
2,675
You should be able to view the data coming from it in any type of terminal applications (HyperTerminal in windows).... the only thing is, you might have to send initialization sequence (cold start, hot start, etc.) to the antenna to get it to start sending data.....

B. Morse
 
Top