arduino-tech

Arduino Program Files

Below is a code listing of the production version of the Arduino code for the logger. This version parses the GPS every 15 seconds, checks for a heading change of 30 degrees or more and then writes a CSV formatted report to the GPS.LOG file. The program also writes a report every 30 minutes regardless of movement.

Additional Functionality

I added a distance calculation that smooths out the track data. Instead of just waiting for 30 minutes to pass or a heading change of 30 degrees I also calculate the difference between the last reported latitude and longitude and the current position. Using the Haversine formula that I found on the Internet, the program calculates the distance between reports. If the GPS has traveled more than 3/4 of a mile it also causes a report to be logged. This helps on long, straight roads such as interstates and highways.

There are lots of comments throughout the code that help explain the functionality of the program. Please feel free to make any changes you want to make the program more well suited to your purpose.

Check out an explanation of the program code.