8-LED Larson Scanner With Arduino

16,748

38

19

About: 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 ways to improve my home. I love Instructables!

Intro: 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();
}
}

}

2 People Made This Project!

Recommendations

  • Electronics Tips & Tricks Challenge

    Electronics Tips & Tricks Challenge
  • Plastics Contest

    Plastics Contest
  • Optics Contest

    Optics Contest

19 Discussions

0
None
turbiny

3 years ago on Introduction

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)

2 replies
0
None
OptimisticPessimistturbiny

Reply 1 year ago

"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.

78xx-protection-diode[1].jpg
0
None
shiharanturbiny

Reply 1 year ago

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.

0
None
irishjim68bertus52x11

Reply 3 years ago on Introduction

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

0
None
JuCobertus52x11

Reply 7 years ago on Introduction

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'.)

0
None
bertus52x11JuCo

Reply 7 years ago on Introduction

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

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},

0
None
Catsruler1

4 years ago on Introduction

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

IMG_0410.JPG
1 reply

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.

5 replies

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!

0
None
jmcvaney

6 years ago on Introduction

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