K.I.T.T Knight Rider Scanner Bar (16 LEDs) for Arduino Uno
by mariogianota in Circuits > Arduino
1233 Views, 3 Favorites, 0 Comments
K.I.T.T Knight Rider Scanner Bar (16 LEDs) for Arduino Uno
Recreate K.I.T.T's iconic front-mounted scanner bar as seen on the Knight Rider TV show from the 1980s using your Arduino Uno and a couple of shift registers.
The scanner bar is made out of 16 LEDs hooked up to two 74HC595 shift registers, which are controlled by a short sketch running on the Arduino Uno.
About Shift Registers
Shift registers are used with an Arduino Uno to extend the number of pins. In our case, we want to control 16 LEDs, but there aren't enough digital pins on the Arduino Uno to achieve this task. Using shift registers, we can control all 16 LEDs using just 3 pins on the Arduino Uno.
With one shift register we can control 8 LEDs. With two shift registers connected together, we can control 16. The Arduino is used to load a couple of bytes of data into the registers and with one digitalWrite() call we can cause the registers to set their output pins either HIGH, or LOW.
The Arduino controls the shift registers by using something called "synchronous serial communication". It achieves this control by pulsing one pin high and then low to communicate a data byte to the registers bit by bit. When the data bits have been sent to the registers, another pin is used to cause the registers to set their output pins to match the loaded bit pattern.
More information on using shift registers with the Arduino is available on the Arduino website.
Supplies
- Arduino Uno
- 2 x 74HC595 shift registers (Available from Ebay)
- 1 x 10uF Capacitor
- 16 x 220 Ohm resistors
- 16 5mm Red LEDs
- Hookup wire
- 2 x Breadboards
Build the Hardware
Use the Fritzing breadboard diagram above, together with the image of the completed circuit to wire up the hardware.
The yellow wires in the diagram are the connections between the Arduino Uno and the shift registers. It is these wires down which we will send the data to control the registers. Refer to the 74HC595 pin out image above to make the connections between the Uno and register A.
- Connect the DATA pin 14 on shift register A to pin 12 on the Arduino Uno
- Connect the LATCH pin 12 on shift register A to pin 8 on the Arduino Uno
- Connect the CLOCK pin 11 on shift register A to pin 11 on the Arduino Uno
That completes the hardware setup.
Upload the Sketch to the Arduino Uno
With the hardware built, you can download the sketch and upload it to your Arduino Uno.
How It Works
The sketch stores the bit pattern to be loaded into the shift registers in a 16 bit integer. The loop() function simply rotates the bits in this variable left, then right and outputs the value for storage by the shift registers. To load the shift registers, the Arduino's shiftOut() function is used.