Get Turn-by-Turn Directions with the PocketC.H.I.P. Navigator

blog

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.

Parts

This project uses the same parts and tools from Scott’s Get Your Bearings with this PocketC.H.I.P. and GPS Project.


Tools

  • Wire snips
  • Soldering iron and solder
  • Heat shrink tubing
  • Lighter (or hot air gun)
  • Hot glue gun and glue

1. Update PocketC.H.I.P.

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.


2. Setup Locales

locales

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.


2. Install Navit

Install Navit and a few other required packages by using apt.
sudo apt install gpsd gpsd-clients python-gps navit


3. Connect the GPS module to PocketC.H.I.P.

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..


4. Systemd Configuration

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


5. Start GPSd

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.


6. Test the GPS

Testing the GPS with output from cGPS

Testing the GPS with output from cGPS

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.
cgps -s


7. Edit the Navit Configuration Files

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 ls -al.

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.
nano ~/.navit/navit.xml

Enter in these coordinates to line 34, replacing LONGITUDE and LATITUDE of the config file and save.

Note: Here’s how your config would look if you’re at the McMurdo Station research facility in Antarctica.


8. Select a Map Region For Offline Use

Use the Navit map extractor to select the information you want available offline

Use the Navit map extractor to select the information you want available offline

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.


9. Copy the Map Data to PocketC.H.I.P.

Transferring offline maps to PocketC.H.I.P. from a mounted USB thumb drive

Transferring offline maps to PocketC.H.I.P. from a mounted USB thumb drive

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.


10. Get Directions

A portion of the Navit turn-by-turn directions from Oakland to San Francisco

A portion of the Navit turn-by-turn directions from Oakland to San Francisco

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.!
navit


chipLogo64x64

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!

About the Author

Posted by

I'm busy writing and editing content at Next Thing Co.

Categories:

PocketC.H.I.P.

Tags:

,

3 Comments

Add a Response