The Arduino Rider.





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?


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!

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!

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!



    • Casting Contest

      Casting Contest
    • Oil Contest

      Oil Contest
    • Planter Challenge

      Planter Challenge

    We have a be nice policy.
    Please be positive and constructive.




    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

    1 reply

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

    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.

    2 replies

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

    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.

    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?

    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 ?

    8 replies

    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

    it think ill buy duemilinova if i spelled it correctly

    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!

    so you're saying nano is better than duemilinove ?

    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!

    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:

    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++

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

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

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

    3 replies

    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.

    Schematic for 'ible.JPG

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

    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.