Arduino GPS GPX SD

My current project is to make a DIY GPS tracking device.

Part list:

Arduino Pro Mini (5V)
GPS-NEO-6M
MH-SD CARD Module

All this will be neatly connected with soldered wires or headers when it is done, but for now I’m using jumper wires as all parts have soldered pins.

As many of you know an Arduino-file is called a “sketch” and that is exactly what it is – sketchy ­čÖé

My results from the code is not consistent.

The GPS chip works directly when I connect it to a NodeMCU-chip and a 0.96″ OLED. This little machine is generating 7 lines of output on the OLED every second – and it works 100%

 

Same chip connected to the Arduino does not work all the time so I assume it is the code (Sketch) that has some bugs in it as I merged various codes (SD card and GPS )

Troubleshooting is ongoing and I will rewrite the entire code.

The goal of the project is to generate a valid GPX-file. A track of GPS points saved into a file on the SD-card. Same sort of files can then be imported into Google Earth or a Garmin GPS (or any compatible GPS device)

Here you can now follow the track that has been generated by the GPS tracker.

 

I want to use this on my Motorcycle to log where I have been riding so I want it more or less always on.┬á Well, tracking must not be always on (generating the file) but the GPS-chip must be “HOT” i.e no cold boot, waiting for GPS fix signal.
That would not be user friendly having to wait 10 minutes before every ride.

In order to solve that I assume the GPS-chip must be always powered on even if the Arduino is not, well technically they can…but the logging should start when I insert a SD card into the Card holder right?

I have had this SD-card holder for a long time but I have only tested so it works i.e read/wright to and from SD-card.

Pseudo thinking:
When I go out for a ride and I want to track my ride I insert the SD-card.
IT automatically generates the log and when I’m back home I need to safely remove the card. The file is open until closed safely by Arduino (dataFile.close(); ) and how does it know that its done?

I assume I need to either use a switch to run file-ending code when pressed or using a delay where it is not open. I can use a status LED to tell me when it is open or not and I think it is enough to log GPS data every 5 or 10 seconds)
This could give me a 5 seconds window where program loops and a 5 second delay where it is paused (dataFile closed) to safely be ejected.

 

Decisions,┬ádecisions,┬ádecisions…