Electronics noob here. I made a simple follow-LED circuit in one direction using a 555 timer, a 93N counter, and a 138N decoder. Now I want to make it go back and forth.

This is what I tried:

  1. Added a 04N inverter to get the following opposite values.
  2. Added one 151N multiplexer for each bit (regular and inverted.)
  3. Tied a single select pin of each multiplexer to a button.

Now I can change the direction with a button press, but I'd like to automate that action.

I was thinking of using a flip-flop (76N) for the multiplexer selection, but I have to get a clock signal when either all bits are 0s or 1s.

I could use an AND gate for when all are 1 and a NAND for 0, but how then I would have to select from those two on some kind of condition. But they are not clock signals.

Can this approach work? Not looking to optimize yet, just practicing working with ICs.

  • 4
    \$\begingroup\$ Circuit schematic >> lots of words. \$\endgroup\$
    – Transistor
    Apr 12, 2023 at 18:14
  • 2
    \$\begingroup\$ It's usually just easier to have the counter sequence through enough states for the entire back-and-forth sequence, and decode all of those states. Each LED will be lit for one or two states, so just OR them together as needed. Since the outputs of the '138 are active-low, use a 74xx08 as an active-low OR gate. \$\endgroup\$
    – Dave Tweed
    Apr 12, 2023 at 18:41
  • \$\begingroup\$ Note also that inverter + mux is equivalent to XOR gate. \$\endgroup\$
    – Dave Tweed
    Apr 12, 2023 at 18:42
  • \$\begingroup\$ We had this as a lab in our Digital Engineering class. 8 different groups programmed and built solutions. Only 1 pair wrote the code so the end leds were not flashed twice on turn-around. Even the Prof in charge said he had not done that when he tested the lab himself. We got a good grade :) \$\endgroup\$
    – Solar Mike
    Apr 12, 2023 at 19:23

3 Answers 3


Use "OR" gates...

You just fold the "follow" back on itself using an "OR" gate to merge 2 of the signals in the sequence.

The real KITT had 8 lights. The sequence was

  12345678765432123456787654321 ...  

Note that it did not dwell for a double-beat on the 1 and 8. So you actually have a sequence of 14 steps. Thus we arrange them like this.

           04 etc. 

So nothing easier. Set up logic for a 14-light marquee, then merge 02 and 14 to drive lamp 2, 03 and 13 to drive lamp 3, etc.

Attack, Decay, Sustain, Release

enter image description here

The sweep is moving to the right.

Note also that the original KITT used incandescent bulbs which have a perceptable rise time and a notably slow fall time, possibly enhanced electronically (e.g. it might be an electromechanical action with capacitors added). Thus, KITT had a "trailing edge" behind the sweep. If you want to do this with LEDs, you'll need either a lot more logic, or something analog to simulate the attack-sustain-release behavior seen here. Watch this on desktop not mobile - then you can use the , and . keys on the main keyboard to single-frame through the sequence.

Now you know why everyone gets this wrong. They either double-beat at the ends, or they totally forget about attack/sustain/release and blink the lights on and off abruptly.

  • \$\begingroup\$ I made this Knight Rider with trailing lights circuit: edutek.ltd.uk/Circuit_Pages/Nite_Rider.html \$\endgroup\$
    – Audioguru
    Apr 12, 2023 at 23:23
  • \$\begingroup\$ Thanks, got a lot of useful information from this question, though as I can accept only one - I choose this one :) \$\endgroup\$ Apr 13, 2023 at 7:11

You could use a counter with up/down capability like a 4029 and have the first and last decoded outputs toggle a flip-flop on the UP/DOWN pin. Or a microcontroller, which would allow you to have any pattern you want and e.g. cycle through them with a switch.


With inverters and multiplexers, I think you are heading down a relatively complex path. Search for knight rider schematic to see how others have solved this.

Once you have a flipflop that is set and reset by the ends of the pattern, it can control any of several approaches.

A CD4017 combines the count and decode functions into one chip. As mentioned above, add two quad XOR packages as gated inverters controlled by the ff.

As mentioned above, change to an up/down counter whose direction is controlled by the ff, driving the 138 decoder. This feels like the minimum-chip-count solution using discrete logic.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.