Shift registers are a very important part of digital logic, they act as glue in between the parallel and serial worlds. They reduce wire counts, pin use and even help take load off of your cpu by being able to store their data.

They come in different sizes, with different models for different uses, and different features. The one I will be discussing today is the 74HC164 8 bit, serial in parallel out, non latched, shift register.

Why? Well for one it is one of the most basic shift registers out there, which makes learning about it easier, but it just so happened to be the only one I had (lol!)

This instructable covers how this chip works, how to wire it, and interface it with an arduino including some sample sketches and led circuits.

I hope you all enjoy!

Step 1: So, What Are Shift Registers?

As mentioned earlier they come in all different flavors, and I also mentioned that I am using a 74HC164 8 bit, serial in parallel out, non latched, shift register

so what does that all mean?!?

First, the name
74 -- means its part of the 74xx logic family, and since its logic it cannot directly control very much current  (16-20ma for the entire chip is common) , it only passes signals around, but that does not mean that signal is not going to a transistor which can switch a higher current load.

HC means its a high speed cmos device, you can read about that on the link below, but what you basicly need to know about that is that it is a  low power device and will run from 2 to 5 volts (so if your using a 3.3 volt arduino your ok)

Also it can work properly at high speeds this particular chip has a typical speed of 78mhz, but you can go as slow or as fast (until it starts goofing up) as you want

164 is the model number for this chip, there is a large chart of them on wikipedia

Next, 8 bit
A shift register is made up of flip flop circuits, a flip flop is 1 bit of memory, this one has 8 (or 1 byte of memory). Since it is memory, if you do not need to update the register you can just stop "talking" to it and it will remain in whatever state you left it, until you "talk" to it again or reset power.

other 7400 logic series shift registers can go upto 16 bit

serial in parallel out

This means your arduino sends it data serially (on off pulses one after another) and the shift register places each bit on the correct output pin. This model only requires 2 wires to be controlled, so you can use 2 digital pins on the arduino, and break those 2 out to 8 more digital outputs

some other models are parallel in serial out, they do the same thing but as inputs to the arduino (for example a NES gamepad)

non latched

This may be a downfall of this chip if you need it. As data enters a shift register via serial, it shows up on the first output pin, when a clock pulse enters in, the first bit shifts over 1 place, creating a scrolling effect on the outputs, for example 00000001 would show up on the outputs as


If your talking to other logic devices who are sharing the same clock and not expecting this, it  could cause issues. Latched shift registers have an extra set of memory, so once the data is done entering the register you can flip a switch and show the outputs, but it adds another wire, software, and things to keep up with.

In the case of this instructable we are controlling LED displays, the scrolling effect happens so fast you cant see it (except when you very first turn on the chip), and once the byte is in the shift register there is no more scrolling

We will be controlling bargraph type, 7 segment, and a 16LED 4x4 dot matrix with this chip and software on the arduino using only 2 digital pins (+ power and ground)

<p>thank you for this tutorial.very helpfull. i made it but with 74ls164. but i can not use the for digits of my C-564G(4 digit 7 segments ) in the same time? any idea to do it?</p>
<p>74LS164 does not have latch. still it can be used to control multiple characters. one option is to simply use one 74LS164 for each digit. this can only work if displays are individual and not multiplexed. if they are multiplexed (which is common when they are one display unit) you need also something to select and power one digit at a time (L293x will do).</p>
<p>thanks for giving such simple instructable, for using shift register.</p><p>Can we hook up a L293d ic with a shift register to control motors? If yes can u help me out?</p>
<p>this project makes a lot of sense, thanks! </p><p> Quick Q; I am trying to program a small shift Register so it can run a circuit on its own, arduino free, but nothing's working, can you help?</p>
<p>Well a shift register can't &quot;think&quot;. you still need a MCU a micro controller unit to give instructions. There are thousands of tutorials how to get a MCU to work without Arduino awesomeness :)</p><p>Basically you need to get a MCU (I would recommend the ATmega328 as it is the same an Arduino uses)<br>and read this: <a href="https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard" rel="nofollow">https://www.arduino.cc/en/Tutorial/ArduinoToBreadb...</a><br><br>Good luck with your project! :)</p>
<p>In Led Matrix,how we will decide that we have to use Max7219 or shift register ?</p>
<p>Thank you for this instructable. I'm just beginning with digital electronics, so I found this subject difficult to understand, but you made it very easy.</p>
<p>would you share the microcontroller circuit board layout??</p>
<p>Hello I'd like to know if you'll provide the code anytime... </p>
<p>with regard to LCD, you can use F. Malpertida's LCD library. for a tested design.. check here: </p><p><a href="https://arduinodiy.wordpress.com/2014/01/12/two-wire-interface-for-lcd/" rel="nofollow">https://arduinodiy.wordpress.com/2014/01/12/two-wi...</a></p>
<p>Great tuto !</p><p>Thanks a lot for this insructables</p>
Hi Osgeld, <br>Thanks for explaining it nicely and with full of illustrations and code. Appreciate the same. <br>Do you have something similar on using LCD (16x2) instead?
<p>something like this: ? a two wire interface for LCD with 74xx164</p><p>https://arduinodiy.wordpress.com/2014/01/12/two-wire-interface-for-lcd/</p>
<p>great. I just quickly needed to test if a specific HC164 was still working and this did perfectly. Now I know the problem is in another circuit, not the 164.<br>One question though... you refer one of the LED's to pin 9... but that is connected with Vcc, so I guess it is pin 10-13. worked for me</p>
<p>Awesome Info delivery Osgeld! Do you know if small servos could be used with these magic little shifters? I see very little v / A can go through these hence all the LED examples, would love to get more outs for stepper motors too...whaddaya think? would these work?</p>
<p>This is an amazing instruction. Thanks a lot </p>
Hello osgeld, <br>This was very helpful. I am designing a programmable musical water fountain and considering using a shift register to control MOSFETS, which will control solenoid valves. Do I understand correctly that the shift register will scroll through and trigger my MOSFETS continuously until I reset? Probably not a good idea for the valves. <br>Also, why do you recommend 74HC595 for an 8*8 display? I am not seeing the reason when reading the data sheets. <br>I am a noob, BTW.
It only scrolls on a clock pulse, so you just have to stop talking to it and it freezes in that position.
is it possible to make screening message display in 8*8 matix dipalay using arduino and this shift register <br>
it is but you really dont want to, use a 74hc595
Hi, <br> <br>This is really a great webiste. I just got it from a friend and already it helped me out with something I was looking for for a very long time -&gt; this tutorial on led matrices controlled by shift registers. Can somebody help me with mapping it to a 16x16 led array. I have one panel here with 16x16 LEDs, controlled by 32x M74HC4094 shift registers. WOW is almost the same only that in my case each LED is connected to a shift registers' output.
Thank you for creating this Instructable. Made it most clear.
Clear! <br>Thx.
&quot;some other models are parallel in serial out, they do the same thing but as inputs to the arduino&quot;. What part numbers are these, as I can't find an 8 bit PISO shift register on the 74XX parts list?
most 74 logic series I.C. have a complementary part that are 1 or 2 digits different, take a look at the 165 and 166.
Those don't do what I want, but never mind as I've sorted the problem. I need to input information from 15 different switches to the arduino, but I don't have that many pins spare <em>(some are in use as outputs)</em>. I've used 4 * <strong>73LS30</strong> (8 input NAND gates) to give a binary 4 bit output, so they will only use 4 pins on the arduino. Not as good as 1 pin (serial) but better than 15 pins!
Very cool tutorial!!!<br>I had a problem figuring out where to plug in the clock (8)<br>and pin 9 (V+) on the 74HC164. I finally got it and grounded pin 9.<br>I was wondering why when I touched pin 9, the leds would light up.<br>Then realized I was acting as a sort of ground then it hit me. LOL<br>My next tutorial will be the 7 segment display.<br><br>Also I was wondering how I can have the 4x4 matrix flash letters.<br>Could you give me some insight on that?
How can I open the file .tmp in arduino IDE ? it seems doesnt work. <br>thank you :)
click on the links above it will open in your browser, just copy and paste, or rename the tmp file to pde (have no idea why its doing that)
Okay .. i'll try .. Thanks !
This is an excellent instructible! This is by far the best beginners guide to shift registers i've come accross. Thank you so much for putting this out there.
Nice instructables.
I hope you still answer questions for this instructable. I have finished constructing the 4x4 matrix. Everything seams to work fine, but I am having trouble lighting up the LEDs.<br><br>I can easily address an individual LED to light up, but when I do I get surroundings LEDs to turn on as well ( much dimmer then the addressed LED)<br><br>I have attacked a picture to show you what is going on. I am trying to just light up and LED that is in position (1,1) but as the same time LED (4,4) is dimly lit.<br><br>here is the piece of code that I am using. <br>shiftOut(data, clock, MSBFIRST, B10000001); <br> delay(1);<br><br>Any guess as to why?
Hello Wanted to say thank you for a great tutorial, I am about to finish building the 4x4 Matrix and will let you know how it goes.
<br> Great tutorial.&nbsp; Thanks for making it, it's real helpful!<br>
This is a fantastic guide! <br> <br> I've been looking for something written like this for a while. <br>I now have a fully working 4x4 led matrix, that I've built myself, and got to show the patterns I want. <br> <br>This is all thanks to you. <br> <br> <br> Cheers, <br> <br> Mikey C
Super rad tutorial dood!
Great instructable, clear, easy to follow, helped alot
It has been so long since I have done any electronics. This was very helpful, much better than the one output per segment I was using!
It's a great way to add an alphanumeric LCD to a low pin count MCU. Instead of 14 pins, it drops to 4.
Great write up, very useful.
&nbsp;Great instructable! You gave the best explanation of shift registers that I have heard so far.
Fantastic instructable!&nbsp; Thank you :)<br /> I made this with your help.<br /> http://www.youtube.com/watch?v=3UNbvYED0bI<br />
Pretty cool!<br /> <br /> I have 4 or 5 of these chips laying around, and just for giggles I&nbsp;wired up a old 4 section 7 segment led display from an alarm clock<br />
kool ible :)<br /> i got a bunch of shift regs to put to use :P<br />

About This Instructable




More by osgeld:Project Advantage: Install a famiclone into a NES Advantage Joystick Spinner / Jog Wheel Inside of a VCR Head No CPU / MCU led pulse-fade 
Add instructable to: