Introduction: Arduino Cylon Scanning Eye

About: My name is Logan Carlson, I am a recent graduate of Florida Polytechnic University with a degree in Computer Engineering. I try to build all the time and post my projects, but it is time consuming so I have no…
This is a Larson Scanner which is what is used to make the eyes of the centurion cylons in Battlestar Galactica. I used 11 red LEDs and an Arduino UNO to make it. All of the materials used for it were the following:

- Arduino UNO
- Red LEDs x11
- 1K ohm resistors x11
- A 10K potentiometer
- Lots of hookup wire

To make it more customizable, and to add some input for it I added a potentiometer to control the speed of the scanning. Here is a video:

To build the circuit doesn't take much time or knowledge. Just connect the LED's cathode to ground on the breadboard. Then connect  each LED to a resistor on the breadboard, and make the resistors connect to the Arduino pins. Connect them in order with the line of LEDs in accordance with the numbers of the pins. Start with pin 2 and connect them in order. Then connect the ground pin on the Arduino to the ground rail on the breadboard to connect all the LEDs to Ground. Then all of the LEDs are connected and its time for the potentiometer to be connected.

To connect the potentiometer take the outer two wires and connect one to ground and one to 5v. Which one doesn't matter the only difference is that you will have to turn the potentiometer a different way. Then the middle wire you want to connect to pin A0 on the Arduino. Now the connections are all done and its time to move on to the programming!


Here is the code:


int ledPins[] = {
  2,3,4,5,6,7,8,9,10,11,12 };                                              // make an array of the pin numbers
int pinCount = 11;                                                              // variable for number of LEDs
int timer = 10;                                                                      // delay in between LED on and off

void setup() {
  for (int thisPin = 0; thisPin < pinCount; thisPin++) {    //for loop to setup all of the pins in the array ledPins
    pinMode(ledPins[thisPin], OUTPUT);
  }

}

void loop() {
  for(int thisPin = 0; thisPin < pinCount; thisPin++) {         //for loop to go through all LEDs in array and turn them on
    timer = analogRead(A0) / 2;                                             //and off until end of line in one direction
    digitalWrite(ledPins[thisPin], HIGH);
    digitalWrite(ledPins[thisPin] +1, HIGH);
    digitalWrite(ledPins[thisPin] + 2, HIGH);
    delay(timer);
    timer = analogRead(A0) / 2;                                 // Read the potentiometer value and divide by two to get delay
    digitalWrite(ledPins[thisPin], LOW);
    digitalWrite(ledPins[thisPin] + 1, LOW);
    digitalWrite(ledPins[thisPin] + 2, LOW);
    timer = analogRead(A0) / 2;

  }

  for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) {   //for loop to go through all LEDs again in opposite direction
    timer = analogRead(A0) / 2;
    digitalWrite(ledPins[thisPin], HIGH);
    digitalWrite(ledPins[thisPin] - 1, HIGH);
    digitalWrite(ledPins[thisPin] - 2, HIGH);
    delay(timer);
    timer = analogRead(A0) / 2;
    digitalWrite(ledPins[thisPin], LOW);
    digitalWrite(ledPins[thisPin] - 1 , LOW);
    digitalWrite(ledPins[thisPin] - 2, LOW);
    timer = analogRead(A0) / 2;
  
  

  }
}