Home > Arduino > Scout racing lights – naturally arduino powered!

Scout racing lights – naturally arduino powered!

November 16th, 2009 Ed Leave a comment Go to comments

Inspired by techcobweb’s SlotCarDuino, the night before our scout group’s “Pinewood Derby” (cars made by the kids from a block of wood race down a track, powered by gravity), I decided to make a traffic-light system, and an indicator to say which car one (as there’s sometimes a debate)!

So, in between power cuts (6 days on the trot of less than 8hrs of power per day), with only a few hours of awake time before the event, I dismantled my home automation system (no loss, given there’s barely any power for the heating) and connected up the breadboard, ambient lights and a couple of wires that will act as trip wires. As there are no pull-down resistors, and I have absolutely no components, the trip-wire is connected to ground and then digital pin 3. Running digitalWrite(3, HIGH); enables the pull-up resistor, so whenever the circuit is complete (i.e. car hasn’t driven through the wire) it reads 0.

The way I made the trip-wire was to stick one wire over the track, and rest it in a small uninsulated loop of wire. A quick trip to the scout hut proved this worked, although was in serious need of some debouncing as the vibrations on the track caused the wire to jump around a little.

Simple but reasonable effective race switch

The main loop of the code is very simple, it reads the two trip wire readings, and if one changes it increments a winning counter. If that counter is more than 7000 (fairly random number that seems to work), it turns that lane’s ambient light green. After that happens, when the next trip wire is broken, the appropriate light goes red.

I stole the one component I did have, a switch, from the B&Q ambient light, and wired that up in a similar way to the trip wires. At the start of the loop, it checks this value to see if it has changed (the button is a normal switch, not a temporary push-button), and if it has changed (after some debouncing), it resets some variables, checks the trip-wires have been reconnected (and if not, flash the appropriate light), then runs the red-amber-green starting sequence.

The kids seemed to like it, and other than the odd dodgy connection, and a particularly streamlined car going under the wire, it worked perfectly!!

Next year will be a little more high-tech as I’ll change the trip-wires to some kind of optical sensor, and possibly have one at the start of the race so we can display track times, speeds etc. May even make an automatic releaser, we shall see…

Categories: Arduino Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.