A blog post for the lack of blog posts. And GPS.

Jamster

Senior Member
There hasn't been many posts in this section for a while so I thought I may do a small write up of my quick GPS tests :)

About 2 years ago I purchased this (now retired) GPS reciever from Sparkfun, last week I finally purchased an aerial for it after I forgot to add one to my basket all those years ago...

So skip to today! I arrive at my house and there lies a bunch of 5mm-larger-than-expected LEDs and an aerial with a rather long cable. After a lengthy process of trying to sus out the model of chip I had on the board (not helped by the identifying digit being inconveniently smuged) I was able to solder some headers on to the board. Upside down.

I havn't played around with GPS modules before and it's always seemed like an evil thing to interface to so I was partly doubting my chances here. Fortunately the Venus638FLP chip is fairly nice to work with at a simple stage: all you need to do is plug it in wait only a few seconds and then start recieving blank NMEA sentences. After about 30 seconds the GPS had got a lock and started to spit out more usable NMEA sentences that gave me the number of satellites used, altitude, a longitude, and some interesting information about signal strength. However the latitude and time were coming out in a strange combination of random numbers, hexadecimal looking stuff and undisplayable characters.

What also annoyed me was the fact longitude was not obviously correct; there's definately something worng with a longitude of 5402.4786...

I thus decided to do a forum search for "NMEA" and came up with code a little more intelligent than my long serin -> sertxd -> loop code.
Code:
Data_in:
'Use the qualifier "$GPGGA" to input the GGA NMEA sentence.
bptr = $50
For b0 = $50 to $7F
Poke b0, 0
Next
Serin A.0, T4800_8,("$GPGGA,"),@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc,@bptrinc
'Time
b0 = $50
peek b0, b10,b11,b12,b13,b14,b15
b10 = b10 & $0F * 10 + 1
b10 = b11 & $0F + b10
If b10 > 23 then
b10 = 0
endif
If b10 < 10 then sertxd("0") endif
sertxd(Cr,LF,#b10,":",b12,b13,":",b14,b15," ")
'LAT
b0 = $5B
peek b0, b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20
sertxd("Lat:",b10,b11,"°",b12,b13,"'",b15,b16,b17,b18,b20," ")
'LON
b0 = $68
peek b0, b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21
sertxd("Lon:",b10,b11,"°",b12,b13,"'",b15,b16,b17,b18,b20," ")
'STATUS
b0 = $74
peek b0, b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23
sertxd("Fix=",b10," ","Sat=",b12,b13, " Alt=",b19,b20,"m ",Cr,LF)
goto Data_in
So after 10 minutes of fighting and wondering why nothing was coming out of my PICAXE (I'll add here it was a 28X2 on an AXE401) I realised that actually the module outputs data at 9600 baud and so swiftly changed that and pretended I knew that all along.

The code also helped me make sense of the odd longitude value: I work in decimal degrees - this works in decimal minutes. Now I think there's something wrong with the online converters because, combined with google maps, I apparently live in Nottingham, Kazakhstan and a baron area of Russia depending on which site you use. So out comes the Ordinance Survey map (for those in the USA or who have a Satnav it's a paper version of Google maps ;) ) which, quite fortunately, tells me I'm in my house.

So that's the end of the first part, tommorrow I might see if I can talk back to the module and get it to send me a heading etc but till then I'll stare at my PE terminal and dream of the wonders of technology :)

Jamster

P.S. I said small at the top didn't I... :/
 
Top