Raspberry PI, a GPS car navigation system
/Misc/GpsPi

I have been looking at multiple projects that make a GPS out of a PI. I could not resist, so I made one for myself.

The hardware components are:

  • Raspberry PI model B+
  • TonTec 3.5" touch screen
  • Transparent acrylic case
  • FTDI cable
  • CRIUS NEO-6 GPS (6M) by UBLOX

Estimated cost: +-$150. But in my case it was all spare or reused parts from other projects.

Major software components:

  • RASPBIAN (distributed by TonTec with a driver for the screen)
  • GPSD from the distro
  • Espeak speech synthesizer
  • A OSM map from https://www.openstreetmap.org
  • Navit from http://wiki.navit-project.org  I chose the latest and greatest source code and compiled it myself after adding quite a few dependencies. The version in the distro is lacking.
  • NTP to derive a time reference from GPSD. Remember, this project does not connect to the internet at all therefor it would have not had any time reference had it not for the GPS. (see ... adding-a-gps-time-source-to-ntpd/ )

I had quite a bit of help compiling NAVIT from this WIKI: http://wiki.navit-project.org/index.php/Raspberry_Pi

The compilation will take at least 45 minutes to complete. I disabled the compilation of the maptool and the installation of the example map that depends on it via the cmake command.

System wide time reference

This GPS device will be performing without external time reference. Also, the PI does not have an integrated internal clock. What it has is a hardware clock simulation. By default, at each startup, the time on the PI will continue where it left off at the preceding shutdown. Not quite what we want.

What needs to happen is the following:

  • stop ntpd
  • start gpsd
  • wait for a solid time reference from the gps receiver
  • restart ntpd to track the time from gpsd

I added this snippet in the /etc/rc.local file before the "exit 0" command.

set -x /etc/init.d/ntp stop NOW="" while [ "$NOW" = "" ] do NOW=`gpspipe -w | head -10 \ | grep TPV \ | sed -r 's/.*"time":"([^"]*)".*/1/' \ | head -1` done date -s "$NOW" ntpd -gq /etc/init.d/ntp start set +x

This code is not built to give up. If you need to login to fix something, the Ethernet and wi-fi are ready for use should they be connected and pre-configured properly.

Starting NAVIT

Since I chose to compile my own version I decided to build a small script to help with the startup. I did this because the NAVIT source is not ready for system wide installation and should be run in the directory of its compilation. It looks like this:

#!/bin/sh   export TZ=EST5EDT   xset dpms 0 0 0   cd /home/pi/navit-build/navit   ./navit -c /home/pi/.navit/navit.xml

As you see I am using the "pi" user.

I wanted NAVIT to start "automagically" on startup. The default configuration of the raspbian distro has lightdm configured to start automatically. I took advantage of its autostart capabilities by adding a file named ~/.config/autostart/navit.desktop with the following contents:

[Desktop Entry]
Version=1.0 Name=Navit Name[de]=Navit Name[fr]=Navit Comment=The open source vect... Comment[de]=Ein vektorbasi... Comment[fr]=Le logiciel op... Exec=navit Icon=navit StartupNotify=true Terminal=false Type=Application Categories=GTK; Utility; Geography; GenericName=Navit GenericName[de]=Navit

 

Bluetooth speech output

I tried it, it works but ...

When NAVIT outputs a command to synthesize a phrase into speech and sends it to Bluetooth, there is a lag of up to 3 seconds in which Bluetooth initiates a channel towards the device. The channel does not stay open. After a small period of time Bluetooth will close the channel. I built a small workaround that outputs silence in the time gap to keep the channel open. I find this solution quite messy.

An other problem. The Bluetooth solution is interesting to me only if it is possible to use the car as a Bluetooth client device. My Honda only recognizes Smartphones.

Bottom line, Bluetooth is not a good solution for me. 

Analog speech output

The PI can output an analog audio signal via its audio port. I used this to connect the PI to the car's AUX input. It works with no lag and the car's GUI does a good job of handling that input.

The NAVIT XML file provides a way to tailor the appearance and behavior of NAVIT. The syntax for the speech system was frustrating me so I created a small script to handle it. It looks like this:

#!/bin/sh
   espeak -g5 -a 200 -ven+f5 --stdout  "$1" | aplay -

Ah yes, how about the maps

NAVIT can use a variety of map types and interestingly enough, openstreetmaps ... Maps for free for ever! I like that!! (See http://www.openstreetmap.org). The idea here is not to be too greedy. The world maps is huge! The map for Canada is some 2.1GB. That was good enough for me. I actually chose Ontario and Quebec ... 900MB or so.

So it works. Now what?

NAVIT is not perfect and their are quite a few bells and whistles that need to be incorporated into this project to make it really usable.  Such as:

  • A bigger screen. I am looking at 7" screens. ( Could cost $100 or so. )
  • A proper enclosure that will hide the connections.
  • Better dialogs (NAVIT)
  • Better voice
(Creation and modification dates:
2016-06-28 10:23:16
2020-06-04
)
D☆☆☆☆☆
2016:06:28_12:28:34_0011.jpg