loading

In this tutorial I will show how to display a 'Knight Rider' animation on a LED bar using an Arduino board and a TLC5940 chip.

For the software I will use the wonderful ALA library so you can play with different animations easily.

Step 1: Parts

The TLC5940 chip is the core of the schema it allows to drive the 10 LEDs at fixed current.

  • Arduino board (I have used an Arduino Uno)
  • Breadboard
  • One TLC5940 chip
  • 10 LED Bar Graph
  • 2.2 K Ohm resistor
  • 10 K Ohm resistor
  • Some jumper wires

Step 2: Schematic

The 2.2K resistor (on pin 9) sets the TLC5940 to drive the LEDs with 20mA current. The 10K pull-up resistor (on pin 6) turns all outputs off while Arduino resets.

Step 3: Code

Instead of developing my own algorithm for the 'Knight Rider' animation, I have decided to use the Arduino Light Animation library. It is very easy to use and it's fun to try all the animations.

First of all you have to install the ALA library from here and put it on your Arduino library folder.

After having installed the library you can use the following sketch.

#include "AlaLed.h"
AlaLed ledBar; byte pins[] = { 1,2,3,4,5,6,7,8,9,10 }; void setup() { ledBar.initTLC5940(10, pins); ledBar.setAnimation(ALA_LARSONSCANNER2, 2000); } void loop() { ledBar.runAnimation(); }

Step 4: Tryout Other Animations

The ALA library offers many animations ready to use. You can also define an animation sequence.

Here are some animations you can use in the setAnimation function:

  • ALA_SPARKLE2

  • ALA_PIXELSMOOTHSHIFTRIGHT

  • ALA_COMET

  • ALA_GLOW

Enjoy!

<p>very nice, discovered ALA in this tutorial. I am sure ill be using it in future. </p><p>perhaps in version 2 of this project </p><p><a href="https://www.instructables.com/id/Sparrow-My-Assistant/" rel="nofollow">https://www.instructables.com/id/Sparrow-My-Assista...</a></p>
This is awesome! Nice idea, thanks for sharing :)
<p>Alo, is the fadding effect achieved? the original knight rider lights had some fadding when animating. If not, try placing capacitors in LEDs to GND, adjusting the timing to get the effect.</p>
<p>There is a small fading at beginning and end of the moving bar. This is achieved by software using the PWM outputs of the TLC5940 chip.</p>

About This Instructable

3,038views

37favorites

License:

More by TheTwim:Cheap Arduino WiFi shield with ESP8266 Making ESP8266-01 module breadboard friendly Knight Rider animation with Arduino and TLC5940 
Add instructable to: