Introduction: Raspberry Pi GPS Logger
This instructable explains you how to build a compact GPS logger with a raspberry pi zero. The main advantage to this system is that it include a battery and is therefore very compact.
The device stores the data in a .nmea file. The following data can easily be shown in google earth:
This system can be used in places where you don't want to put your smartphone, for example :
- Longboarding (especialy downhill)
- On a drone
Step 1: Material
To realise this instructable you need the following hardware :
- Raspberry Pi Zero with HDMI and USB adapter
- Micro SD card
- Adafruit GPS
- Adafruit 500mAh Powerboost Charger
- Li-Po battery, that can provide enought power for the power boost (2500mAh in tutoriel)
- Stripboard PCB (at least 29x23 holes)
- somme copper wire
- 2x 200 Ohm resistors (or with more resistance)
- 3x 10 kiloohm resistors
- green and red LEDs (LED and resistor pack)
- 3x push buttons
The tools you need :
- computer with an SD card reader
- keboard for the raspberry pi
- display with HDMI
- HDMI cable
- Ethernet cable
- USB to LAN adapter
- Soldering station
- some pincers to cut and bend copper wires
You can use another raspberry pi (not a zero) for the installation if you don't have the right adapters.
Warning: Lithium batteries can be very dangerous! Choose a Li-Po battery that can provide enough power and that has a protection circuit inbuilt. I'm not responsible in the case of an accident.
Step 2: Install Raspberry Pi
To install your raspberry pi you need to download two things :
Be sure to download the 32 bit version of Raspbian.
Install the Win32DiskImager and open it. Select the Raspbianimg file and an empty SD card. Press on the write button, wait until win32DiskImagerhave finished and remove the SD card from the computer.
Step 3: Add Script
The simplest way to add the script is to copy it to the sd card with a computer.
Copy the files from this repository into the partition of the SD card or clone the repository on the raspberry pi and move it into the /boot folder.
Github repository : https://github.com/postronium/raspberry-pi-gps-log...
Step 4: Install Packages
If you have the ethernet and HDMI adapter, connect the raspberry pi zero to a HDMI display and to the network. Put in the SD card and start the raspberry pi. If you don't have the adapters, you can use another raspberry pi for the installation. In this project I used a raspberry pi model B.
Start the raspberry pi and enter the default username : pi and the password : raspberry. Type in the command to start the configuration tool.
Expand the file system to ensure that the entire SD card is used and disable the serial terminal in the advanced section. You may also want to change the password, keyboard layout or enable SSH.
Befor installing the package, reboot the raspberry pi and do an update:
sudo apt-get update
Then install all the python packages for the communication with the GPS and GPIO.
sudo apt-get install python-dev python-rpi.gpio python-serial
Step 5: Configure Crontab
For that the script listens the buttons connected to the GPIO, we need
it to run just after the raspberry pi is started up. To do this we need crontab. Crontab is installed by default.
sudo crontab -e
If an error message shows up just press enter.
at the end of the file, right after the comments, add the following line:
@reboot sh /boot/gps.sh
This will run the script gps.sh after each startup. Save the moddifications and close the editor with CTRL+O and CTRL+X. Your raspberry pi is now ready, you can shut it down with :
sudo shutdown now
Step 6: PCB Diagram
In the pictures you see the diagrammes I made for the PCB of this project.
For the PCB diagram :
- The vertical lines are the jumpers.
- The dots are solder points
- The circles are connections to components outside the PCB
- And the crosses are breaks in the cupper strips.
- The rectangles are resistors (the symbol is the european one)
- The horizontale lines are for better understanding the circuitct
The second image explain each external connection of the main PCB.
You may want to improve, change my diagrammes or add other functionalities to
the circuit. For example, you can add a temperature, humidity or acceleration sensor. But keep in mind that you need space for each component (raspberry pi, gps, powerboost and battery), and that the powerboost USB connector must be accessible to charge the battery.
Note : The diagrammes are views from the copper side of the PCBs.
Step 7: Solder Buttons and LED
For the user interface cut a small PCB to solder the LEDs and buttons on them. If the PCB has copper rows like in the image you need a tool to interupt the cupper strip. If you don't have a tool like this, just use something sharp like a piece of aluminium from an old floppy disk.
On the first image you see the PCB that is done, with a wire for each component (LED or button) and a common ground wire. Each of these wire must be soldered to the main PCB.
Note : The brown copper on the PCB is due to the heat of the soldering iron.
Step 8: Prepare PCB
Cut out a PCB with 23 lines and 29 columns. It is very helpefull if the PCB hase copper rows and not only rings around each hole. Prepare jumpers from a wire to interconnect the rows of the PCB. Interrupt the copper row at the places shown in the diagram from the step 6 (crosses).
Step 9: Solder PCB
Begin to solder the jumpers, because they are the smalles component. Cut off all excess wire and pins.
Continue with the resistors. After the resistors the PCB is done.
We now need to prepare the other PCB (GPS, power boost and raspberry pi). Solder the needed pins to these components (see diagram).
Finally you can solder all the parts together. Be carefull on soldering, the battery connectors mustn't touch each other.
To protect the device put it in a carboard or a box. It's not necessary, it depends where you use it.
Step 10: Usage
Put the installed SD card in the pi zero and power on the device by switching the switch. Until the red LED goes on, the raspberry pi is ready to record the GPS data from the GPS reciever.
The red LED on the GPS reciever is probably blinking once per second, this means that the reciever is schearching satelites. Go outdoor and wait some minuts, the blinking will change from once a second to once every 15 seconds, this means that it has found enought satelites to calculate the coordinates.
- To start recording the coordinates press on the button next to the green LED (start on the diagram).
- To stop the recording press on the buttonnext to the red LED (stopon the diagram).
- To shutdown the raspberry pi press thethird button that has no LED (shutdown in the diagram). After the shutdown of the raspberry pi you can cut off the power supply with the switch.
- To charge the battery connect a USB micro cable to the powerboost and turn on the switch.
- To see the recorded data, put the SD card into the computer and open the .nmea files with google earth.
We have a be nice policy.
Please be positive and constructive.