Introduction: The Arduino Rider.
Okay, so recently I thought of an idea... why not make a knight rider program, and if it works ... make it look good and also make it on a circuit board? So that's what I did. I made a effective program for arduino that will simulate the Cylon/Night Rider lights.
So basically I made a program and a circuit.
uhh... so keep reading!
Step 1: Get the Parts.
For this project you will need..
- an arduino duemilanove (anything that is roughly the same (size, shape , pin layout, program support, etc.))
- the program (you can copy it from the text here, or if my link works)
- header connectors, that fit in any breadboard, arduino ,etc. (I got them @ frys)
- 5 red leds- at ~3V (I only had white 5mm) -------- Do not get the giant red "super bright" 1cm long leds.
They are too big and are less powerful, trust me I have them right here and the white ones in this instructable are much much better, and brighter.
- 220 ohm resistor (I used 330 ohm, close enough) ------ Actually 100 ohm ones are the best.
- a circuit board or peg board i used Radio Shack Dual PC board 276-148
- wire (maybe, i bent the pins of the leds, so I didnt need any)
- A computer that can program your arduino (duh!)
- Solder + Iron
Okay so lets build it!
Step 2: Make the Circut
Okay because this is a easy project you dont need a breadboard, the circuit is simple. We will start by connecting all 5 led's negative terminals together, and soldering it up (on the board), and connecting a 220 ohm resistor to the negative terminal of the leds, and the other end to the pin to go to ground of the arduino, and then your leds are connecting to pins 12, 11, 10, 9, and 8 (this will all follow my program). This circuit will save your resistors for you instead of using 5 of them.
Make your circuit based on the picture, and if you can similar to mine.
Gee, don't those pictures look alike?
Step 3: PROGRAMMING TIME!
Woo! the best part. Okay so you can use any program, including the demo one, BUT... mine has smoother transitions, go ahead be the judge whose do you like better, the sample or mine?
Here is my code:
int pinled1 = 12; //we are saying "Hey! led 1 is connected to pin 12!"
int pinled2 = 11; //and so on...
int pinled3 = 10;
int pinled4 = 9;
int pinled5 = 8;
int tim = 50; //feel free to change this
pinMode(pinled1, OUTPUT);// Now we are saying "Led 1 is going to give out energy , not take it in, it is a OUTPUT."
pinMode(pinled2, OUTPUT);// and so on...
void loop() // this stuff will reapeat over and over and over and ...
digitalWrite(pinled1, HIGH); //turns led1 on, or HIGH
delay(tim); //wait for tim miliseconds
digitalWrite(pinled2, HIGH);//and so on
digitalWrite(pinled1, LOW);//turns led1 off, or LOW
delay(tim);// you get the point
upload that into your arduino.
Step 4: Try It Out!
So insert your arduino knight rider circuit into your arduino with the program selected, and watch... cool right? So look at my original one that I made...
Okay for those of you that just cant stop making stuff, I have some ideas
- add a sensor to control speed
- pick diffrent speeds/modes with a button (I can do that and the knob)
- make it fancier!
- make the best code that you can that will do the same!
Step 5: See Ya!
We have a be nice policy.
Please be positive and constructive.