Introduction: 8-LED Larson Scanner With Arduino

Picture of 8-LED Larson Scanner With Arduino
This is a simple way to make a Larson Scanner using an Arduino, with the added capability of setting the scanning rate with a potentiometer.

Minimum parts list:

(1)  Arduino Duemilanove (or equivalent / compatible)
(8)  LED's of your choice. I used 5mm T1-3/4 120-180 degree water clean 1500mcd pure green LCD's.
(8)  100ohm 1/8 watt (minimum) resistors. I used (4) 330ohm 1/4 watt, and (4) 450 ohm 1/4 watt, just because that's what I had lying around. I see no difference in brightness between the two.
(1)  10k potentiometer of your choice.
(1)  project breadboard, solderless "push-in" style.
(11)  4 inch lengths of hookup wire , preferrably solid core with tinned tips. Stranded wire will work, but is just more annoying. I used pre-assembled breadboardinging wires that came in a kit.



I did not write the sketch personally, but rather modified someone else's to fit my needs. It includes the ability to add a button, which I don't use.
The sketch for the Arduino is as follows:

const int buttonPin = 2;
const int ledPin1 = 13;
int buttonState = 0;

int leds[] = {3, 4, 6, 7, 8, 9, 10, 11};
#define NUMBER_OF_LEDS (sizeof(leds)/sizeof(int))

boolean larson[][NUMBER_OF_LEDS] = {
{ HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW},
{ LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW},
{ LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW},
{ LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW},
{ LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW},
{ LOW, LOW, LOW, LOW, LOW, HIGH, LOW, LOW},
{ LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW},
{ LOW, LOW, LOW, LOW, LOW, LOW, LOW, HIGH},
{ LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW},
{ LOW, LOW, LOW, LOW, LOW, HIGH, LOW, LOW},
{ LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW},
{ LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW},
{ LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW},
{ LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW},
};

#define FRAMES (sizeof(larson)/(sizeof(larson[0])))


int sensorPin = 0;

void setup() {
pinMode(ledPin1, OUTPUT);
pinMode(buttonPin, INPUT);
for (int led=0; led<NUMBER_OF_LEDS; led++) {
pinMode(leds[led], OUTPUT);
}
}

void loop(){

buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin1, HIGH);
}
else {

long time = millis();

for (int frame=0; frame<FRAMES; frame++) {
for (int led=0; led<NUMBER_OF_LEDS; led++) {
digitalWrite(leds[led], larson[frame][led]);
}
int sensorValue = map(analogRead(sensorPin), 0, 1023, 0, 1000);
while (sensorValue >= (millis() - time)) {
sensorValue = analogRead(sensorPin);
}
time = millis();
}
}

}

Comments

turbiny (author)2015-07-21

i wanna put this in my car brake light can the arduino nano withstand car 12v and the current needed to drive 6/7 car led (usually T10 with 5 SMD 5050 LEDs)

"Yes, but..." is my answer. Your car power is the worst DC source possible. Not for stuff like running your lights, but for sensitive electronics. Using a 7805 regulator protects your nano in more ways than one. In addition to the obvious, when coupled with input ceramic & output electrolytic caps, it will suppress a lot of the noise on your car's DEC bus.

They also make a cheaper fuse than the nano itself, but it you use a protection diode, even that is a limited risk (see attached)

From the official Arduino Nano page:

Power:

The Arduino Nano can be powered via the Mini-B USB connection,
6-20V unregulated external power supply (pin 30), or 5V regulated
external power supply (pin 27). The power source is automatically selected to the highest voltage source.

shiharan (author)turbiny2016-10-25

Hi,

Yes, you can have it as a brake indicator. Just need to use a LM7805 to pull down the 12v DC to 5v DC so that the electronics dont fry!

Now, we can design the LED array based on the forward voltage & current of the led as on datasheet.

valentin.derouete.3 (author)2015-06-21

It's very simple project and I including the operation

AustinEsau made it! (author)2014-12-29

The program worked very well! I added two extra LED's in pins 2 and 12 and you only need to add a little bit of code to make it work flawlessly. I'm new to all of this and this Instructable was very helpful. The changes you need to make a 10 LED scanner are as follows.

In the integer definition for "leds[]" use this:

int leds[] = {2, 3, 4, 6, 7, 8, 9, 10, 11, 12};

and for the large block of code that indicates the order of the LED's turning on and off:

boolean larson[][NUMBER_OF_LEDS] = {

{ HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

{ LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

{ LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

{ LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW},

{ LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW},

{ LOW, LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW},

{ LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW},

{ LOW, LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW, LOW},

{ LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW},

{ LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, HIGH},\

{ LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW},

{ LOW, LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW, LOW},

{ LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW},

{ LOW, LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW},

{ LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW},

{ LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW},

{ LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

{ LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

};

What confused me was that pin 5 wasn't used in the original code. I changed the code to use pins 3-12 including pin 5 and it still worked the same. Regardless, great program!

bertus52x11 (author)2011-10-10

I'm intrigued by your project, but what does it do? What's a Larson scanner?

irishjim68 (author)bertus52x112014-12-25

It was originally used in the original "Battlestar Galactica" TV series (also created by Glen Larson) as the "eye" of the Cylons

JuCo (author)bertus52x112011-10-11

yeah, i had to google it... it's the lighting effect that they used for the front end of kitt on 'knight rider'. (light bouncing back and forth, for those too young to have watched 'knight rider'.)

bertus52x11 (author)JuCo2011-10-11

ok, thanks. Now I understand.
BTW, I'm just old enough to have watched Knight Rider!

rbayonet made it! (author)2014-09-20

This is my first larson scanner, very simple and fun to do. Used super bright leds and the outcome is great. The beam of lights hit the ceiling and it looks like a disco.

Thanks again.

is it possible to make a larson scanner with more than 8 leds?
arduino mega has 54 input/output pins so i was thinking a 30led or 50led larson scanner.
one more question except from scanning and turning off 1 by 1 led i would also like to scan them and keep the leds high after the scan passes them
can i use somethink like this

{ HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

{ HIGH, HIGH, LOW, LOW, LOW, LOW, LOW, LOW},

{ HIGH, HIGH, HIGH, LOW, LOW, LOW, LOW, LOW},

and so on?


also i would like to make a program where the scan uses 4 leds at a time living behind 4 turned off and while it continues enables 4 more leds to scan
is this possible to do using this

{ HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

{ HIGH, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

{ HIGH, HIGH, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

{ HIGH, HIGH, HIGH, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

{ LOW, HIGH, HIGH, HIGH, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW},

{ LOW, LOW, HIGH, HIGH, HIGH, HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW, LOW},
....... and eventually keep scanning like this :

{ HIGH, HIGH, HIGH, HIGH, LOW, LOW, LOW, LOW, HIGH, HIGH, HIGH, HIGH,

LOW, LOW, LOW, LOW},

Catsruler1 (author)2014-02-02

Thanks for this! I have been looking for ways to make a scanner of my own and this is the first that has worked correctly. I did add some lines to have the light wait at the end. Thanks for the video explaining what ports to plug into. :3

Catsruler1 (author)Catsruler12014-02-02

Is there a way to remove the potentiometer without changing the speed?

Dominion-Network (author)2011-10-11

Have you tried removing one of the lines from your 'flickbook' because when the scan hits either end it hangs longer than it should, try this.


boolean flickbook[][NUMBER_OF_LEDS] = {
{ HIGH, LOW, LOW, LOW, LOW, LOW, LOW, LOW},
{ LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW},
{ LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW},
{ LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW},
{ LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW},
{ LOW, LOW, LOW, LOW, LOW, HIGH, LOW, LOW},
{ LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW},
{ LOW, LOW, LOW, LOW, LOW, LOW, LOW, HIGH},
{ LOW, LOW, LOW, LOW, LOW, LOW, HIGH, LOW},
{ LOW, LOW, LOW, LOW, LOW, HIGH, LOW, LOW},
{ LOW, LOW, LOW, LOW, HIGH, LOW, LOW, LOW},
{ LOW, LOW, LOW, HIGH, LOW, LOW, LOW, LOW},
{ LOW, LOW, HIGH, LOW, LOW, LOW, LOW, LOW},
{ LOW, HIGH, LOW, LOW, LOW, LOW, LOW, LOW},
};

I removed two lines, so in theory it shouldn't hang on the sides anymore.

which lines did you remove

Yes those were put there so it would pause at either end briefly. Simply what I prefer it to do, but others are obviously welcome to do as they wish. Thanks for the tip, tho!

Not a problem, the reason why I spotted it is because the 'Larson Scanner' doesn't have any pauses.

I tried your version of the code, and I actually do like that better. Thanks!

Not a problem at all, Glad to help.

tobyhall (author)2014-01-11

great project

jmcvaney (author)2012-06-14

This project is great, thanks for posting.
I have a question on expanding this- I want to set up a single button so that if it is pushed it will activate a specific pin depending on which LED is activated in the larson scanner. So if the first LED is lit and the button is pushed, it could activate pin 8, if the second LED is lit, it could activate pin 7, so forth. I've change the pins in the Larson scanner code to be 13-9 (only five LEDs) and will dedicate pins 8-4 to the external switches. This will be used to activate buttons on a tv remote. I've tapped into the remote pcb and have leads soldered into the button connects I want to use.

I'm really new to arduino and am having trouble getting started with altering the code.
I thought a while loop might work well and having the 'while' dependent be the high/low state of the LEDs.

Any input would be extremely appreciated

About This Instructable

15,899views

36favorites

License:

Bio: I'm a U.S. Marine stationed in southern California. In the boredom of my off-hours, I tinker around with simple electronics and look for ... More »
More by samlynn79:8-LED Larson Scanner with Arduino
Add instructable to: