loading
I'm new to Arduino so I was excited to try this out.  I also Drag race 1/24 scale slotcars.  I built a homemade 24' drag strip to practice. I need the tree to be the same as the race track  so my reaction time might  improve.  I'm not sure if I have the timing right, but it's getting close. See the video below.



The Arduino = Arduino UNO purchased at Radio Shack

The Breadboard=  Radio Shack (not necessary, but I already made the prototyping stand.  http://www.instructables.com/id/Acrylic-Arduino-Prototyping-Stand/)

LEDs and jumper wires = you guessed it... Radio Shack

The power source is Altoids charger that supply's 5v to the Arduino board  ( http://www.instructables.com/id/Another-Altoids-Ipod-Charger/)
You can also use a 9v battery with  resistors that are appropriate or use usb from laptop or desk top computer.  

The software I used I downloaded from  http://arduino.cc/en/Main/Software

I understand there are many ways one can do this. I chose to build it this way because this is what I had.  

I connected the jumper wires to the #2,4,6,8,10 pins found on the Arduino board and the long leg of the Led are placed in line with the end of the red jumper wires on the breadboard.
.
The ground pin is located above the #13 pin  (GND) on the Arduino board. 


The Code I wrote is a modified version of the blink example: 

/*
  Blink
  Turns on an LED on for 1 second, then off for 1 second.
 
  This example code is in the public domain.
*/



void setup() {
 
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(2, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(10, OUTPUT);
}

void loop() {
  digitalWrite(2, HIGH);  // White Led on for 1 second
  delay(1000);            
  digitalWrite(2, LOW);   // LED turns off for 1/2 second  
  delay(500);             
  digitalWrite(4, HIGH);  // Yellow led on 1/2 second   
  delay(500); 
  digitalWrite(4, LOW);   // LED turns off for 1/2 second
  delay(500);  
  digitalWrite(6, HIGH);  // Yellow Led on for 1/2 second
  delay(500);            
  digitalWrite(6, LOW);   // LED turns off for 1/2 second
  delay(500);             
  digitalWrite(8, HIGH);  // Yellow Led on for 1/2 sec 
  delay(500); 
  digitalWrite(8, LOW);   // LED turns off for 1/2 second
  delay(500);
  digitalWrite(10, HIGH);   // Green Led on for 2 seconds
  delay(2000);            
  digitalWrite(10, LOW);   // Green LED turns off for 3 seconds
    delay(3000);
}






As soon as I learn how to move it to it's own board and add a start switch I will put it in a box and mount it permanently.
 
<p>Can this be scaled up to maybe 1/8 Scale ? </p>
and some 220 Ohm too so the leds will last longer.
<p>the leds aren't lit for long enough in the code to harm the leds they need extended periods of overcurrent to fry! Cheers</p>
Super cool. I was going to make one. Had one instructable in progress before I saw this one but deleted it. might go back and work on it again. I wanted lights for both tracks and test for early start.
That would be great. I am so new to this that I had to start as easy as possible. <br>I hope you do finish yours so I can learn from it.
Looks like your doing pretty well. <br>
Here is the same code but with some modifications. I have change the timing and adde another white led I have been drag racing almost all of my life (EVOs, Hondas, RX7's) and I think It looks more closer to the real &quot;Tree Light&quot;. And I do not want you to think that you are wrong on your instructurable. I just want to help you making the best Tree Light for your practices. ;) <br>First I add another white led. That one is Pre Stage (Pin 2) and the second one is for the Stage (Pin 3). Then I have change timing in between the leds so here is the code: <br> <br>/* <br> Blink <br> Turns on an LED on for 1 second, then off for 1 second. <br> <br> This example code is in the public domain. <br>*/ <br> <br> <br> <br>void setup() { <br> <br> // initialize the digital pin as an output. <br> // Pin 13 has an LED connected on most Arduino boards: <br> pinMode(2, OUTPUT); <br> pinMode(3, OUTPUT); <br> pinMode(4, OUTPUT); <br> pinMode(6, OUTPUT); <br> pinMode(8, OUTPUT); <br> pinMode(10, OUTPUT); <br>} <br> <br>void loop() { <br> digitalWrite(2, HIGH); // White Led on for 2 second Pre Stage <br> delay(2000); <br> digitalWrite(2, LOW); // LED turns off for 1/2 second <br> delay(5); <br> digitalWrite(3, HIGH); // White Led on for 1 second Stage <br> delay(1000); <br> digitalWrite(3, LOW); // LED turns off for 1/2 second <br> delay(5); <br> digitalWrite(4, HIGH); // Yellow led on 1/2 second <br> delay(500); <br> digitalWrite(4, LOW); // LED turns off for 1/2 second <br> delay(5); <br> digitalWrite(6, HIGH); // Yellow Led on for 1/2 second <br> delay(500); <br> digitalWrite(6, LOW); // LED turns off for 1/2 second <br> delay(5); <br> digitalWrite(8, HIGH); // Yellow Led on for 1/2 sec <br> delay(500); <br> digitalWrite(8, LOW); // LED turns off for 1/2 second <br> delay(5); <br> digitalWrite(10, HIGH); // Green Led on for 5 seconds <br> delay(5000); <br> digitalWrite(10, LOW); // Green LED turns off for 5 seconds <br> delay(5000); <br>} <br> <br>ENJOY DRAG RACING
I will definitely use this and try to figure out the photocell. Eventually I would like to add a stopwatch that starts and stops for each car. I know it can be done, but still way over my head for now. Thanks for your input.
for the stop watch you can use an bicycle odometer that can measure time and miles theyre cheaper @ wallmart
....And at the finish line install a photocell with another ATtiny Arduino to see who won. you need : <br>&acirc;€&cent;220-Ohm resistor <br>&acirc;€&cent;LED <br>&acirc;€&cent;Photocell <br>&acirc;€&cent;10k resistor <br> <br>here is the Sketch: <br> <br>int photocellPin = 0;// Photocell connected to analog pin 0 <br>int photocellVal = 0; // define photocell variable <br>int ledPin = 9;// LED connected to digital pin 9 <br>int ledState = 0;//state of the led <br>int fadeDown = 30;//delay per fade <br>int fadeUp = 20;//delay per fade <br>int minLight = 100;//min light threshold <br>int maxLight = 100;//max light threshold <br> <br> <br>void setup() { <br> //Serial.begin(9600); <br> pinMode(photocellPin, INPUT); <br> pinMode(ledPin, OUTPUT); <br>} <br>void loop() { <br> photocellVal = analogRead(photocellPin); <br> <br> if (photocellVal &lt; minLight and ledState == 0){ <br> fadeLed(1); <br> //Serial.println(&quot;fade up&quot;); <br> } <br> else if (photocellVal &gt; maxLight and ledState == 1){ <br> fadeLed(0); <br> // Serial.println(&quot;fade down&quot;); <br> } <br> <br> <br> <br>} <br> <br>void fadeLed(int num){ <br> if (num == 1){ <br> for(int fadeValue = 0 ; fadeValue &lt;= 255; fadeValue +=5) { <br> analogWrite(ledPin, fadeValue); <br> delay(fadeUp); <br> } <br> ledState = 1; <br> <br> } <br> else{ <br> for(int fadeValue = 255 ; fadeValue &gt;= 0; fadeValue -=5) { <br> analogWrite(ledPin, fadeValue); <br> delay(fadeDown); <br> } <br> ledState = 0; <br> } <br> <br> <br>}
Also you can add the red &quot;foul&quot; light and a photocell for the pre stage and stage lights
I would like to add the foul light. I am still learning how this works. I'm hoping to use larger lights as well.
AND.... for this project If I were you I should buy an ATtiny 45/85 arduino IC so you don't have to sacrifice your regular Arduino and you can continue doing projects. ATtiny is perfect for this project I have tried with that code I have post. ;)
The connections are not clear and where is the GND and 5V connection <br>just a comment but it looks great your project
Good point! I will update it this evening. Thanks!

About This Instructable

9,516 views

15 favorites

License:

More by ea422: Sand Paper Cutter Nuts and Bolts Chopper Arduino Drag Race Light Tree
Add instructable to: