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.

Comments

  1. bluewraith says:

    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. Stevetronics says:

    THANK YOU!!!! Thank you, HAD, for the clean breadboarding plug! Something everyone should do but very few do. Thank you.

  3. alankilian says:

    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 Wiring.org.co
    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.)

    References:

    http://picasaweb.google.com/AlanKilian/AfterHours#

    http://picasaweb.google.com/AlanKilian/Museum#

    http://bobodyne.com/web-docs/robots/Hex/index.html

    http://taomc.com/art/kinetic_sculptures/animanemone.html

    • alex says:

      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

  4. scatterbrained says:

    LOL, it would’ve been good if TFA used LED drivers like these

    http://www.marktechopto.com/Products/toshiba-led-drivers.cfm

    http://www.allegromicro.com/en/products/categories/ics/leddriver.asp

    http://focus.ti.com/paramsearch/docs/parametricsearch.tsp?family=analog&familyId=480&uiTemplateId=NODE_STRY_PGE_T

    generally much nicer than a simple shift register, especially if they buffer clock and data for cascading.

  5. matt says:

    as an idea for a more advanced project, here’s a lovely led random number generator based on 4 shift registers.

    to my eye, it gives the impression of flowing water. one of my faves :)

  6. fotoflojoe says:

    Looks like the site is down. /.’ed?!?!?

  7. IsotopeJ says:

    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.

  8. wahacks says:

    I know a lot of people here hate Arduinos, but here is a simple Arduino shield that uses shift registers to add more output pins. There’s a software library that makes access to the pins trivial:

    http://nootropicdesign.com/ez-expander/

  9. sneakypoo says:

    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

  10. epooch says:

    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.

  11. benny boy says:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,386 other followers