Anker Berg-Sonne’s passions for autocross high-speed racing and DIY electronics crossed paths when he found himself in need of a data logger to analyze his driving skills. Rather than purchasing a data logger, he chose to build his own and customize it to his needs.
“The first [data logger] I made used the GPS Data Logger Shield and logged serial NMEA data to files on a microSD card,” he said, of his project’s first iteration. “The big challenge was to be able to keep up with the data stream from the GPS on the shield. To deal with that, I decided to use an Arduino Mega 2560 so I could use a hardware serial port instead of SoftwareSerial.”
He noticed that the time spent writing data to the microSD was also a challenge. For the Mega 2560 to keep up with the 10-hertz data stream from the GPS, Berg-Sonne had to do minimal parsing, keep messages sent from the GPS to an absolute minimum, and send the data to the microSD with as little processing as possible.
Tracking autocross data presents a unique challenge, because the cone course changes for every race, so Berg-Sonne made the logger operate in two modes. In one mode, he marked the GPS coordinates of the cone course by pressing a button on the logger at the position of every cone. In the other mode, data was logged any time the speed of the car exceeded 10 miles per hour.
“Using car speed to trigger logging turned out to work really well,” he said. “Most commercial data loggers require that you manually turn logging on and off, or they require that you very carefully mark the start and end of the course to turn logging on and off. Autocrossing is very intense and it is very easy to forget to start the logger at the start of a run! With my logger, you don't have to worry about that.”
Mapping of multiple runs showing starting and stopping points.
“The reduction of overhead resulting from switching to u-blox allows me to continue to use the MEGA 2560 with the GPS running at 20 hertz,” he said, “which is something that wouldn't have been possible with NMEA. It also helps that the u-blox receivers support I2C."
A PC application he wrote read the microSD card and output Microsoft Excel .csv files that only contained data from runs. As it read a log file from the microSD card, it started saving data when the car entered the course, and closed the file when it determined the car had exited the course. The application also allowed the creation of an Excel file that synchronized two runs, so the positions of the two runs matched up on every row. Berg-Sonne then used Excel's graphing features to visually compare his performance on the two runs. He could also load the files into Google Maps, mark cones and run tracks on a map.
While this solution worked well, Berg-Sonne decided he could improve it with GPS positioning and sample rates. The integration of the GPS chip and microSD card also did not facilitate easy upgrades, which was one of his main goals. He set out to create an updated version that used separate GPS and microSD breakouts. After some trial and error (and reaching a self-professed “performance dead end” with serial NMEA data logging), he discovered SparkFun’s u-blox-based GPS breakout boards.
According to Berg-Sonne, the u-blox boards were able to improve the precision of his data logger by supporting more than 10 hertz of data streams; supporting RTK, which provides improved precision down to one centimeter; and using a binary protocol, which has much less overhead than serial NMEA.
“The reduction of overhead resulting from switching to u-blox allows me to continue to use the MEGA 2560 with the GPS running at 20 hertz,” he said, “which is something that wouldn't have been possible with NMEA. It also helps that the u-blox receivers support I2C.”
But he’s not done innovating yet. Berg-Sonne said the next phase will be to use RTK for real-time error corrections, with a base station using an RTK receiver, coupled to a transceiver, that sends the correction data to the loggers within range.
When asked how accurate he needed his GPS to be, Berg-Sonne said two centimeters would be ideal. Hopefully, with the updates he is making to his design, he will be able to reach his goal of two-centimeter accuracy!
Dashboard view of data logger.