Introduction: The Arduino Rider.

Picture of 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.

Picture of 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

Picture of 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?



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
void setup()
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...
pinMode(pinled3, OUTPUT);
pinMode(pinled4, OUTPUT);
pinMode(pinled5, OUTPUT);

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
digitalWrite(pinled3, HIGH);
digitalWrite(pinled2, LOW);
digitalWrite(pinled4, HIGH);
digitalWrite(pinled3, LOW);
digitalWrite(pinled5, HIGH);
digitalWrite(pinled4, LOW);
digitalWrite(pinled4, HIGH);
digitalWrite(pinled5, LOW);
digitalWrite(pinled3, HIGH);
digitalWrite(pinled4, LOW);
digitalWrite(pinled2, HIGH);
digitalWrite(pinled3, LOW);
digitalWrite(pinled1, HIGH);
digitalWrite(pinled2, LOW);

upload that into your arduino.

Step 4: Try It Out!

Picture of 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!

Picture of See Ya!

Okay so I really hoped you like my 2nd Instructable (I will admit my first one really was bad)... Okay so leave comments ( positive ones with out any swears preferred), and I am open to any suggestions, and if you want any improvements, just leave a comment.... So see ya!

MAKE: I'm a Maker!


Klaudiuszm (author)2012-11-17

Nice instructable, although isn't the code a bit long? I wrote the code for the same function except its shorter.

int led = 8;
int time = 50;

void setup() {
  for(led = 8; led < 13; led++) { //declares the pins 8 - 12 as output pins
    pinMode(led, OUTPUT);

void loop() {
  for(led = 8; led < 13; led++) { //Main: function starts at pin 8, turns led on, waits 50ms, turns them off, waits 50ms, repeats same function for next led until it hits pin 13 (pin 13 is not part of the function) and starts at pin 8
    digitalWrite(led, HIGH); //led on
    delay(time); //wait
    digitalWrite(led, LOW); //led off
    delay(time); //wait

Beenay25 (author)Klaudiuszm2013-04-22

I love the pin declaration in that code. Very elegant :)

jamar3030 (author)2010-01-12

I love this tutorial. I just bought an Arduino and I plan on making this my first project... past "hello world". Appreciate that you posted, thanks! Did you have your son/daughter draw the Arduino and schematic in step 2? Just kidding.

chrisapalo (author)jamar30302010-01-12

Umm... I recently got and was new to it, and didn't have a good program for schematics... and I'm only 13... so...

jamar3030 (author)chrisapalo2010-01-19

Ha, ha! Well, being that you are 13 and can make something like this, it isn't important for you to master drawing. Mastering electronics seems more pertinent. By the way, the project worked out perfect and was easier than I thought it would be. Thanks again.

mathman47 (author)2009-12-28

Good job.  Interesting code.  At first I thought you coulnd't code a counter, but your's is certainly an interesting take on the code.  I would imagine changing the time could have some interesting effects with POV?

chosenone3 (author)2009-10-12

Hi im going to buy an arduino soon i guess (just starting with mic's) and i would like to know how much output does it give when you wrote:

digitalWrite(pinled1, HIGH);

HIGH ? how much is the voltage and amperage

and how much is LOW
can you controll them with code or you have to do it hardware way ?

chrisapalo (author)chosenone32009-10-13

Arduino Rocks!
Okay so
HIGH means ON and is 5V at 40milliamps, although some pins have built in resistors so check before you run the program, FYI the one that I have has a resistor on pin 13, but i'm not sure about any others.
LOW means Off... so yeah, it either gives ground or just 0V....
Hope that helps.
What type of Arduino are you getting

chosenone3 (author)chrisapalo2009-10-13

it think ill buy duemilinova if i spelled it correctly

ElectronMad (author)chosenone32009-10-14

Well, if you are going to do BIG projects, I would say get aArduino Nano. If small stuff like this (Knight rider) a duemilinovewould be good, or if you want you could try out one that i had beforeits called, Seeduino, (from seeed studio depot) it has same functions,same pin layout as the duemilinove, Just the Atmel ATmega chip is SMD(surface mounted)

Good luck with with your arduino

Any questions? Feel free to ask!

chosenone3 (author)ElectronMad2009-10-14

so you're saying nano is better than duemilinove ?

ElectronMad (author)chosenone32009-10-14

If you need lots of work space You should get the NANO, If you do smallstuff like Blinks and led chasers. The duemillinove is good. Theduemillinove is probably most used because it can have shields such asthe Ethernet shied, Proto Shield, Xbee shield.... and more. But nano isalways good for BIG BREADBOARDING AREA!

Good luck, Select wisely.

Any questions? Feel Free to ask!

ElectronMad (author)chosenone32009-10-13

I can see that you are a begginer on the Arduino ( Not to worry, I even started like this ).

So this is the Answer to your question:

As you know, the arduino code goes like this ( the last bit )

void loop()                    
  digitalWrite(ledPin, HIGH);          
What (ledPin, HIGH) does not mean the voltage and power is high, it simply means that The Object you are powering is turned ON.

digitalWrite(ledPin, LOW);   

Same with the (ledPin, LOW), Low just simply means that it is turned OFF.

Yea its pretty stupid, but its how it is programmed, Any question? Feel free to ask. In the meantime Have a look at this, it might help you. It will be able to tell you most of the stuff:

chosenone3 (author)ElectronMad2009-10-13

thanks for pointing it out :)
I will look at the reference when i will get an arduino in my hand ;]
the last question i want to ask is :
Is this c/c++ ?
if yes than can it be used with STL or any other libraries of c/c++

ElectronMad (author)chosenone32009-10-14

Yes this is C++ and no it can be used with Some C++ librarys, but not many

ElectronMad (author)2009-10-13

For the schematics, You could Use ~ExpressPCB~ (it also has schematic maker).

homunkoloss (author)2009-08-06

I would recommend that you paint your schematics with eagle ( or fritzing ( Both are free and platform independent.

geeklord (author)homunkoloss2009-08-11

Here, I made one. I added resistors in the proper places too. The way you had them hooked up, you could only light up one or two at a time without burning out your LED's.

chrisapalo (author)geeklord2009-09-24

Cool thanks! Are you sure that the thing would burn out the way I hooked it up? I did not know that...

geeklord (author)chrisapalo2009-09-29

Well, they'd draw too much current and would have shortened lives. I'm pretty sure that's how I've ruined a couple of my LED's.

chrisapalo (author)homunkoloss2009-08-06

Well I decided to make this dirt cheap and ... well more DIY-ish.. so yeah but you saw the circuit.. maybe later... lets see.... See Ya!

ReCreate (author)2009-09-19

Last time i checked...The arduino software already came with an example containing this... But other than than, Neat, Though i do have one unrelated question. Why is the image in the last step so high quality? how did you bypass the low quality jpeg conversion?

chrisapalo (author)ReCreate2009-09-24

This one has a different pattern the other one goes 1 2 3 4 ... mine goes 1 12 2 23 3 34 4 ..... and so on

ReCreate (author)chrisapalo2009-09-24

I didn't know the Arduino had a 23'rd and 34'th pin O_o

chrisapalo (author)ReCreate2009-09-24

Oh, they dont.. I meant that it turns on 1 1 & 2 3 3 & 4 4 and so on

ReCreate (author)chrisapalo2009-09-24 doesn't really make sense, you mean that the light would change position by fading?

chrisapalo (author)ReCreate2009-09-25

So what the transition does is it turns on the leds (just on or off pins 8 and 12 arent PWM pins) 1 then 1 and 2 2, etc. Just try out the code and compare it to the example, but either way both codes are compatible, just make sure it is meant for leds connected to pins 8- 12, and see which is best. So, I'm trying to say is well the transition is a little bit slurred, not faded but it looks smooth. Hope that helps

ReCreate (author)chrisapalo2009-09-25

Oh OK thanks :D

About This Instructable




More by chrisapalo:Counting Circuit to 99,999The arduino rider.The Lighted Fume Extractor
Add instructable to: