กลับไปหน้ารวมไฟล์
arduino-knight-rider-with-potentiometer-af7990-en.md

We will make Knight Rider car led animation with a potentiometer

Knight Rider animation

We all remember the technological car in the iconic television series Knight Rider. The most important feature of this car is that the LEDs on front of the car are constantly turn on one by one.

K.I.T.T.

For those who are new in Arduino and want to learn coding, it's time to learn how to make this animation with pot!

Circle Electronic NOOB Series

Don't mess with breadboard circuits for learning Arduino and coding, just connect the cables and start coding right now!

Theory and Animation Logic

The Knight Rider effect (or "Larson Scanner") involves a light that bounces back and forth across a row of LEDs. In this project, we utilize the 74HC595 Shift Register to handle 12 LEDs using only three digital pins on the Arduino. This allows us to scale the project without consuming all available GPIOs.

Hardware Details

  • Shift Register (74HC595): This 8-bit serial-in, parallel-out chip is the heart of the LED control logic. By sending bits serially, we can turn specific LEDs on or off in a high-speed sequence.
  • Potentiometer Control: A rotary potentiometer is connected to an analog input (A0). This allows the user to manually adjust the scanning speed in real-time by varying the voltage between 0V and 5V.

Meet the Circle Electronic NOOB Series Knight Rider!

Knight Rider Product

https://www.circleelectronic.com/knight-rider

Product close-up

What can you do?

Knight Rider circuit LED Animation

How to make this animation with pot?

Watch Youtube Video

Circuit Diagram

https://www.tinkercad.com/things/6KD66LWNaAa

We will use 74hc595 Shift Register in this project.

So, how to make this animation with shift register.

Coding with Map and ShiftOut

The Arduino reads the analog value from the potentiometer (0-1023) and uses the map() function to translate this into a useful timing delay or a specific position in the LED sequence:

potvalue = map(potvalue, 0, 1023, 0, 11);

By mapping the 10-bit resolution of the ADC to the 12 positions of our LEDs, we can create an interactive scanner where the knob directly controls the position or speed of the light streak.

This is our code to make this animation with 74hc595. We will change this to make this with pot.

We change it like it:

#define DATA 8

Now we will read the data from pot

We will connect the pot middle pin to arduino analog 0 pin and read the datas

int pot=A0;

Potentiometer connection diagram

These are the data we get after making the connection. When we change the potentiometer, we read a value in the range 0-1023. We have to convert these values to 0-11.

We will use the map command to do this:

potvalue=  map(potvalue,0,1023,0,11);

Now we are changing our code:

#define DATA 8

The final version of this code.

Circuit Diagram and Resources

This project is an excellent entry point for learning how to use Shift Registers and Analog Input to create sophisticated visual effects with minimal wiring.

That's it!

Our Website: https://www.circleelectronic.com/

Github Page: https://github.com/circleelectronic/Knight-Rider

Blog Post: https://www.circleelectronic.com/post/arduino-knight-rider-with-potentiometer

Tinkercad Project Link: https://www.tinkercad.com/things/6KD66LWNaAa

Knight Rider Product Link: https://www.circleelectronic.com/knight-rider

Tindie Product Link: https://www.tindie.com/products/circle/knight-rider/

Watch Knight Rider Circuit Video

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE"
author: "circleelectronic"
category: ""
components:
  - "1x Circle Electronic Knight Rider"
  - "1x Jumper wires (generic)"
  - "1x Breadboard (generic)"
  - "1x Rotary potentiometer (generic)"
  - "1x Arduino UNO"
description: "Recreate the LED animation of K.I.T.T. from the Knight Rider TV series with a potentiometer."
difficulty: "Easy"
documentationLinks: []
downloadableFiles:
  - "https://github.com/circleelectronic/Knight-Rider/blob/master/KnightRider_withPot.ino"
  - "https://github.com/circleelectronic/Knight-Rider/blob/master/KnightRider_withPot.ino"
encryptedPayload: "U2FsdGVkX1+5jL2Gc0ZHuqXhWXi10UDDvVp/JWhp5e+BH4sqO6ke4octTIctdwmbs+5KWHAotz0hcYzXuqnl+rfyIu89LB+Rgu49oVJZaS8="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/arduino-knight-rider-with-potentiometer-af7990_cover.jpg"
lang: "en"
likes: 0
passwordHash: "de7878493e9306fba50403baefb5a09cb8de3686c52f23bc279617e4a5c84baf"
price: 870
seoDescription: "Create an Arduino Knight Rider LED animation. Control the K.I.T.T. light effect speed with a Potentiometer in this easy DIY electronics project."
tags:
  - "lights"
  - "toys"
  - "cars"
  - "kids"
title: "Arduino Knight Rider with Potentiometer"
tools: []
videoLinks:
  - "https://www.youtube.com/embed/9QmZmnchEUc"
  - "https://www.youtube.com/embed/spA9FOLScQg"
views: 2155