17
\$\begingroup\$

I'm learning Arduino and one thing that caught my attention was the use of Shift Registers to expand the number of digital pins.

I've seen many tutorials that use 74HC595 Shift Register, but my local store does not sell this exact Shift Register, but does sell many others like:

74HC166
CD4015
74HC165
74HC164
CD4014
74HC595 SMD

They all seem to be 8-bit shift registers.

I want to use them to light some LEDs using an Arduino. I imagine they have very specific purposes, but over all, could I use any of them in my project?

What is the main difference between these Shift Registers?

\$\endgroup\$
1
  • 14
    \$\begingroup\$ Have you tried reading the datasheets? They're usually a very good source for finding out the difference between two components. \$\endgroup\$
    – Jules
    Commented Sep 13, 2018 at 14:25

5 Answers 5

39
\$\begingroup\$

The easiest way to answer a question like this is to look at the datasheets for the components:

  • CD4015 is part of the older 4000-series range of chips. Back when they were introduced, they were CMOS while 7400 chips were TTL, although nowadays 74HC-type chips are also CMOS. They still see some use because they work with a wider voltage range than 74HC chips (up to 15V, versus 7V maximum for 74HC or 5.5V for 74LS). They're also somewhat slower (maximum 3MHz at 5V, versus 25MHz for the 74HC595).

  • CD4014 has similar specifications to the 4015, but rather than having pins that let you take all of the values that have been shifted in out at once, it lets you put multiple values in at once and then shift them out one at a time. So the CD4015 is like a serial to parallel converter, but this one is a parallel to serial converter.

  • 74HC166 is parallel-in serial-out like the CD4014, but is in the 74HC range so has the smaller voltage range and faster response of that range.

  • 74HC165 allows both parallel and serial in, and is serial out. It also provides both inverted and non-inverted output.

  • 74HC164 is serial in and parallel out, like the CD4015, but is 74HC series so faster and lower voltage.

  • 74HC595 (or more exactly, SN74HC595J) and 74HC595-SMD (which could be a number of different minor variations) are the same component in different packages. The first is a traditional "DIP" package, which is likely what you want if you're working on breadboard, stripboard, or perforated prototype boards. The later is a surface mount package (probably SOIC) which is smaller and easier to solder to a PCB, but can be a bit of a pain for prototyping. These are serial-in parallel-out, but they also have a separate set of registers that the data being input can be copied to. This means that your parallel outputs can be made to change simultaneously, rather than having invalid data in them while the new data is being shifted in.

Some other chips that you may want to have a look at:

  • As mentioned by @supercat in the comments, the CD4094 is useful when you need to control more than 8 output lines because it makes cascading the output from one chip to the next easier. The 74HC4094 is a chip with the same behaviour and pin layout but using the 74HC voltages and faster speeds.
  • TLC6C5912 is a 12-channel serial in parallel out chip that's specifically designed for driving LEDs, and can handle LEDs with voltages and currents much larger than any of the above.
  • TLC5911 is a monster of a chip, but it controls 16 LEDs, and has a constant current driver for each one that can be individually controlled to one of 128 levels, i.e. you can use it to individually dim each LED, by shifting in 7 bits of brightness information for each one rather than just 1 single on/off bit. Useful for signs that display images/videos.
\$\endgroup\$
1
  • 2
    \$\begingroup\$ The CD4094/74HC4094 may also be a nice one to mention. When cascading most shift register chips, one must ensure that clocks are precisely synchronized or that the downstream clock happens first. The '4094 chips eliminate that issue by including a cascade output that switches on the opposite edge from the input. \$\endgroup\$
    – supercat
    Commented Sep 13, 2018 at 16:33
8
\$\begingroup\$

To add to the answer of schadjo:

The two most commonly used for Arduino (but not only) are 74HC165 and 74HC595.

The 74HC165 can be used to connect upto 8 inputs (e.g. switches) to just a few GPIO's.

The 74HC595 can be used to connect upto 8 outputs (e.g. LEDs) to just a few GPIO's.

\$\endgroup\$
4
  • \$\begingroup\$ Does the 74HC595 SMD work exactly as the same as 74HC595? Does the SMD make any significant difference? \$\endgroup\$ Commented Sep 13, 2018 at 14:37
  • 2
    \$\begingroup\$ @user3347814 What does the datasheet say? We've led you to water. Drink it. \$\endgroup\$ Commented Sep 13, 2018 at 14:39
  • 3
    \$\begingroup\$ As HarrySvensson says, you can read all details in the datasheet. Normally there is no functional difference and no differences in pin layout, but of course the dimensions are smaller, and mostly the power consumption is less (due to the smaller internal components). \$\endgroup\$ Commented Sep 13, 2018 at 14:40
  • \$\begingroup\$ The Mode Control pins may have surprises for you. Ability to Clear, to LeftShift, to RightShift, to ParallelLoad (to update), to NotClock even if Clock is changing levels, etc, all may be valuable to use. \$\endgroup\$ Commented Jan 10, 2019 at 16:12
8
\$\begingroup\$

For a newcomer, the main distinction in shift registers is probably parallel in/serial out (PISO) and serial in/parallel out (SIPO).

As the names suggest, a PISO takes in, say, an 8-bit-wide signal, and lets you individually shift those bits out, one at a time, (in series) with single clock pulses.

A SIPO lets you shift each of the bits in sequentially, then have all, say, 8 of those bits be present on 8 output pins simultaneously, i.e., in parallel.

\$\endgroup\$
4
\$\begingroup\$

74HC595 (thruhole or SMD) has 70mA limit on Vcc and Gnd pin, so you should select current limit resistors that allow 8-9 mA. (8 outputs x 9mA = 72mA).

To select a resistor: (5V - Vf)/.008 = resistor, with Vf the forward voltage of the LED (example, ~ 2.5V for a typical Red LED, some greens and yellows, and often somewhat higher for other colors like blue, white).

(5V - 2.5V)/.008A = 312.5 ohm, so 300 or 330 ohm will do great. 270 would also be okay, for 9.25mA. 1K would cut down the brightness some, but still be plenty bright. 8mA can be quite bright with a modern high efficiency LED.

If you need more current, than TPIC6B595 and TPIC6C595 are controlled the same way as 74HC595 - with clock, data, and latch - but can sink 150ma and 100mA per output pin (shift in a 1, that turns the output on, it goes low to sink current from 5V thru the LED and its resistor. Vs Sourcing current thru the LED/resistor to Gnd).

Don't be afraid to order parts online. Digikey.com and Mouser.com both carry all kinds of parts, and inexpensive USPS mail will get them to you in 2-3 days.

If you want to stock up, spend $20-30 and get a bagful of parts from taydaelectronics.com. You can get a lot of stuff for that much. Parts come from Thailand I think (via Colorado in the US from wht I've received), order a selection of parts that will last quite a few projects.

\$\endgroup\$
3
\$\begingroup\$

In addition to all the other fine answers, the pin map of the IC can certainly differ between different IC's. You can't just plug a wire into the same pins that you would use for another Shift Register, and expect it to work. If you match pin functionality, there's a much better chance, though pin functionality may not be the same on different chips, either.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.