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.
What you will need:
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.
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.
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.
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.
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
- python 2.7
To launch the application on startup:
- copy the file
app.pyto the directory
- create a file
raspberry-pi-gps-logger.serviceto the directory
- run the following command lines:
systemctl start raspberry-pi-gps-loggerand
systemctl enable raspberry-pi-gps-logger
[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
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: