-
Notifications
You must be signed in to change notification settings - Fork 44
GPS Parser
##GPS Parser Processing Class
Using the serial port wrapper (as Bluetooth supports serial port emulation [BlueTooth Serial Port Profile]), it is very fast and easy to parse bluetooth gps devices. GPS sensors actually have some specification for their output called NMEA. Only a subset of it was implemented, the GPRMC part to be precise. This is some formatted text only output looking for example like
"$GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E*62"
which has to be converted to Google maps coordinates.
The GPS sensor was developed using a GPSlim device but should be successfully used by any device following the NMEA specification. It was actually tested with a Nokia GPS device without any modification. The only small problem was the linkage of the Nokia GPS device which requires a passcode. It can be found deep down in the documentation and is 0000 by default.
###Connecting a GPS device to gpsd GPSD is a Linux daemon that monitors one or more GPS devices attached to a host computer through serial or USB ports. All data of the GPS devices is made available to be queried on TCP port 2947 of the host computer. With gpsd, multiple GPS client applications (such as navigational and wardriving software) can share access to GPS devices without contention or loss of data. Also, gpsd responds to queries with a format that is substantially easier to parse than the NMEA 0183 emitted by most GPS devices.
Supported by GPSD:
- NMEA 0183 protocol
- Rockwell binary protocol
- TSIP binary protocol
- SiRF protocol
- Garmin binary protocol
- Evermore binary protocol
###Using Bluetooth We are given a Bluetooth GPS device that we want to connect to a Linux host. In this tutorial, it's a HOLUX GPSlim 236.
- First, we need to start bluetooth services:
sudo /etc/init.d/bluetooth start
Now, let's scan for bluetooth devices:
hcitool scan
This should return a list of devices like
00:0B:0D:85:77:79 HOLUX GPSlim236
00:16:4E:D7:AE:5F Nokia N70
00:12:62:AF:C0:6E Nino
00:11:67:80:41:96 BT-GPS
As already mentioned, we are going to use the HOLUX GPSlim 236. We want to map the HOLUX GPSlim 236 to a emulated RS-232 serial port. To this end, we use the Bluetooth protocol RFCOMM. That's pretty simple and goes as follows. First we create a config file for the RFCOMM:
sudo nano /etc/bluetooth/rfcomm.conf
and add an entry for our HOLUX GPSlim 236 to this file
rfcomm0 {
bind yes;
device '00:0B:0D:85:77:79';
channel 1;
comment "Your comment here";
}
This way, we are mapping the HOLUX to a emulated RS-232 serial port
/dev/rfcomm0
by using the shell command
sudo rfcomm connect 0
We should get the following return
Connected /dev/rfcomm0 to 00:0B:0D:85:77:79 on channel 1
Press CTRL-C for hangup
Great, now we open a second terminal and connect the gpsd to our /dev/rfcomm0
sudo gpsd -b -N -D 4 /dev/rfcomm0
You can telnet into the gpsd to play around and check if it's working correctly
telnet localhost 2947
Cool, now we have a Bluetooth GPS device connected to a Linux host! A GSN server can use it to read the GPS data.