properphatboy
Posts: 14
Joined: Wed Nov 21, 2012 6:42 pm

Bluetooth GPS and Sat Nav

Sat Dec 15, 2012 4:20 pm

Hi all. My own little project at the moment is trying to get some Sat Nav working on the Pi using what I have. Some of this should likely work for others who want to use similar devices.

I used to own a Nokia N95 and got a Nokia LD-3W to go with it. If you're not familiar with the LD-3W it's a quite nice, fairly accurate bluetooth GPS device with its own little battery. I've tried it out with my HTX One X and before that with my Wildfire and it does seem to be more accurate than the GPS on either of these, so probably many more. Had it working with my laptop too, just with a program to look at the positions of the satellites above you.

I ran into some problems however getting it to work just using the GUI bluetooth stuff, and reckoned it was maybe getting a bit clogged up with the things I'd been trying to do to get it to work. I also had a poor workaround to get my full 512mb working, so felt a completely fresh install was needed. So I started with a nice fresh install of the latest Raspbian image.

Anyway, here's where I'm up to so far. To get the LD-3W I mainly followed the guide here, but I'll show you my own method as it had a few differences and tips. I ran sudo before nearly all of this code, so don't know what needed it and what didn't. You can too, or just work as root.

First I installed:

Code: Select all

apt-get install bluez-utils gpsd gpsd-clients
Make sure the GPS unit is switched on. Then you need to find the device using

Code: Select all

hcitool inq
This should give you something like

Code: Select all

Inquiring ...
        11:22:33:44:55:66       clock offset: 0x0e82    class: 0x011f00
Copy the 11:22:33:44:55:66 bit! You'll need it for the next comman and you'll have to paste it later on also. Then use it to get more info about the unit using

Code: Select all

sdptool search --bdaddr 11:22:33:44:55:66 SP
This should give something like the below

Code: Select all

Searching for SP on 11:22:33:44:55:66 ...
Service Name: Dev B
Service RecHandle: 0x10000
Service Class ID List:
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Please note the line with the property Channel: this is the channel where your GPS device listens for incoming connections (Bluetooth supports only one connection at a time)
So, remember what the channel number is. The next bit is a bit more specific for the Pi than the Debian guide

Code: Select all

nano /etc/bluetooth/rfcomm.conf
Find the below lines in your file, uncomment them, and make them look like this (you need to paste in your own 11:22:33:44:55:66 that we copied before and put in your own channel number)

Code: Select all

#
# RFCOMM configuration file.
#

rfcomm0 {
        bind yes;
        device 11:22:33:44:55:66;
        channel 1;
        comment "NOKIA LD-3W";
}
Now to start bluetooth services

Code: Select all

/etc/init.d|/bluetooth start
The Nokia LD-3W has a pass code (0000) and to use this most guides seem to need you to make something called a passkey-agent (or use pin_helper on older versions). I came a bit unstuck here as my bluez didn't seem to haver either, so to pair the devide I went back to using the GUI interface.

So, first I installed it with

Code: Select all

apt-get install blueman
Then I rebooted to get it running

Code: Select all

reboot
I opened it up when the Pi was back up, made it search for devices and it found the LD-3W. I selected it and clicked add (the green + sign) by accident, but it seems to have worked for me, so I'll leve that in here. Next I paired it, putting in the passcode 0000 and it paired up fine. So now I went back to the debian guide and the terminal.

Now its paired up you bind it to the rfcomm. You need the address again and since I'd had to reboot I ran the inquiry again, to

Code: Select all

hcitool inq
To bind it to rfcomm (with copied 11:22:33:44:55:66 and the channel number after it)

Code: Select all

rfcomm connect rfcomm0 11:22:33:44:55:66 1
In order to run gpsd you need to configure it using the configuration tool

Code: Select all

dpkg-reconfigure gpsd
I can't remember all the steps in the configuration, but the debian guide has this advice
This command will ask you to enter some options, like the path to the rfcomm device. Just look at your /etc/bluetooth/rfcomm.conf which device is used. (The name before the opening bracket ‘{’, e.g. rfcomm0 will be /dev/rfcomm0 if you use udev)
Now you can start gpsd

Code: Select all

/etc/init.d/gpsd start
The LD-3W has 3 lights on it to show you what's going on. The green one is for power, the blue one is for bluetooth connection and the white one only seems to work when it can both see satellites and is feeding the data to a device. Since they're all on I'm pretty sure the Pi is now receiving the location data.

I then have decided to try to use it with Navit since searching for Sat Nav on these forums gives it as pretty much the only proper result

Code: Select all

apt-get install navit
And this is as far as I have gotten. I'm currently trying to configure Navit to used gpsd but all anything gives me is the config pages from the navit wiki which aren't the easiest to understand, similar to the navit.xml file I have to work with (which is in /etc/navit/ on the Pi).

Questions for the community are:

1) Can you see any problems with the configuration of the device above? I'd also like to connect a keyboard by bluetooth and possibly an ODB II reader in the future, so would I have issues with it then?

2) How on Earth do I get navit working? Can you offer me some simplified instructions to get it working with the above device.

Thanks!


Return to “Other projects”