Derby Car detector


I would like to use my Arduino to create a cub scout Pine-wood derby car race timer/ win detector.

I believe that this should be possible. My plan is to mount 4 to 5 sensors about 1 foot over each corresponding lane and report when each car crosses the Finnish line back to the compuer. Is there like a motion detector, or maby a photo reflector will work?

I cannot post pictures of links until after I post this. sorry.

Of course that should be possible ;)

Basically what you're looking for is a constant light beam (from an LED, for example) projecting onto a phototransistor (such as a BPW40). The phototransisor is connected on one side to Vcc and on the other to an input pin of your Arduino. Example schematic here.

When the beam is interrupted the input signal to Arduino changes, which is a trigger for the software to do something intelligent.

You could embed the LED in the track and the photodiode vertically above it. Or you could place some reflective matter (aluminium foil?) on the track and both the LED and the phototransistor above it, in such a way that the light from the LED is reflected by the foil, back to the photodiode. I image that would require more precise engineering and adjustment though.

I have used a photodiode and a miniature laser to act as a 'gate' for passing objects. But for small distances a high powered LED may work.

One soultion that should be quite easy to embed a powerful, narrow angel LED in each track. On the "bridge" aboe the tracks over each LED you place a LDR (light dependent resistor). The LDR's should be in a black tube to shield them from ambient light and the other LEDs.

Each LDR is hooked up with a fixed resistor as a voltage divider to an analog in pin on Aduino, then you constantly use analogRead() to watch for sudden changes. You should expect small changes even without a car passing the finshing line, so you probably have to experiment with a minimum treshold change in the value read from the analog pin to determine if a car passed the line under the LDR.

The whole setup would probably require some calibration to account for differences in ambient light etc.

Hey everyone

Thanks for all of the responses. I love the simplicity of the second Idea however, we are borrowing the track and I don't want to have to mod the track unless it doesn't harm the track... Therefore it looks like option 1 is the way to go. (unless we have a last minute post) I was looking at photo transistors and after seeing the number of connections required, will I be able to have 5 or 6 different sensors all sending the time and keep remember what track the sensor can from? If so what phototransisor should I buy. I was looking at and there appears to be 2 choices.

Thanks for all your help. The Kids thank you as well.

I guess you could use the QSD124 in combination with QED123 (haven’t used these myself, but they seem generic enough), but there’s no product information which might help make a choice between the -124 and the -724.

Using IR LEDs has the disadvantage that you can’t see whether they’re actually on or off (for troubleshooting purposes). Aligning them with the phototransistor may be more difficult than using a non-IR LED. too.

I don’t know how experienced you are w/ electronics, so I just say “don’t forget to use a series resistor with each LED”. :wink:

The Duemilanove has 14 digital inputs and 6 analog ones - take your pick. Hook up the phototransistors to their inputs and see what the signal does when they’re dark and light. I’d use an analog input and empirically find a cut-off point that tells whether a car is passing underneath or not.

You could use an array with six fields keep track of time, one field for each car. For example: unsigned long CarsTimes[6];

When the cars are released, initialize a helper variable to keep the then current value of millis(). Then continuously monitor the values of the 6 (analog) inputs to see if a car passes the finish. When a beam is interrupted by a car (say, number 3), take the value of millis() again and subtract it from the value you stored in the helper variable at the moment of car release. This will be the time (in milliseconds) it took for this car to reach the finish.

Do so for all six cars, or until a predefined time out is reached (in case a car leaves the track - you don’t want to wait indefinitely).

Then think about a way to present the results, either as a time (on LCD?) or as a ranking (LED display).

Have fun :slight_smile:

Or... you could use microswitches. Suspend one over each track and attach a plastic coffee stirrer thingy to them.

Car hits coffee stirrer, circuit is closed, Arduino has the time.

Low tech, no optical alignment needed, less software development needed and cheaper than the optical solution. But it doesn't look as sophisticated.

My only concern would be if the cars are heavy enough to operate the microswitches, not having any experience with Derby cars other than the Pinewood Derby episode on Southpark.

You might want to take a look at this:

Of course only the photo detector part of it is interesting for you.