Beginner Concepts: Cascading shift registers

There’s a million tutorials out there describing how to use shift registers. If you’re just getting into embedded systems you should know how to use them as they allow you to take three microcontroller pins and expand them virtually without limits. This is due to the serial-in parallel-out nature of these integrated circuits. A key feature of these chips is the ability to overflow, or cascade to the next chip which is what provides the expansibility.

Protostack just published a tutorial that uses this hardware to interface sixteen LEDs using two shift registers. The explanation is short and to-the-point with easy to understand code examples. There’s also something to be said for their crisp and clean breadboarding work.

Take a look at how they do it and then use the concept to make a fancy clock or reduce the pins needed to drive a display.

12 thoughts on “Beginner Concepts: Cascading shift registers

  1. Nice tutorial. I’ve been messing around with an 8 bit shift register to control my quad half H bridge chip which in turn controls the motors of my little pet robot. To drive just 2 motors I didnt gain any pins, but it does allow me to upgrade to 4 wheel drive later down the road if I would like.

  2. Some friends and I build an “Art” machine using
    343 stepper motors and a pile of shift registers.

    Each group of 49 stepper motors is driven off 1
    data pin from a PC parallel port, a clock and
    a latch, so we can drive all 7 strings of 49
    motors off 9 bits of data from the PC.

    I wrote the Linux driver software to generate all
    the stepper sequences as well as the IR
    rangefinder input code using a
    board. (Like an Arduino, but people don’t
    complain about it as much. :-)

    So, I LOVE this tutorial. If anyone wants to
    know more about the non trivial parts of driving
    196 shift registers with 1 clock and 1 latch pin,
    just ask. (Hint: The signals get really ugly really quick as you add more and more shift registers to the clock and latch lines.)


    1. the post is a bit old but I’m starting with shift registers and stepper motors and I found this post interesting so I ask ;)
      Is it possible to have the details ?thanks in advance

  3. eh, if I were to clip the leads of components, then i would be really limited with where i could reuse them. I think i will stick with my messy breadboards and save the resistors and LEDs for future projects.

  4. IsotopeJ: That was my first thought as well. Sure, it looks nice but you’ll be running out of components fast. And it also seems a bit wasteful to use an entire breadboard just for the LEDs. For the tutorial it’s great since it shows what’s going on clearly but I’m too damn cheap to use up breadbards that fast hehe

  5. Seems odd that they are using a shift register chip but don’t acutally use any standard ansi c bit shifting operators in the code. Doing so would improve the extensibility, save a few lines, save a bunch of cycles and would make for much more portable code. That said, this is pretty good explanation of the hardware involved.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.