'Knight Rider' style light chaser

Discussion in 'The Completed Projects Collection' started by BillO, Mar 21, 2012.

  1. BillO

    Thread Starter Well-Known Member

    Nov 24, 2008
    985
    136
    I've seen a lot of queries lately regarding 'Knight Rider' and other types of light chasers here and on other boards. So, here is a very simple MCU approach to that classic light chaser.

    It uses an Omega Mini-328 breadboard MCU but any Arduino compatible or even just an Atmega328/168 chip on a solderless breadboard could be used to implement it.

    All it requires, beyond the MCU are 16 LEDs and four 470 ohm resistors.

    The LEDs are grouped in banks of 4 and addressed in a 4x4 matrix fashion. Indeed, the arrangement of the LEDs is one component of this project that can be altered to whatever suits the experimenter. In my case, I laid them out linearly to get that "night Rider" effect. Doing it this way allows 16 LEDs with only 8 I/O. Of course, with a Atmega328 there are other possibilities, but this gets the job done.

    I have also included an Arduino sketch that is internally documented fairly well and produces the desired effect. However, there are literally hundreds of possibilities that could be coded for this basic arrangement and this is only one simple example.
     
  2. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    Just curious, how much did that µC set up cost? I like pictures, so I massaged yours a bit...

    [​IMG]
     
  3. BillO

    Thread Starter Well-Known Member

    Nov 24, 2008
    985
    136
    The Mini-328 and the Dev-Duino together run about $43.

    It's soooo much nicer than having to bang the Mini into a breadboard with a mallet.:D I've seen folks damage a Arduino Mini getting them into the breadboard. The Dev-Duino has everything too, power supply, serial interface and auto-reset. It's nice to use.
     
  4. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,753
    760
    I can't believe I missed this. :mad:

    By the way this is interesting.

    I like to see a video of this and some more info on that thing on the ZIF socket. ( A little more detail notes on to us N00bs )
     
  5. BillO

    Thread Starter Well-Known Member

    Nov 24, 2008
    985
    136
    Okay. here you go.

    Edit: Update...

    The video is HERE

    The owners manual for the OMS Mini-328 (the thing in the ZIF socket) is HERE

    Edit: Update #2

    There was a problem with the service provider earlier, but now everything seems to be working fine.
     
    Last edited: Mar 29, 2012
  6. DakLak

    New Member

    Jan 20, 2013
    2
    2
    I like simplicity. If all you are doing is making uni or bi-directional Knight Rider lights it is very simple without resorting to a microprocessor. If you wish to program lesser counts than 100, a simple one-wire connection will achieve this.

    If this is a demonstration in deploying a microprocessor, I apologise for intervening.

    You can drive up to 100 'positions' just using two CD4017s and a 555 plus 20 transistors and 40 resistors.

    I live in VietNam where cars are too expensive so the youngsters 'soup' up their motorcycles by adding Knight Riders, etc.

    I can't give you realistic costs since our purchases are so cheap. 100 quarter watt resistors cost 15 cents (US), a signal transistor costs 1 cent a piece and CD4017s are priced at 14 cents. The 55 costs 7 cents!
     
  7. R!f@@

    AAC Fanatic!

    Apr 2, 2009
    8,753
    760
    Hey Bill0, I cannot see the video
     
  8. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    Takes some time to load...
     
  9. BillO

    Thread Starter Well-Known Member

    Nov 24, 2008
    985
    136
    @DakLak

    Yes, it was meant to be an exercise in using a MCU, not a minimum cost solution. A demonstration of how quickly and easily this can be done using the power of a microcontroller.

    @R!f@@, it should work. I just tried it myself.
     
  10. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Here's a video of Bill's (unaltered) Knight Rider program running on a $4.30 TI MSP430 Launchpad board. The Launchpad board has a 20-pin MSP430G2452 installed and I used the free Arduino compatible Energia development software to upload the program onto the Launchpad.

    MSP430 Launchpad Knight Rider video

    Regards, Mike

    [​IMG]

    [​IMG]
     
    Last edited: Feb 2, 2013
    thatoneguy likes this.
  11. BillO

    Thread Starter Well-Known Member

    Nov 24, 2008
    985
    136
    That's neat. I have an MSP430 that I've never tried. I need to get myself a copy of the Energia IDE to try it out.
     
  12. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Hi Bill,

    Hope you didn't mind me adding to your thread... Anyway, here's a video for a Charlieplexed version;



    Here are Charlieplexed and Multiplexed wiring diagrams for comparison and sketches to make them work on Arduino or on Energia + Launchpad...

    Have fun... Mike

    [​IMG]
    [​IMG]

    Code ( (Unknown Language)):
    1.  /*
    2.   *  Knight Rider Charlieplex Demo for
    3.   *  Arduino or MSP430 Launchpad + Energia
    4.   *
    5.   *  Michael McLaren, K8LH
    6.   *  Micro Application Consultants
    7.   *
    8.   */
    9.  
    10.   void setup()            
    11.   { pinMode(6, INPUT);
    12.     pinMode(7, INPUT);
    13.     pinMode(8, INPUT);
    14.     pinMode(9, INPUT);
    15.     pinMode(10, INPUT);
    16.   }
    17.  
    18.   void loop()
    19.   { static byte led = 1;          // value 0..19
    20.     static byte dir = -1;         // value 1 or -1
    21.     led += dir;                   //
    22.     byte col = led / 4 + 6;       // D6..D10 cathode columns
    23.     byte row = led % 4 + 6;       // D6..D9 anode rows
    24.     if(col == row) row = 10;      // if col == row, use "float" pin
    25.     pinMode(col, OUTPUT);         // turn column 'on'
    26.     digitalWrite(col, LOW);       //   "
    27.     pinMode(row, OUTPUT);         // turn row 'on'
    28.     digitalWrite(row, HIGH);      //   "
    29.     delay(30);                    //
    30.     pinMode(col, INPUT);          // turn column 'off'
    31.     pinMode(row, INPUT);          //
    32.     if(led == 0) dir = 1;         // check for end-of-scan
    33.     if(led == 19) dir = -1;       //    "
    34.   }                               //
    35.  
    Code ( (Unknown Language)):
    1.  /*
    2.   *  Knight Rider Multiplex Demo for
    3.   *  Arduino or MSP430 Launchpad + Energia
    4.   *
    5.   *  Michael McLaren, K8LH
    6.   *  Micro Application Consultants
    7.   *
    8.   */
    9.  
    10.   void setup()            
    11.   { pinMode(2, OUTPUT);
    12.     pinMode(3, OUTPUT);
    13.     pinMode(4, OUTPUT);
    14.     pinMode(5, OUTPUT);
    15.     pinMode(6, OUTPUT);
    16.     pinMode(7, OUTPUT);
    17.     pinMode(8, OUTPUT);
    18.     pinMode(9, OUTPUT);
    19.     pinMode(10, OUTPUT);
    20.   }
    21.  
    22.   void loop()
    23.   { static byte led = 1;          //
    24.     static byte dir = -1;         //
    25.     led += dir;                   //
    26.     byte col = led / 4 + 6;       // D6..D10 common cathodes
    27.     byte row = led % 4 + 2;       // D2..D5 mux'd anodes
    28.     digitalWrite(col, LOW);       // active lo col on
    29.     digitalWrite(row, HIGH);      // active hi row on
    30.     delay(25);                    //
    31.     digitalWrite(row, LOW);       //
    32.     digitalWrite(col, HIGH);      //
    33.     if(led == 0) dir = 1;         // check for end-of-scan
    34.     if(led == 19) dir = -1;       //    "
    35.   }
    36.  
     
    Last edited: Jan 31, 2016
  13. BillO

    Thread Starter Well-Known Member

    Nov 24, 2008
    985
    136
    Of course I don't mind Mike.

    Thank you for adding in.
     
Loading...