[tutorial] Serial GPS on Raspberry Pi
How to connect and use a serial GPS on Raspberry Pi
0) What you need:
- Raspberry Pi 3B or 3B+. I used 3B+.
- GPS module with TTL serial interface and cables to connect it. I used Locosys LS20031.
- MicroSD card with lots of space for maps. I used a 8 GB card.
- computer with a microSD card reader.
- Windows 7 to install Emteria OS.
- Linux (any) to edit Emteria files.
1) Write a fresh Emteria on the card. I used Emteria v0.7.1.
- Follow official instructions.
- Don't remove the card from the computer when finished.
2) Edit config.txt on the boot partition and enable serial port.
- Open config.txt and add the lines below. If these settings already exist, edit them to match.
Check the baud rate in the GPS module documentation. Mine is 9600 bps.
Don't use pi3-disable-bt or pi3-miniuart-bt. If you do, serial ports will be reversed.
3) Edit build.prop on the system partition and specify GPS serial port.
- Boot linux and mount the system partition on the card.
- Edit build.prop and add the line below. If the setting already exists, edit to match. My serial port is ttyS0.
If you reversed the serial ports, use ttyAMA0.
Don't use the full path (/dev/ttyS0), just the port name!
4) Create etc/gps.conf and specify GPS serial port.
Create etc/gps.conf on system partition. Add these lines and adjust them to match your serial port and speed.
Use the full path to serial port (/dev/ttyS0), not just the port name!
5) Save all, umount, and move the card to your Raspberry Pi.
6) Connect the GPS module.
7) Power the Raspberry from a mobile power source, boot Emteria and go outside.
8) Open Settings and enable location.
9) Install GPSTest or navigation app to check if it's working.
I hope this helps. I had a very hard time making it work.
Other info you may find useful:
- Raspberry Pi serial port can be specified as serial0 which always points to the correct serial port (the one on the GPIO header). I didn't test this in Emteria yet. It works in Linux.
- If the default serial port pins are occupied, serial port can be moved to two other locations on the GPIO header, and if you disable bluetooth, both serial ports may be accessible. I didn't test this in Emteria, but it works in Linux. Use one or two of these lines in config.txt: