Equip your Raspberry Pi Zero with a GPRS module
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.
Used hardware:
- 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
Used software:
Find out about your OS version by running cat /etc/os-release
My kernel version is 4.14.98+ #2100
. To know yours, run uname -a
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.
Hardware configuration
Have the Raspberry turned-off with no power-supply attached and connect the pins according to the following graphics.
Software configuration
The following instructions are based on this and that.
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:
dtparam=spi=on
dtoverlay=pi3-disable-bt
core_freq=250
enable_uart=1
force_turbo=1
init_uart_baud=9600
Install all necessary gpsd software with:
sudo apt-get install gpsd gpsd-clients
Run sudo nano /etc/default/gpsd
and add the serial port:
DEVICES="/dev/ttyAMA0"
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:
[Unit]
Description=Disable serial echo
DefaultDependencies=no
Before=basic.target
After=sysinit.target
[Service]
Type=oneshot
ExecStart=/bin/stty -F /dev/ttyAMA0 -echo
[Install]
WantedBy=basic.target
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 cgps -s
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.