BlueWave Studio forum
Getting a GPS breakout board to work with Navit - Printable Version

+- BlueWave Studio forum (https://bluewavestudio.io/community)
+-- Forum: OpenAuto Pro (https://bluewavestudio.io/community/forum-86.html)
+--- Forum: Iphone Users (https://bluewavestudio.io/community/forum-98.html)
+--- Thread: Getting a GPS breakout board to work with Navit (/thread-1078.html)



Getting a GPS breakout board to work with Navit - tthenrie - 09-02-2019

This is a short tutorial to help people like me to get a GPS breakout board to work with Navit on OAP.

I have a raspberrypi 4b with an Adafruit Ultimate GPS Breakout board and an SMA antenna. I have Navit installed and configured, with a Navit button in my OAP Apps menu.

I made a USB connector for my gps unit, rather than connecting via GPIO pins. Adafruit provides a wiring diagram to do this. It just seemed to make a cleaner install for my purposes. My GPS Breakout board is connected to my pi via a powered usb hub, so it doesn't draw power from my pi.  I am assuming you have already installed OAP and updated/upgraded your raspberry pi. If not, there are plenty of tutorials available for that.

Connect the GPS unit to your pi and power up. Make sure the antenna has exposure to open sky. The LED on the unit will blink about every second or so, until it gets a fix, after which it will blink once about every 10 seconds.

Install gpsd, gpsd-clients, and python-gps:

sudo apt-get install gpsd gpsd-clients python-gps

Turn on your serial port via raspi-config --> Interfaces --> Serial -->No to serial GUI --> "yes".  Do not enable the serial GUI, just the port. Do not reboot yet.

Configure gpsd for your unit. You will have to find where your gps unit is connected.

ls /dev

will give you a list of all your device ports

Once I identified my unit on ttyUSB0 I did the following to make sure:

cat /dev/ttyUSB0

That gave me a live stream of data being produced by my gps unit in NMEA format, which confirmed my unit on ttyUSB0. Some units might end up as ttyAMA0 or ttyS0, etc.  Use ctrl-C to stop the stream.

Edit /etc/default/gpsd to tell the gpsd where to find the gps data stream:

sudo nano /etc/default/gpsd

Look for DEVICES=""

Insert the address of your device:

DEVICES="/dev/ttyUSB0"

Save and exit. Reboot now. After it comes back up, enable gpsd:

sudo killall gpsd
sudo systemctl enable gpsd.socket
sudo systemctl start gpsd.socket

Now you should be able to see some readable information by:

cgps -s

Give it a second or two to catch up and you should see the fields populate with human readable gps data. When that happens, your gps unit is functioning and gpsd is reading it.

Now edit your .navit/navit.xml to tell navit where to find the data:

sudo nano /home/pi/.navit/navit.xml

Look for the line that starts 

<vehicle name="Local GPS"...

Change it to read:

<vehicle name="Local GPS" profilename="car" enabled="yes" active="1" source="gpsd://localhost" gpsd_query="w+xj" follow="2">

The follow="2" part makes the gps update the location of the vehicle every 2 seconds, which is a handy setting in Navit.

If your maps have been downloaded and properly unpacked and configured, your navit install should now be working through your gps breakout board, independent of the gps in your iphone.

TTH