Ingredients:
- 1 x Raspberry Pi
- 1 x GPS shield for Raspberry Pi
- 1 x Antenna
- 1 x Two small wires (Red an Black)
NOTE: If you don’t have a Raspberry Pi you can get one buying a Raspberry Pi Starter Kit.
Difficulty: Medium –
Preparation Time: 30 minutes
NOTE: All the code examples in this tutorial use the arduPi library. You can see the documentation and download the library here.
Steps Index
Steps Index:
- Connecting the GPS module to Raspberry Pi.
- Getting GPS NMEA sentences using cutecom.
- Getting GPS NMEA sentences in a Raspberry Pi program.
- Controlling the output of standard NMEA messages.
- Important Issues.
- Video-Tutorial.
Step 1: Connecting the GPS module to Raspberry Pi:
The GPS module for Raspberry Pi is a small electronic circuit that allows to connect to your Raspberry Pi board to get position and altitude, as well as speed, date and time on UTC (Universal Time Coordinated). It uses the standard NMEA protocol (http://www.nmea.org) to transmit the position data via serial port.
For connecting the GPS module to a Raspberry Pi we need to use the Rx and Tx pins of the shield.
Once the GPS is connected, you have to connect power to it. Using two small wires (red for 5V and black for GND). See the picture.
Step 4: Controlling the output of standard NMEA messages:
There are some NMEA commands that we can use for controlling the output NMEA messages of the GPS module. We can activate / deactivate each NMEA message (GGA, GLL, GSA, GSV, RMC and VTG) sending to the module these commands.
GGA:
Activate => $PSRF103,00,00,01,01*25
Deactivate =>$PSRF103,00,00,00,01*24
GLL:
Activate => $PSRF103,01,00,01,01*24
Deactivate => $PSRF103,01,00,00,01*25
GSA:
Activate => $PSRF103,02,00,01,01*27
Deactivate => $PSRF103,02,00,00,01*26
GSV:
Activate => $PSRF103,03,00,01,01*26
Deactivate => $PSRF103,03,00,00,01*27
RMC:
Activate => $PSRF103,04,00,01,01*21
Deactivate => $PSRF103,04,00,00,01*20
VTG:
Activate => $PSRF103,05,00,01,01*20
Deactivate => $PSRF103,05,00,00,01*21
Also it is possible to change the frequency of the output, see the GPS module firmware documentation.
This configuration will be lost when the GPS module is powered OFF.
Step 5: Important Issues:
Important Issues:
- Handle with care the internal antenna. It’s fragile.
- The GPS module should be inside a plastic box, isolated from the environment.
- The antenna must be in horizontal position.
- For improving the satellites signal, the antenna has to be in a place with a clear sky view (no trees, no buildings…).
- Maybe the GPS module takes 2-3 minutes to get signal the firs time.
For more detail: GPS Module for Raspberry Pi Tutorial