Knight Rider 2008 scanner - wiring help needed

Hi,

I stumbled across this old code in the internet and would like to use it for a model that I am building, but have a hard time to figure out the correct wiring, which is long gone. I am using a Arduino Pro Mini. The left and the right light bar is moving contrary, like in this video: 1/18 Knight Rider Shelby GT500 with full working lights - YouTube.
If someone could help out with a wiring diagram (breadbord etc.) to make my project work I’m willing to donate.

int cycleTime = 500;
int pins[] = {  2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
int numPins = 11;
int numCycles = 59;
int cycle = 0;
int pinDigital[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int pinStatus[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int pinIntensity[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int intensityCurve[] = {101, 95, 85, 75, 50,0};
int intensityMark = 50;
int timer = 0;
int cycleDefs[59][11] = 
  {
//    {5,0,5,0,5,0,5,0,5}, 
//    {0,0,5,5,5,5,0,0,0},
    {2,0,0,0,0,0,0,0,0,0,0}, 
    {2,1,0,0,0,0,0,0,0,0,0}, 
    {3,2,1,0,0,0,0,0,0,0,0}, 
    {4,3,2,1,0,0,0,0,0,0,0}, 
    {5,4,3,2,1,0,0,0,0,0,0}, 
    {5,5,4,3,2,1,0,0,0,0,0}, 
    {5,5,5,4,3,2,1,0,0,0,0}, 
    {5,5,5,5,4,3,2,1,0,0,0}, 
    {5,5,5,5,5,4,3,2,1,0,0}, 
    {5,5,5,5,5,5,4,3,2,1,0}, 
    {5,5,5,5,5,5,5,4,3,2,1}, 
    {5,5,5,5,5,5,5,5,4,3,2}, 
    {5,5,5,5,5,5,5,5,5,4,3},
    {5,5,5,5,5,5,5,5,5,5,4},
    {5,5,5,5,5,5,5,5,5,5,5},
    {5,5,5,5,5,5,5,5,5,5,5},
    {4,5,5,5,5,5,5,5,5,5,5}, 
    {3,4,5,5,5,5,5,5,5,5,5}, 
    {2,3,4,5,5,5,5,5,5,5,5}, 
    {1,2,3,4,5,5,5,5,5,5,5}, 
    {0,1,2,3,4,5,5,5,5,5,5}, 
    {0,0,1,2,3,4,5,5,5,5,5}, 
    {0,0,0,1,2,3,4,5,5,5,5}, 
    {0,0,0,0,1,2,3,4,5,5,5}, 
    {0,0,0,0,0,1,2,3,4,5,5}, 
    {0,0,0,0,0,0,1,2,3,4,5}, 
    {0,0,0,0,0,0,0,1,2,3,4},
    {0,0,0,0,0,0,0,0,1,2,3},
    {0,0,0,0,0,0,0,0,0,1,2},
    {0,0,0,0,0,0,0,0,0,0,2},
//    {5,0,5,0,5,0,5,0,5}, 
  
    {0,0,0,0,0,0,0,0,0,0,2}, 
    {0,0,0,0,0,0,0,0,0,1,2}, 
    {0,0,0,0,0,0,0,0,1,2,3}, 
    {0,0,0,0,0,0,0,1,2,3,4}, 
    {0,0,0,0,0,0,1,2,3,4,5}, 
    {0,0,0,0,0,1,2,3,4,5,5}, 
    {0,0,0,0,1,2,3,4,5,5,5}, 
    {0,0,0,1,2,3,4,5,5,5,5}, 
    {0,1,2,3,4,5,5,5,5,5,5}, 
    {1,2,3,4,5,5,5,5,5,5,5}, 
    {4,4,4,5,5,5,5,5,5,5,5},
    {4,5,5,5,5,5,5,5,5,5,5},
    {5,5,5,5,5,5,5,5,5,5,5},
    {5,5,5,5,5,5,5,5,5,5,5},
    {5,5,5,5,5,5,5,5,5,5,5},
    {5,5,5,5,5,5,5,5,5,5,4}, 
    {5,5,5,5,5,5,5,5,5,4,3}, 
    {5,5,5,5,5,5,5,5,4,3,2}, 
    {5,5,5,5,5,5,5,4,3,2,1}, 
    {5,5,5,5,5,5,4,3,2,1,0}, 
    {5,5,5,5,5,4,3,2,1,0,0}, 
    {5,5,5,5,4,3,2,1,0,0,0}, 
    {5,5,5,4,3,2,1,0,0,0,0}, 
    {5,5,4,3,2,1,0,0,0,0,0}, 
    {5,4,3,2,1,0,0,0,0,0,0}, 
    {4,3,2,1,0,0,0,0,0,0,0}, 
    {3,2,1,0,0,0,0,0,0,0,0},
    {2,1,0,0,0,0,0,0,0,0,0},
    {2,0,0,0,0,0,0,0,0,0,0}
  
    };


  
void setup()
{
  int i;
//  Serial.begin(9600);
//  Serial.println("Program Loaded");  
  for (i = 0; i < numPins; i++)
  {   
    pinMode(pins[i], OUTPUT);    
  } 
  pinMode(13,OUTPUT);
}


void loop()
{
  
  int i;
  int tmp;

  
  timer++;
  if((timer % intensityMark)==0)
  {
    for(i = 0; i<numPins; i++)
    {
      int targetIntensity = intensityCurve[pinStatus[i]];
      if(targetIntensity > pinIntensity[i])
      {
        pinIntensity[i]++;
      }
      else if(targetIntensity < pinIntensity[i])  
      {
        pinIntensity[i]--;
      }
    }
  }

  for (i = 0; i < numPins; i++) 
  { 
    if((timer % intensityMark) >= pinIntensity[i])
    {
      if(pinDigital[i] == 0)
      {
         pinDigital[i] = 1;
         digitalWrite(pins[i],HIGH);
      }
     
    }
    else
    {
      if(pinDigital[i] == 1)
      {
         pinDigital[i] = 0;
         digitalWrite(pins[i],LOW);
      }
    }
  }
  if(timer == cycleTime)
  {
    timer = 0; 
    cycle++;
  }
  else
  {
    return;
  }
//  Serial.read();
  if(cycle >= (numCycles))
  {
    cycle = 0; 
    digitalWrite(13,HIGH);
  }
  if(cycle == 20)
  {
    digitalWrite(13,LOW);   
  }

  for(i=0; i<numPins; i++)
  {
    pinStatus[i] = cycleDefs[cycle][i];  
  }

}

plateau-n:
Hi,

I stumbled across this old code in the internet and would like to use it for a model that I am building, but have a hard time to figure out the correct wiring, which is long gone. I am using a Arduino Pro Mini. The left and the right light bar is moving contrary, like in this video: 1/18 Knight Rider Shelby GT500 with full working lights - YouTube.
If someone could help out with a wiring diagram (breadbord etc.) to make my project work I'm willing to donate

Your post is confusing. You ask about a wiring diagram, but then say all is working but sequencing in reverse.
If the sides are not working in the sequence you want, then you need to just move the wires to the leds you want.
Paul

Lets start with the picture of your hardware:
(see first attachment)
The sketch you have seems to use 11 LEDs. Each is connected as seen in the 2nd line
match each one with the corresponding pin on the brown column of the above diagram. If it does not suit you well you may change the LED to pin correspondence changing those numbers on the 2nd line.
If you are to light LEDs needless to say that you need a resistor in series to each one. Try with 1-3 LEDs first in this "wiring" :
(see second attachment)
If the effect is the reverse of what you want it to be (LEDs dark <--> light) connect each LED reverselly and their common point to the +5V.

If they work populate with more LEDs and when you have all 11 resistors - LEDs pairs popoluate with another 11 reisistors-LEDs pairs to make the other mirror-symetrical line of lights.

The less Ohms the resistor the brighter the light, but I recommend not going lower than about 200Ohms value (unless you can calculate by the LEDs IV characteristic maximum current not higher than about 10mA)
I assume that piece of program works.

Need more info? I am the author of this nice book, just to have it in mind...

Hope I helped a guy who is making a project I was building with primitive electronics 30+ years ago while I was a kind!! Make the KIT rock!!!!!!!!!!! You brought forward so many awesome memories !!

SNAG-2020-12-22-23-10-21.png

SNAG-2020-12-22-23-10-56.png

SNAG-2020-12-22-23-10-21.png

SNAG-2020-12-22-23-10-56.png

The sketch it working, but that is not the same as the original knight rider lights.
The Youtube video is also not the same as the original.
Is there a good Youtube video that shows the version of the series of 2008 or the movie of 2008 ?

I tried the sketch without any changes in Tinkercad:
tinkercad.png

tinkercad.png

Paul_KD7HB:
Your post is confusing. You ask about a wiring diagram, but then say all is working but sequencing in reverse.
If the sides are not working in the sequence you want, then you need to just move the wires to the leds you want.
Paul

Hi Paul, I meant that light bar has a left and a right side. The lights on each side are moving “contrary” to each other left => right | left <= right.

jfragos:
Lets start with the picture of your hardware:
(see first attachment)
The sketch you have seems to use 11 LEDs. Each is connected as seen in the 2nd line
match each one with the corresponding pin on the brown column of the above diagram. If it does not suit you well you may change the LED to pin correspondence changing those numbers on the 2nd line.
If you are to light LEDs needless to say that you need a resistor in series to each one. Try with 1-3 LEDs first in this "wiring" :
(see second attachment)
If the effect is the reverse of what you want it to be (LEDs dark <--> light) connect each LED reverselly and their common point to the +5V.

If they work populate with more LEDs and when you have all 11 resistors - LEDs pairs popoluate with another 11 reisistors-LEDs pairs to make the other mirror-symetrical line of lights.

The less Ohms the resistor the brighter the light, but I recommend not going lower than about 200Ohms value (unless you can calculate by the LEDs IV characteristic maximum current not higher than about 10mA)
I assume that piece of program works.

Need more info? I am the author of this nice book, just to have it in mind...
Practical Electronics and Arduino in 8 Hours 2020 edition, Fragos, Jim, eBook - Amazon.com
Hope I helped a guy who is making a project I was building with primitive electronics 30+ years ago while I was a kind!! Make the KIT rock!!!!!!!!!!! You brought forward so many awesome memories !!

SNAG-2020-12-22-23-10-21.png

SNAG-2020-12-22-23-10-56.png

Thanks a lot for your answer! I will try your solution and post the results. This forum is really great. I bought your book on amazon.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Can you post a picture of your project please?

This will help immensely.

Thanks.. Tom.. :slight_smile:

Koepel:
The sketch it working, but that is not the same as the original knight rider lights.
The Youtube video is also not the same as the original.
Is there a good Youtube video that shows the version of the series of 2008 or the movie of 2008 ?

I tried the sketch without any changes in Tinkercad:
tinkercad.png

It´s 11 LEDs on each side:

On a full size car, with probably far more leds, it looks like this, that´s what I am trying to copy in small:

1 Like

So you really did get 22 leds in that car model :o

Do you see the logic in the pattern ?
Both sides are the same, but mirrored. It is even possible to switch the 11 leds on the left with the 11 leds on the right, because the pattern going left is the same as the pattern going right.

Below is an example. I have pin 2 connected to both outer leds, but they can also be connected to both inner leds.
I have increased the resistors to 470 Ω, and I have all the leds with the resistors parallel.
However, if the forward voltage drop of your led is 1.6V or less, then you could use a single resistor with two leds in series.

What is the value of your resistors ? I can not see that in the photo.
What is the normal current for your leds ?

tinkercad-knightrider-2008.png

You don't have to quote our messages. What we wrote is already there :wink: I use a quote sometimes to select a single question to make it clear that I'm answering that single question.

tinkercad-knightrider-2008.png

plateau-n:
Thanks a lot for your answer! I will try your solution and post the results. This forum is really great. I bought your book on amazon.

Cheeeeeeeeeeeeeeeeeeeeeeeeers !!