Knight Rider Car Strobe Effect

by dmcits in Circuits > Arduino

107 Views, 1 Favorites, 0 Comments

Knight Rider Car Strobe Effect

_TrpwgDQDjh.jpeg

This project replicates the iconic LED scanning effect seen on KITT, the talking car from the classic Knight Rider TV series. A row of six LEDs lights up one by one from left to right, then in reverse from right to left, creating a smooth strobe or scanning motion. This creates a visually engaging effect that's great for cosplay props, custom car mods, or learning sequential logic using Arduino.

Supplies

  1. Arduino Uno (or compatible board)
  2. 6 LEDs
  3. 6 resistors (220–330Ω)
  4. Breadboard
  5. Jumper wires
  6. USB cable (to upload the code)

Build the Circuit

Screenshot 2025-05-08 at 3.43.14 PM.png
  1. Place the 6 LEDs on the breadboard in a row.
  2. Connect each long leg (anode) of the LEDs to digital pins 2 to 7 on the Arduino.
  3. Connect a 220Ω resistor to the short leg (cathode) of each LED.
  4. Connect the other end of each resistor to the GND rail on the breadboard.
  5. Connect the GND rail to one of the GND pins on the Arduino.

Arduino IDE

  1. Open the Arduino IDE on your computer.
  2. Go to Tools > Board and select Arduino Uno (or your specific board).
  3. Go to Tools > Port and select the COM port your Arduino is connected to.

Code Explanation

int timer = 100;

void setup() {
for (int pin = 2; pin < 8; pin++) {
pinMode(pin, OUTPUT);
}
}

void loop() {
for (int pin = 2; pin < 8; pin++) {
digitalWrite(pin, HIGH);
delay(timer);
digitalWrite(pin, LOW);
}

for (int pin = 7; pin >= 2; pin--) {
digitalWrite(pin, HIGH);
delay(timer);
digitalWrite(pin, LOW);
}
}

🔍 Code Explanation

int timer = 100;
  1. This line declares a variable named timer and sets it to 100 milliseconds.
  2. It controls the speed of the LED sweep—a delay between turning LEDs on and off.
  3. You can make the scanner move faster or slower by changing this number.
void setup()
  1. This function runs once when the Arduino is powered on or reset.
  2. It’s used to initialize settings like pin modes.
for (int pin = 2; pin < 8; pin++) {
pinMode(pin, OUTPUT);
}
  1. This for loop sets digital pins 2 through 7 as output pins using pinMode.
  2. Why 2 to 7? Because we want to control 6 LEDs on pins 2, 3, 4, 5, 6, and 7.
  3. The loop starts at pin = 2 and runs while pin < 8, increasing pin by 1 each time.
void loop()
  1. This function runs repeatedly in a loop, forever.
  2. It contains the two sequences that create the Knight Rider scanning effect.

🔹 Forward Sweep

for (int pin = 2; pin < 8; pin++) {
digitalWrite(pin, HIGH);
delay(timer);
digitalWrite(pin, LOW);
}
  1. This loop turns each LED on one by one from pin 2 to 7.
  2. digitalWrite(pin, HIGH) turns on the LED at the current pin.
  3. delay(timer) waits 100 milliseconds (or whatever value you set).
  4. digitalWrite(pin, LOW) turns the LED off before moving to the next one.
  5. This creates a left-to-right animation.

🔹 Reverse Sweep

for (int pin = 7; pin >= 2; pin--) {
digitalWrite(pin, HIGH);
delay(timer);
digitalWrite(pin, LOW);
}
  1. This loop does the same thing in reverse, from pin 7 down to 2.
  2. It lights each LED right-to-left, completing the "ping-pong" effect.
  3. The pin-- decreases the pin number each time the loop runs.

Upload Code

  1. Click the Upload (→) button.
  2. Wait for the code to compile and transfer to the Arduino

Watch the LEDs Animate

Once the code runs:

  1. The LEDs light up one by one from left to right, then right to left, simulating a scanning or sweeping motion.
  2. This mimics the strobe effect from Knight Rider’s KITT car front panel.