The goal of this project is to record raw NMEA frames from a GPS receiving map. I chose a minimalist interface with a red diode and a push button.

1 Hardware

1.2 Equipments

What you will need:

knolling Knolling

1.2 Wiring the GPS to the RPI

You have to be careful about RX and TX connections:

  • connect the TX pin of the GPS to the RX pin of the RPI.
  • connect the RX pin of the GPS to the TX pin of the RPI.

wiring Wiring

1.3 Overview of the electronic schema

Resistance value for LED mounting:
It is commonly accepted that the standard LEDs work well with a resistance 100 times higher than the supplied voltage.
So I use in my assembly a resistance of 330ohm, for a voltage of 3.3 V

Mounting the push button:
The pull-up resistors allows to have a clear high or low voltage so that the RPI can read the input value unambiguously.

The capacitor:
When pressing the button there is a creation of interference signals induced, so we add a capacitor to improve the quality of the push button signal.
When the button is pressed, the capacitor discharges in a controlled manner and thus the signal is filtered.

Protection resistors:
The GPIO 4 pin can be initialized in the program as an output or as an input.
The aim of the protection resistor is to protect the GPIO pin if it is accidentally set as an output rather than as an input.

schema.jpg
Schema

Nomenclature :

Schematic ref Description Value
J1 raspberry pi
J2 neo6m module
SW1 push button
D1 led 5mm
C1 capacitor 100 nF
R1 resistor 10 kohm
R2 resistor 1 kohm
R3 resistor 330 ohm

2 Software

2.1 The detail of the design

  • when the program starts, the LED flashes quickly, the program waits for the push button to be pressed.
  • a short press on the push button:
    • triggers the recording of NMEA frames, the diode remains lit
    • or pauses recording, the LED flashes slowly
  • a long press on the push button stops the program
  • to restart the program, you must restart the Raspberry pi

flowchart Flowchart

2.2 Dependencies

  • python 2.7
  • python-serial

2.3 Installation

To launch the application on startup:

  • copy the file app.py to the directory /home/pi/
  • create a file raspberry-pi-gps-logger.service to the directory /lib/systemd/system/
  • run the following command lines: systemctl start raspberry-pi-gps-logger and systemctl enable raspberry-pi-gps-logger

File raspberry-pi-gps-logger.service:

[Unit]
Description=Data recorder
After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/python /home/pi/app.py

[Install]
WantedBy=multi-user.target

2.4 Data post-processing

To view the recorded data, you need to convert the .nmea to .gpx
You can use the following command:
gpsbabel -i nmea -f file-in.nmea -o gpx -F file-out.gpx

The source code

The source code is available on Github:
https://github.com/Pinaute/raspberry-pi-gps-logger/blob/master/app.py