Adding a Bluetooth GPS

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
pepijndevos
Posts: 175
Joined: 28 Dec 2011, 13:07
Location: Gelderland, Netherlands
Contact:

Re: Adding a Bluetooth GPS

Post by pepijndevos »

So how is the accuracy?
Cab you only log the data, or can the NXT actually parse it?
Is the altitude also included?
-- Pepijn
http://studl.es Mindstorms Building Instructions
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Adding a Bluetooth GPS

Post by h-g-t »

The program I use was written in NXC by pbenco and can be downloaded from here - http://freelug.org/spip.php?article1174

There is a minor error in line 264 - case 7: GPSData.Sat_number=StrToNum(sdumy); - just change case 7 to case 8.

This will not run on the LEGO firmware, it calls a routine in the upgraded version created by John Hansen.

I have not tested the accuracy yet, just wanted to see if it worked. I have tried it with an older GPS module and one of the latest versions and the NXT communicated with both. The newer unit was definitely more sensitive (and about 1/3 of the size).

The program writes a log file (debug purposes only) but the contents are not the same as what is shown on the screen. It would be easy enough to modify the program to store whatever you want.

Full details of the NMEA data is shown here - http://www.gpsinformation.org/dale/nmea.htm#position

Basically, you get date, time, location and elevation. If the unit is moving you also get speed and heading.

The locations are given as 1, 2 or 3 digits for degrees, 2 digits for minutes, then decimal minutes. You have to multiply the latter by 60 to get seconds.

You are also given N or S, W or E to tell you which side of the axes you are on.

It is cheap enough to try out - my first unit cost £2.99 from ebay (inc p&p)!

Image
GPS by Aloysious A Gruntpuddock, on Flickr
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
pepijndevos
Posts: 175
Joined: 28 Dec 2011, 13:07
Location: Gelderland, Netherlands
Contact:

Re: Adding a Bluetooth GPS

Post by pepijndevos »

Whee, I got one as well! €10 including shipping. I never bid on eBay before, so I was constantly refreshing to fend of imaginary snipers.
-- Pepijn
http://studl.es Mindstorms Building Instructions
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Adding a Bluetooth GPS

Post by h-g-t »

It would be interesting to see how you get on.

I have not tried taking my new unit (Vodaphone keyring) outside yet but I notice that the coords keep cycling up and down slightly. This might cease when I take it out and give it a chance to lock on properly.

I suppose that for robot control, consistency will be more important than absolute accuracy. It would not matter if it was 5m out as long as it was always 5m out in the same direction.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Adding a Bluetooth GPS

Post by afanofosc »

I would be very surprised if you have any usable data from the GPS if you use it inside a building. In my experience, anyway, the GPS will not transmit anything that would help you navigate within a large room inside your house.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
pepijndevos
Posts: 175
Joined: 28 Dec 2011, 13:07
Location: Gelderland, Netherlands
Contact:

Re: Adding a Bluetooth GPS

Post by pepijndevos »

YAY! GPS arrived!

I connected it to my Mac, and I'm now staring at some raw serial output. I'm not so uber-geek I can read this without a reference, so I can't tell yet how precise it is. More after the weekend.

This is a section, indoors:

Code: Select all

$GPGSA,A,1,,,,,,,,,,,,,,,*1E                                                    
$GPGSV,1,1,01,28,,,24*74                                                        
$GPRMC,143013.893,V,2447.5652,N,12056.4737,E,0.00,0.00,170312,,,N*70            
$GPGGA,143014.893,2447.5652,N,12056.4737,E,0,0,,135.1,M,14.9,M,,*4E             
$GPRMC,143014.893,V,2447.5652,N,12056.4737,E,0.00,0.00,170312,,,N*77            
$GPGGA,143015.893,2447.5652,N,12056.4737,E,0,0,,135.1,M,14.9,M,,*4F             
$GPRMC,143015.893,V,2447.5652,N,12056.4737,E,0.00,0.00,170312,,,N*76            
$GPGGA,143016.893,2447.5652,N,12056.4737,E,0,0,,135.1,M,14.9,M,,*4C             
$GPGSA,A,1,,,,,,,,,,,,,,,*1E                                                    
$GPGSV,1,1,01,28,,,24*74                                                        
$GPRMC,143016.893,V,2447.5652,N,12056.4737,E,0.00,0.00,170312,,,N*75            
$GPGGA,143017.893,2447.5652,N,12056.4737,E,0,0,,135.1,M,14.9,M,,*4D             
$GPRMC,143017.893,V,2447.5652,N,12056.4737,E,0.00,0.00,170312,,,N*74            
$GPGGA,143018.893,2447.5652,N,12056.4737,E,0,0,,135.1,M,14.9,M,,*42             
$GPRMC,143018.893,V,2447.5652,N,12056.4737,E,0.00,0.00,170312,,,N*7B            
$GPGGA,143019.893,2447.5652,N,12056.4737,E,0,0,,135.1,M,14.9,M,,*43             
$GPGSA,A,1,,,,,,,,,,,,,,,*1E                                                    
$GPGSV,1,1,01,28,,,24*74                                                        
$GPRMC,143019.893,V,2447.5652,N,12056.4737,E,0.00,0.00,170312,,,N*7A            
$GPGGA,143020.893,2447.5652,N,12056.4737,E,0,0,,135.1,M,14.9,M,,*49             
$GPRMC,143020.893,V,2447.5652,N,12056.4737,E,0.00,0.00,170312,,,N*70            
$GPGGA,143021.893,2447.5652,N,12056.4737,E,0,0,,135.1,M,14.9,M,,*48             
$GPRMC,143021.893,V,2447.5652,N,12056.4737,E,0.00,0.00,170312,,,N*71            
$GPGGA,143022.893,2447.5652,N,12056.4737,E,0,0,,135.1,M,14.9,M,,*4B      
-- Pepijn
http://studl.es Mindstorms Building Instructions
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Adding a Bluetooth GPS

Post by h-g-t »

All the details are here - http://aprs.gids.nl/nmea/#rmc

The V indicates that the data is invalid, and you have appear to have acquired no satellites.

Once you have moved a GPS a fair distance or removed the batteries, I read that you need to leave it in the open for at least 15-20 minutes so it can reset its database of satellites. They normally switch off if left on their own so it is best to pair it with a phone (or NXT) before you put it outside.

Rapidly changing numbers mean that someone has stolen it and is running away!

I find this site is quite handy for getting your location from the data - http://itouchmap.com/latlong.html
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
pepijndevos
Posts: 175
Joined: 28 Dec 2011, 13:07
Location: Gelderland, Netherlands
Contact:

Re: Adding a Bluetooth GPS

Post by pepijndevos »

I'm back, moved the GPS outside, and I'm getting a perfectly stable and accurate reading now.

I found this utility for plotting the data: http://www.gonmad.co.uk/nmea.php
-- Pepijn
http://studl.es Mindstorms Building Instructions
pepijndevos
Posts: 175
Joined: 28 Dec 2011, 13:07
Location: Gelderland, Netherlands
Contact:

Re: Adding a Bluetooth GPS

Post by pepijndevos »

I just found this in the docs, does anyone know what it's for? DATA_MODE_GPS

I feel like this might greatly simplify the code linked to earlier, if this is what it seems to be.
-- Pepijn
http://studl.es Mindstorms Building Instructions
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Adding a Bluetooth GPS

Post by afanofosc »

"not yet implemented" is what that means. I have it in mind to add code to parse GPS messages in the firmware and store the data in some sort of IOMap structure that you can read in NXC code.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest