After getting started with my Raspberry, I wanted to make it transportable and trackable outdoors as well. That’s when I came across these instructions, which I used as a starting point for this manual.
- Raspberry Pi Zero WH
- SanDisk Extreme micro SDHC A1 UHS-I U3 or similar
- Ublox NEO6M GPS GY-GPS6MV2 incl. antenna
- F-F Jumper cables
- micro USB to USB power cable
- Portable battery pack for outside power-supply
Find out about your OS version by running
My kernel version is
4.14.98+ #2100. To know yours, run
Don’t worry if the kernel version does not exactly match yours, as long as you use the
stretch release, this tutorial should work for you too.
Have the Raspberry turned-off with no power-supply attached and connect the pins according to the following graphics.
Change your command-line boot settings, run
sudo nano /boot/cmdline.txt for that. Now replace all the content inside with:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
Now, enable serial port, disable Bluetooth and set rate to 9600 in your startup settings by running
sudo nano /boot/config.txt. Add those lines to the end of the file:
Install all necessary gpsd software with:
sudo apt-get install gpsd gpsd-clients
sudo nano /etc/default/gpsd and add the serial port:
Change the serial port module rate by running:
stty -F /dev/ttyAMA0 9600
Now, reboot your system with
sudo reboot now.
Start the gpsd socket with:
sudo systemctl enable gpsd.socket
sudo systemctl start gpsd.socket
Have a look into the terminal output to check if the Raspberry is receiving input from the sensor. Run
cat /dev/ttyAMA0 for that.
When using the sensor for the first time, it can take up to 20 minutes to find a FIX (accurate position). You will see a LED blinking on the sensor when this is the case.
It can also happen that you receive a lot of garbage messages like
$GPTXT,01,01,01,NMEA unknown msg*58:
These are caused by an echo, which is enabled by default. In order to remove those, you can create the following file:
sudo nano /etc/systemd/system/no-serial-echo.service
Add the following content to it:
Description=Disable serial echo
ExecStart=/bin/stty -F /dev/ttyAMA0 -echo
To disable the echo in the boot process, run:
sudo systemctl enable no-serial-echo
If you later want to re-enable the echo again, just run:
sudo systemctl disable no-serial-echo
You can get more human-readable coordinates by running
After you got a FIX, you can enter the coordinates into Google Maps. This is great to see how accurate your module is. In my case, it is 51°30'26.2"N 13°17'29.3"E.
Great, you made it work 🙌. You can also check out some of my other tutorials like connecting a camera to your Raspberry.