

Idea:
Build a Race Start Light System instead of saying “Ready, Set, Go”
Concept:
2 IR Detector’s connected to an Arduino Microcontroller listen for 10 pulses from a TV remote coming at 38khz to avoid sun light interference.
If 10 pulses are counted then the Arduino will blink the LED’s 3 times. This tells the racer that the TV remote signal has been received.
A short delay gives time to store the TV remote and to focus on the actual Race start.
The start sequence works similar to an F1 or German Touring Car start. The LED’s come on one at a time with a short delay and go all out at the same time which is the start of the race.
The Arduino resets after the start sequence and waits for 10 pulses again to start the next starting sequence.
Due to the fact that the IR LED’s are pulsed they can be “over driven” as far as current goes – which is the reason why a TV remote works from easily 20-30 feet away.
Video:
Items List:
LED’s
220Ohm Resistors (one for each LED)
Arduino Microcontroller
IR Detectors 38Khz
Costco Apple Packaging
9 Volt Battery
20 or 18 Gage Cable
Tools:
Drill
Soldering Iron
Hot Glue Gun
Total Cost: $40
Time: 4 hours
If you are an Arduino Expert or if you are a “Real” Programmer you will probably get a good laugh out of my code. But hey it works.
I noticed that when I run the Arduino on Battery it tends to pick up noise from the IR Detectors. I was trying to let it time out – say if there is no second pulse detected after 1 second ignore the first pulse cause it is likely noise. Unfortunately I did not get it to work. So instead I have it programmed that it needs to see 10 pulses from the TV remote before a starting sequence is initiated. The Serial print commands helped me during the build and for troubleshooting. They are not essential to the function of the race starting lights.
Here is the complete Arduino Code:
//F1 Style Starting Lights
// Set pin numbers:
const int ledPin2 = 2; // LED 1 connected to digital pin 2
const int ledPin3 = 3; // LED 2 connected to digital pin 3
const int ledPin4 = 4; // LED 3 connected to digital pin 4
const int ledPin5 = 5; // LED 4 connected to digital pin 5
const int ledPin6 = 6; // LED 5 connected to digital pin 6
const int ledPin7 = 7; // LED 6 connected to digital pin 7
const int ledPin8 = 8; // LED 7 connected to digital pin 8
const int ledPin9 = 9; // LED 8 connected to digital pin 9
const int buttonPin = 12; // IR Detector connected to digital pin 12
const int ledPin = 13; // Onboard LED flashes when IR Detector sees beam & stays lit for entire loop
// Variables that will change:
int buttonPushCounter = 0; // counter for the number of button presses
int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button
const int flasher = 200; // Delay of 250 mili seconds for IR signal detected & start sequence initialised
const int ready = 3500; // Delay of 3.5 seconds mili seconds before start sequence
const int timer = 1500; // Delay of 1.5 seconds between starting lights
void setup()
{
// Initialize the LED pins as an output:
pinMode(ledPin2, OUTPUT); // Sets the digital pin as output
pinMode(ledPin3, OUTPUT); // Sets the digital pin as output
pinMode(ledPin4, OUTPUT); // Sets the digital pin as output
pinMode(ledPin5, OUTPUT); // Sets the digital pin as output
pinMode(ledPin6, OUTPUT); // Sets the digital pin as output
pinMode(ledPin7, OUTPUT); // Sets the digital pin as output
pinMode(ledPin8, OUTPUT); // Sets the digital pin as output
pinMode(ledPin9, OUTPUT); // Sets the digital pin as output
pinMode(ledPin, OUTPUT); // Sets IR check LED digital pin as output
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT); //Sets the digitalpin for the button as input
// initialize serial communication – only used for troubleshooting
Serial.begin(9600);
}
void loop()
{
// read the IR Detector input pin:
buttonState = digitalRead(buttonPin);
// compare the buttonState to its previous state
if (buttonState != lastButtonState) {
// if the state has changed, increment the counter
if (buttonState == HIGH) {
// if the current state is HIGH then the button
// wend from off to on:
buttonPushCounter++;
Serial.println(“on”);
Serial.print(“number of button pushes: “);
Serial.println(buttonPushCounter, DEC);
}
else {
// if the current state is LOW then the button
// wend from on to off:
Serial.println(“off”);
}
}
// save the current state as the last state,
//for next time through the loop
lastButtonState = buttonState;
// turns on the LED 13 and Starting Lights every 10 button pushes by
// checking the modulo of the button push counter.
// the modulo function gives you the remainder of
// the division of two numbers:
if (buttonPushCounter % 10 == 0) {
digitalWrite(ledPin, HIGH);
{
if (ledPin == HIGH);
{
Serial.println(“High”);
// Confirm buttonState HIGH by flashing all LED’s 5 times
digitalWrite(ledPin2, HIGH); // sets LED 1 on
digitalWrite(ledPin4, HIGH); // sets LED 2 on
digitalWrite(ledPin6, HIGH); // sets LED 3 on
digitalWrite(ledPin8, HIGH); // sets LED 4 on
delay(flasher);
digitalWrite(ledPin2, LOW); // sets LED’s off
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin8, LOW);
delay(flasher);
digitalWrite(ledPin3, HIGH); // sets LED 5 on
digitalWrite(ledPin5, HIGH); // sets LED 6 on
digitalWrite(ledPin7, HIGH); // sets LED 7 on
digitalWrite(ledPin9, HIGH); // sets LED 8 on
delay(flasher);
digitalWrite(ledPin3, LOW); // sets LED’s off
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin9, LOW);
delay(flasher);
digitalWrite(ledPin2, HIGH); // sets LED 1 on
digitalWrite(ledPin4, HIGH); // sets LED 2 on
digitalWrite(ledPin6, HIGH); // sets LED 3 on
digitalWrite(ledPin8, HIGH); // sets LED 4 on
delay(flasher);
digitalWrite(ledPin2, LOW); // sets LED’s off
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin8, LOW);
delay(flasher);
digitalWrite(ledPin3, HIGH); // sets LED 5 on
digitalWrite(ledPin5, HIGH); // sets LED 6 on
digitalWrite(ledPin7, HIGH); // sets LED 7 on
digitalWrite(ledPin9, HIGH); // sets LED 8 on
delay(flasher);
digitalWrite(ledPin3, LOW); // sets LED’s off
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin9, LOW);
delay(flasher);
digitalWrite(ledPin6, LOW); // sets LED’s off
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, LOW);
digitalWrite(ledPin9, LOW);
delay(flasher);
digitalWrite(ledPin2, HIGH); // sets LED 1 on
digitalWrite(ledPin3, HIGH); // sets LED 2 on
digitalWrite(ledPin4, HIGH); // sets LED 3 on
digitalWrite(ledPin5, HIGH); // sets LED 4 on
digitalWrite(ledPin6, HIGH); // sets LED 5 on
digitalWrite(ledPin7, HIGH); // sets LED 6 on
digitalWrite(ledPin8, HIGH); // sets LED 7 on
digitalWrite(ledPin9, HIGH); // sets LED 8 on
delay(flasher);
digitalWrite(ledPin2, LOW); // sets LED’s off
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, LOW);
digitalWrite(ledPin9, LOW);
delay(flasher);
digitalWrite(ledPin2, HIGH); // sets LED 1 on
digitalWrite(ledPin3, HIGH); // sets LED 2 on
digitalWrite(ledPin4, HIGH); // sets LED 3 on
digitalWrite(ledPin5, HIGH); // sets LED 4 on
digitalWrite(ledPin6, HIGH); // sets LED 5 on
digitalWrite(ledPin7, HIGH); // sets LED 6 on
digitalWrite(ledPin8, HIGH); // sets LED 7 on
digitalWrite(ledPin9, HIGH); // sets LED 8 on
delay(flasher);
digitalWrite(ledPin2, LOW); // sets LED’s off
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, LOW);
digitalWrite(ledPin9, LOW);
delay(ready);
// Turn LEDs on – initiate Starting Sequence:
digitalWrite(ledPin2, HIGH); // sets the LED 1 on
digitalWrite(ledPin3, HIGH); // sets the LED 2 on
delay(timer); // waits for 1.5 seconds
digitalWrite(ledPin4, HIGH); // sets the LED 3 on
digitalWrite(ledPin5, HIGH); // sets the LED 4 on
delay(timer); // waits for 1.5 seconds
digitalWrite(ledPin6, HIGH); // sets the LED 5 on
digitalWrite(ledPin7, HIGH); // sets the LED 6 on
delay(timer); // waits for 1.5 seconds
digitalWrite(ledPin8, HIGH); // sets the LED 7 on
digitalWrite(ledPin9, HIGH); // sets the LED 8 on
delay(timer); // waits for 1.5 seconds
digitalWrite(ledPin2, LOW); // sets the LED 1 off
digitalWrite(ledPin3, LOW); // sets the LED 2 off
digitalWrite(ledPin4, LOW); // sets the LED 3 off
digitalWrite(ledPin5, LOW); // sets the LED 4 off
digitalWrite(ledPin6, LOW); // sets the LED 5 off
digitalWrite(ledPin7, LOW); // sets the LED 6 off
digitalWrite(ledPin8, LOW); // sets the LED 7 off
digitalWrite(ledPin9, LOW); // sets the LED 8 off
{
if (ledPin9 == LOW);
{
Serial.println(“LOW”);
}
}
}
}
buttonPushCounter = 1; //reset
Serial.println(“Reset”);
}
else {
// turn LEDs off:
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, LOW);
digitalWrite(ledPin9, LOW);
digitalWrite(ledPin, LOW);
}
}

...based on a WP Theme by Lorelei and best viewed using Firefox
