With a GPS module and a few minutes hacking, transform PocketC.H.I.P. into an open source TomTom-like dashboard navigation system. Installs in seconds. No pesky automotive wiring necessary. Pencil stand not suggested (on your dashboard).
Ever since Scott got PocketC.H.I.P. working with a GPS module and the GPSd software, I’ve wanted to setup offline turn-by-turn navigation on PocketC.H.I.P.. While there are a handful of options in Linux, I ended up going with Navit.
Navit is in the Debian package repository, so it’s quite easy to install on PocketC.H.I.P.. But due to the enormous number of options, configuring Navit can seem daunting. After getting the basics setup on my PocketC.H.I.P., I shared my progress with Jose who helped me get the config dialed in. Keep reading after the break for full instructions, plus our config file.
This project uses the same parts and tools from Scott’s Get Your Bearings with this PocketC.H.I.P. and GPS Project.
- Wire snips
- Soldering iron and solder
- Heat shrink tubing
- Lighter (or hot air gun)
- Hot glue gun and glue
Use apt to update the list of available packages for PocketC.H.I.P.. It’s easy, just type the command below and press enter.
sudo apt update
Note: When prompted for a password, type chip and press enter.
Locales on PocketC.H.I.P. define the region and language the software should use. For most packages it doesn’t matter too much if locales are fully setup, but Navit is particularly verbose with warnings unless you’ve set them up just right.
Type the command below and follow the onscreen instructions.
sudo apt install locales && sudo dpkg-reconfigure locales && sudo locale-gen
Use the arrow keys and tab to move around, and spacebar to mark your desired selection. Many locations have multiple entries. Select your desired region with UTF8.
Note: In BASH, && is a way to connect two (or more) commands together. The second command will run only if the first command runs successfully.
Install Navit and a few other required packages by using apt.
sudo apt install gpsd gpsd-clients python-gps navit
Jump over to Scott’s GPS tutorial and follow steps 1 and 2 where you’ll learn how to physically wire your GPS module to a USB-to-Serial adapter. Once you’ve finished the wiring, it’s easy to connect and disconnect the GPS from PocketC.H.I.P..
With the GPS connected to PocketC.H.I.P., you’re ready to configure some software. First turn off and disable the systemd GPS service. This might seem counter intuitive to turn it off, but the GPSd program doesn’t use systemd and you won’t display GPS data unless you disable it.
sudo systemctl stop gpsd.socket
sudo systemctl disable gpsd.socket
To start GPSd run the command below.
sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock
Note: You’ll need to run this command each time you restart PocketC.H.I.P. and want to use the GPS.
Quickly verify that GPS is working on your PocketC.H.I.P. by running cgps. When you see that it’s receiving location data like in the image above, press q to exit the program.
All of the configuration files for Navit should be placed in /home/chip/.navit, but you’ll need to create the directory and configuration by hand, since Navit does not automatically set things up for you. For an overview of the many configuration options, check out the Navit Wiki.
mkdir ~/.navit && cd ~/.navit
Note: Directory names that begin with a period are considered hidden directories. To see them type
Download the .xml configuration file to the ~/.navit directory.
wget -O navit.xml http://bit.ly/2cr2qmn
Open the navit.xml file with your Nano and look up the longitude and latitude of the town you live in.
Enter in these coordinates to line 34, replacing LONGITUDE and LATITUDE of the config file and save.
<navit center="LONGITUDE LATITUDE" zoom="8" tracking="1" orientation="-1" recent_dest="10">
Note: Here’s how your config would look if you’re at the McMurdo Station research facility in Antarctica.
<navit center="77.8419 S 166.6863 E" zoom="8" tracking="1" orientation="-1" recent_dest="10">
On your laptop, open a web browser and use the map extractor to select a region of the globe you would like Navit to have access to even while you are offline. The Predefined Area button offers an easy way to quickly pan to the area you’re interested in and zooming allows for greater region specificity.
Once you have a the desired area in view, click the selection radial and use the select rectangle to highlight a portion of the map you want available offline.
Click Get Map! and the selected area will download to your computer as a .bin file. Rename the file map.bin.
Note: The size of the map file will vary depending on how large the region is you selected. For a complete offline map of the Bay Area you should expect a file about 100 MB, for the entire continental United States you’re looking at about 3.5 GB, and for the entire globe around 20 GB plus.
Copy the map.bin file from your computer to a USB thumb drive. Then remove the USB-to-Serial cable from PocketC.H.I.P. and insert the thumb drive. Tap on the File Browser icon on PocketC.H.I.P. home and the thumb drive should show up in the list of folders in the left of the window. Drag the icon of the map file from the thumb drive to the chip user’s home directory.
Once the file has transferred, tap the eject log (a triangle with a bar under it) and remove the thumb drive. Then, reconnect the USB-to-Serial adapter.
Finally, open the Terminal and type the following command.
mv ~/map.bin ~/.navit/map.bin
Note: Alternatively, you could use SCP to copy the map.bin file to PocketC.H.I.P., just make sure it ends up in the directory ~/.navit.
To start navit, load your configuration file, and the offline map data, simple type the command below. Best of all, Navit is built for touchscreens, so it’s easy to control with PocketC.H.I.P.!
Now you built the PocketC.H.I.P. Navigator, where are you planning to take it?
Make sure to let us know in the comments below. And if you’re working on a cool C.H.I.P. or PocketC.H.I.P. project, don’t forget to share your progress with the entire community in the forum and on twitter!