The 74HC164 Shift Register and your Arduino using GD74HC164 microcontroller

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?

Arduino
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
www.kpsec.freeuk.com/components/74series.htm
164 is the model number for this chip, there is a large chart of them on wikipedia
en.wikipedia.org/wiki/List_of_7400_series_integrated_circuits
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
1
01
001
0001
00001
000001
0000001
00000001
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 4×4 dot matrix with this chip and software on the arduino using only 2 digital pins (+ power and ground)

Step 2: Basic wiring and operation

Wiring
The 74HC164 is a 14 pin chip, it has 4 input pins, 8 output pins, power and ground, so lets start from the top.
Pins 1 and 2 are both serial inputs, they are setup as a logical AND gate, meaning that they both have to be logic high (ie 5 volts) in order for the bit to be seen as a 1, a low state (0 volts) on either will read as a zero.  We dont really need this and its easier to deal with in software, so choose one and tie it to V+ so it always reads high. I choose to use a jumper from pin 1 to pin 14 (V+) since you can just pop a breadboard jumper over the chip. The one remaining serial input (pin 2 in my schematics) will goto digital pin 2 of the arduino.
Pins 3,4,5,and 6 of the 74HC164 are the first 4 bytes of output
Pin 7 connects to ground
Jumping to the right, pin 8 is the clock pin, this is how the shift register knows the next serial bit is ready for it to read, this should be connected to digital pin 3 on the arduino.
Pin 9 is to clear the entire register at once, if it goes low, you have the option to use it, but nothing in this inscrutable does, so tie it to V+
pins 10, 11 12 and 13 are the last 4 bytes of output
pin 14 is the chips power

Operation
First you need to set the serial input of the register (digital pin 2 on the arduino) high or low, next you need to flip the clock pin (digital pin 3) from low to high, the shift register will read the data on the serial input and shift the output pins by 1, repeat 8 times and you have set all 8 outputs.
This can be done by hand with for loops and digital writes in the arduino IDE, but since this is a very common hardware level communications (SPI) they have a single function that does it for you.
shiftOut(dataPin, clockPin, bitOrder, value)
Just tell it where the data and clock pins are connected to the arduino, which way to send the data and what to send, and its taken care of for you (handy)

Step 3: Projects

Okay, enough lecture and theory, lets do some fun stuff with this chip!
There are 3 projects to try in this instructable, the first 2 are easy and can be breadboarded out in moments. The third one, the 4×4 led matrix, requires more time and thought to construct, due to the led wiring.
List of parts
Project 1: ‘2 Wire’ bargraph LED display controller
1 * 74HC164 Shift register
1 * solderless breadboard
1 * arduino, or arduino compatible (5v)
1 * 330 ohm 1/4 watt resistor
8 * normal output red LED’s
12 * jumper wires

Project 2: ‘2 Wire’ 7 segment display controller

1 * 74HC164 Shift register
1 * solderless breadboard
1 * arduino, or arduino compatible (5v)
1 * 330 ohm 1/4 watt resistor
1 * common cathode seven segment display
9 * jumper wires
Project 3: ‘2 Wire’ 4×4 led matrix display
1 * 74HC164 Shift register
1 * arduino, or arduino compatible (5v)
4 * 150 ohm 1 1/4 watt resistor
8 * 1Kohm 1/8 watt resistor (or larger)
8 * NpN transistor (2n3904 or better)
16 * normal output red LED’s
a means to construct it and regulated 5 volt power that can handle 160+ma (you can turn on all the LED’s at once like a brake light)

Step 4: Project 1[pt 1]: ‘2 Wire’ bargraph LED display controller hardware

LED display
Hook up the arduino and shift register according to the schematic, I already have a 10 segment bargraph display ready for breadboard use and that is what you will see in the image, but you can do the same thing  with individual led’s
On the second page I stated that these were not driver devices, that they were logic devices, with tiny amounts of current able to pass through them. In order run 8 LEDs, while keeping the circuit simple, and not cooking the shift register, requires that we limit the current quite a bit.
The LED’s are wired in parallel and share a common ground (common cathode), before going into the power supply ground they need to pass through a 330 ohm resistor, limiting the total amount of current that all the LED’s could possibly use to 10ma (at 5 volts)
This leaves the LED’s in a sickly looking state but they do light up and thus serve for this example, in order to drive the LED’s at their proper current you will need to insert a transistor where the shift register can turn on / off a higher current source (see project 3)
The Data pin of the shift register (pin 2) needs to connect to arduino digital pin # 2
The Clock pin of the shift register (pin 8) needs to connect to arduino digital pin # 3
For more detail: The 74HC164 Shift Register and your Arduino using GD74HC164 microcontroller


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top