This is a bicycle journey recording device utilizing Arduino and a GPS module.
I’m riding an electrical bicycle from time to time during weekends.
Several good bicycle riding routes which pass by the lakes and parks are located near to my house.
Therefore, bicycle riding become a favorite personal pastime recently.
For planning the next journey, checking previous riding history becomes very useful and important.
When GPS-based detail route information is available, a more customized and well-organized next bicycle riding journey plan can be made.
Usually, I had just passed by must to visit places such as good places to take a picture or nice restaurants where I can enjoy some special eateries.
When you store such sites information together with GPS route data, your next trip will be more satisfying by looking at the more good things to see and tasting other yummy new foods.
That’s why I made this useful gadget.
Step 1: Components of Journey Recorder
GPS data recording device requires several sub-components as it should support signal receiving from satellites, processing/displaying, and storing data to SD card of functions.
All necessary break-out modules and electronic components are assembled as three parts such as:
– GPS antenna and receiver circuit module
– Main data processor circuit module which includes Arduino and LCD display
– Power supply module
The analog ampere meter shown in the picture above is connected just for power consumption measuring purposes.
When riding a bicycle, it’s not necessary and simply can be removed.
About 200mA is required to power up the GPS journey tracker circuits.
Let’s look into more details at how this circuit is made.
Step 2: Parts
Firstly, I tried to assemble every break-out board and electric component into a single enclosure.
But as you can see, several small break-out boards that need to be interconnected to the journey tracker circuit.
Therefore, three small acrylic chassis are utilized instead for housing-related small break-out boards together to each module.
The following parts were used for this project.
– Arduino pro-mini 5V
– SD card module 5V and SPI interface
– 2GB micro SD and SD socket
– 16×2 I2C LCD module with PCF8574 controller
– Neo-6M GPS module and antenna
– 18650 lithium-ion battery (3.7V)
– 5V fixed Boost up voltage regulator
– Universal PCB board, pin-head, and cable wires
– Acrylic boards, 3.5mm bolts, and nuts
No exotic parts are used for this project.
You can easily purchase all break boards and electronic components at internet shops.
Step 3: Schematics
As four break-out boards are interconnected with Arduino pro-mini, wiring is relatively a little bit complex.
But only SCL (A5) and SDA (A4) with PCF8574 I2C LCD module is dedicated wiring.
Other connections can be changed according to the configuration setting in the sketch program.
For the wiring of Arduino pro-mini, the following connection is used.
– 5V output from power supply to RAW pin of Arduino pro-mini board
– GND of power to one on GND pin (There are 2 GND pins are available with pro-mini)
– 5V power input of all other break-out boards (GPS, SD card, and 16×2 LCD) will be connected from Vcc pin of pro-mini
SD card break-out requires relatively many connections like below to support SPI communication with pro-mini.
– CLK of SD card module to PIN 13 of pro-mini
– MISO to PIN 12
– MOSI to pin 11
– CS to PIN 4
The above connections are typical wiring conventions as defined in “SD.h” header file.
When you are using other wiring methods, port connection definition should be re-declared in sketch program.
Neo-6M GPS module needs TX and RX connection with pro-mini.
I’m using the following connection between Arduino and GPS module.
– Tx of GPS module connected to digital pin 5 of Arduino pro-mini
– Rx to Pin 6 of pro-mini
Instead of a power switch, I’m using a simple jumper wire and 3 pin-head terminal for supplying 5V power to the overall journey tracker circuit.
You can see the jumper wire turn to the power switch later when looking at more detail of the power supply module.
Step 4: GPS Module
The GPS module consists of controller break-out and Antenna.
Because a tiny wire is connected from antenna to controller, both components should be tightly mounted on something sturdy chassis.
I used acrylic boards for firmly mounting and fixing both components of the GPS module.
Also, the Velcro band is attached to the backside of the GPS module to be firmly fixed on the back bag mounted on the rear of a bicycle.
For correct operation of the GPS module, the antenna should face upward toward the sky to receive signals from at least 3 satellites.
Therefore, you need to go out to an open space where any building’s height does not obstruct satellite signals as the line of sight.
When signal reception is possible from satellites, tiny blue light LED on the controller break-out board start to blink.
Step 5: Main Computing Module
This is the main processing module as it includes Arduino pro-mini board, SD card reader/writer as storage, and 16×2 LCD as output peripheral.
As the journey tracker circuit should be carried by bicycle, a relatively small microprocessor board such as Arduino pro-mini is chosen.
Also, pro-mini is consuming less power from the 18650 lithium-ion battery.
As many web contents are available on Internet, I will not explain the PCF8574 I2C LCD module interface method.
You should check factory assigned I2C address of the LCD module is 0x27 (default setting).
When the default address is different (some device is configured as 0x3f), communication between Arduino and LCD is impossible. (Therefore, nothing is displaying on LCD)
Please refer to other web content for more details about the PCF8574 I2C LCD module interface.
For logging GPS data to the SD card module, formatted as FAT 16(32) file system type of SD storage is necessary.
When wiring between Arduino and other break-out modules are carried out as shown in the schematics above, about 80% of journey tracker circuit making is completed.
Step 6: Power Supply Module
This is a power supply module that supplies 5V power to the whole journey tracker circuit.
The power source is a 3000mAh capacity of 18650 lithium-ion battery.
As shown in the head of this story, the total power consumption is about 200mA.
Therefore, approximately 15 hours of journey tracker circuit operation can be supported with the battery.
When you look at the right below side of the picture above, the jumper wire is connected to 3 pin-header socket.
This jumper wire is acting as a switch when connected between 1 and 3 pin-header terminals.
When the jumper wire is connected, 3.7V of the battery output voltage is supplied to the 5V voltage booster regulator break-out board.
Therefore, the red power LED of the 5V voltage booster regulator break-out board is turned on.
Power output from the voltage regulator will be connected to Arduino power input pins such as RAW and GND.
Step 7: Sketch Program
The program of the journey tracker is simple and easily understandable of the overall operational logic.
As depicted in the flowchart above, all relevant libraries should be included as follows.
– SoftwareSerial and TinyGPS is necessary for receiving GPS data from satellites
– LiquidCrystal_I2C is required for activating PCF8574 I2C LCD module
– SPI and SD is standard libraries for interfacing SD card module
Subsequently, three device drivers are initialized including Neo-6M GPS (including software serial driver), PCF8574 I2C controller, and SD card module.
Then serial ports of the GPS module continually are monitored whether any data is available.
When the GPS module is receiving at least three satellite signals, the NEMA standard format of GPS data packet will be received.
A geographical location and exact time data can be received by the following system calls.
– gps.f_get_position(&flat, &flon); // Get latitude and longitude coordination data
– gps.crack_datetime(&years,&months,&days,&hours,&minutes,&seconds,&hundredths); // Get exact time data
The captured coordination and time data will be stored as a text file on an SD card and displayed on the LCD display.
Subsequently, GPS data capturing, saving, and displaying will be continued endlessly until power is off.
Step 8: Collected GPS Data Problem
What is shown above is actual data captured by the journey tracker while I had gone for lunch to Burger King.
Captured data is converted to KML format and loaded on Google Maps.
I’ll explain converting captured raw GPS data to KML file.
Before making the KML file, cleansing and optimizing of raw GPS data file shall be necessary.
When looking at raw GPS data file captured by journey tracker, latitude and longitude data is collected per 2~3 seconds.
This means that at least 1200 ~ 1500 GPS coordination records will be stored during 1 hour trip by bicycle.
When you load this much of data on Google Maps, pinpointing each location will be very difficult as shown in the picture above.
Therefore, preprocessing of the raw GPS data file is recommended for making a more legible bicycle riding route on Google Maps.
I’m using a python program to optimize the raw GPS file as follows.
– Remove duplicate longitude/latitude coordinates (The same longitude/latitude means that I had stayed at a certain location for a while)
– Sampling 1 coordination data among 10 records
When the total number of GPS coordination data is about 100 per 1 hour, the point icon depicted on Google Maps will be more legible and easy to modify.
Step 9: Making KML File
The collected GPS coordination can be converted to KML file format.
You can download GPS to KML file converter excel macro from the website.
The name of the converter macro file is excel2kml.xls.
A simple direction for making the KML file is described in the “instruction” sheet of the excel2kml.xls file.
The general procedure for making the KML file is as below.
– input longitude and latitude coordination to “data” sheet
– press Alt+F8 for executing macro
– myfile.kml file will be created in C:\ directory
Step 10: Finally Making My Map
The KML file produced can be loaded on the Google map.
For making a personal map with the KML file, you need a Google account.
The personal map-making procedure is as below.
– Select “my place” menu
– Enter “Create Map” menu
– Loading KML file from the local disk
When KML file loading is completed, each GPS coordinate shall be depicted on the Google map.
If any editing is necessary, you can select each point (single GPS coordination) to change location information, remark, and add a digital photograph to the point.
Finally, my own personal map is made from the journey tracker.
Thank you for reading this story.