The larson scanner is well know by knigth rider in the 80's. In this tutorial i will tell you how to create une. So i try to create my version of the project. It consist of an array of leds that turns on moving side to side. I just add a potenciometer to increase or decrease the speed of the moving leds.
So to continue lets see the materials...
Step 1: Materials
For this project we need these :
- Arduino (Uno, Due, Yun )
- 8 Red Leds
- 8 220 Ω Resistors 1/4 W
- 1 Potenciometer 10K
- Arduino USB cable (A to B)
Step 2: The Test
We are goint to star graduadly. we are going to wire 1 led..
Accordin to the diagram the pin 2 of the arduino goes to a resistor (220 ohm) . The resistor is conected to the anode (positive) is the large pin of the led and the short one goes to ground.
Here is the code so you can test one led.
Step 3: Wire It All!!
This is how we need to conect our arduino. We are going to use 8 digital pins from the arduino. Each pin is conected to a 220 Ω resistor and then to the led anode. The cathode of the 8 leds can be joined together.
We are going to put all the ten leds with one resistor each one. Wired it like the diagram. You just have to connect pin 2 with a resistor(220 ohm) and then connect it to the led's anode (positive). Repeat the same process for pin 3,4,5,6,7,8,9,10 and 11.
then run the file in the arduino to check all the leds are working the program turn on all the leds then it turn off the leds and turn each one on and off and starts again.
If all the leds turn on we can go to the next step.
Step 4: The Animation
The animation of the knigth rider has 2 movements. The first one is like the gif (it suposed to be animated) the leds turn from rigth to left and then backwards.The second one is from the center to both sides and return to the center.
So i put my code so you can view how i did it. I start moving one led, timing it.
Step 5: Controling Speed
For the speed control we have to use a ptoenciometer. The potenciometer has 3 pins, the first one (left to right) it's vcc so it it will be conected to the arduino 5 volts output, the second pin is signal it is connected to the A0 in the arduino it is the analog input and the las pin its connected to ground.
The code of the last step contains the necesary for reading the analog input.
and it is finished !!!