I thought about a problem: When logging the distance, it would be very difficult to distinguish a passing car from a car driving in the opposite direction or any other object on the street when I have the distance only. So I thought about marking when a car passes me directly in the data. The principle is pretty easy. I would just need to press a button and a flag would appear in the data. A practical problem was to get a convenient connection from the backpack to the handle bar. While thinking about that on a long bike ride, I realized that the best solution would be a glove, which sets flags when I press my fingers and thumb together. Each finger could set a different flag so that I have some more options.
So I had a plan. I bought a cheap pair of work gloves and made a four-wire cable from duct tape and copper wire. I sewed this to the glove and added aluminum foil contacts to the finger tips. It is very improvised but works pretty well (for now at least).
On the arduino, I had to add three wires plus pullup resistors (another lesson learned!) and one more cable to the ground. It was getting pretty full on the shield, but no problem still:
It was time to get the software running. I used some code from the SD card examples and mixed it with the sketch I used with the old version. It was easier than expected and after testing and adjusting here and there, it worked very well. Now the arduino saved the exact time, date, distance from both sensors and the three flags from the glove conveniently in a csv file. It still takes almost 20 measurements per second.
So far so good. I attached it back to the camelbag and was ready for another test ride.