I'm making an LED matrix using two DM7495N 4-bit shift registers and one 8-bit shift register. The 4-bit registers are for the anode columns and the 8-bit connects to transitstors controlling the cathode rows. The matrix is 8 by 8. This setup is necessitated by the attiny85 I'm using as the microcontroller, which does not inherently have enough I/O pins to control an 8 by 8.

My idea is to rasterize the matrix, by loading one of the 4-bit registers, while the other is displaying its contents, then switch and keep going through the whole matrix in that fashion. That way, I can keep 4 LEDs on at a time to preserve overall brightness of the matrix. The only problem is that I can not think of an easy way to load one of the 4-bit shift registers without simultaniously displaying its contents, which would display as giberish on the finished matrix.

The attiny85 has 5 I/O pins, unless you count the reset pin, which I would prefer not to use, since it would require high/low voltage programming in order to reprogram the microcontroller. I am using one of the 5 I/O pins to control the data coming into the all three shift registers. Three more pins are being used to control the serial/shift pins of the individual shift registers. That leaves me with one free I/O pin.

Is there any easy way to control which 4-bit register is displaying and which one is loading with that last pin? I have thought of using a not gate and some extra transistors to control which 4-bit register is recieving a higher current on its VCC line, so that it may be recieving enough current to recieve serial from the microcontroller, but not enough to power any of the LEDs that it is connnected to. Would that work? I'm kind of a noob with shift registers and electronics in general, so I'm not sure.

The other way I have thought of is to simply have a transistor for each output of the 4-bit registers, controlling the flow of current to the anode columns. The not gate would control which transistors are saturated depending on which register is displaying and which is loading (The input to the not gate would also be connected to the bases of four transistors corresponding to a 4-bit register and the output of the not gate would be connected to the bases of the other transistors corresponding to the other 4-bit register).

Both of these approaches would require a fair number of transistors, which I would like to avoid, considering that I am somewhat constrained on space. Sorry if this stuff is hard to visualize. If that is the case, then I could try making a schematic. I have never tried making a schematic before, but I could try. Any ideas as to how I could accomplish the effect I want, in the simplest way possible would be greatly appreciated, or just any other insight! Thanks!

  • \$\begingroup\$ Yeah I can't really decide who answered the question best... I'm just going to leave it open a little longer... \$\endgroup\$ – Holden Jun 1 '17 at 19:49

You can clock that shift register at up to 25Mhz.

Realistically, if you you get everything set up in your code right just, you should be able to load up the registers quickly enough that the transition state is not visible on the LEDs.

You might want to use the SPI hardware to drive the register that would be visible during the transition states (to change the other invisibly, just set the visible one to 0000 before updating).

Here is a trick that will give you maximum shift speed on the visible register...


  • \$\begingroup\$ Of course the other answers suggesting to use a part with a buffer are correct and a better overall solution, but do not answer the OP. An even better solution would be to make the matrix from individually addressable LEDs and then only need a single pin to drive the whole thing in full color, but sometimes you have to (or want to) use the parts you have! :) \$\endgroup\$ – bigjosh Jun 1 '17 at 19:26
  • \$\begingroup\$ That is a cool idea... I was thinking of running the attiny85 at 8MHz. I would probably want to adjust the time that the registers are just spent displaying to be much longer than the time it takes for them to update using the spi hardware, right? I'll definetly check out that reference. Thanks! \$\endgroup\$ – Holden Jun 1 '17 at 19:43
  • \$\begingroup\$ Yes, you would very quickly load each row, then just wait for maybe 5ms for it to be visible, and then very quickly load up the next row. 4 rows * 5ms per row = 20ms per refresh = 50 frames per second. Again realistically you probably do not even need 8Mhz - I bet just 1Mhz would look fine too. A 4x8 LED matrix to inspire you here ognite.com. \$\endgroup\$ – bigjosh Jun 1 '17 at 19:53
  • \$\begingroup\$ Wouldn't individually addressable LEDs ( like neopixels ) consume more power and cost more money? It wouldn't really matter for a small matrix like this one, but what if you were making a bigger one? I've seen larger LED matrices made out of neopixels, but I don't really know any of the details... \$\endgroup\$ – Holden Jun 1 '17 at 19:54
  • \$\begingroup\$ I don't know what kind of LEDs you are using now, but WS2812B pixels now cost less than $0.10 each so could potentially be cheaper. As for power, if you are running off a 5V supply and using current limiting resistors on the LEDs then the pixels could potentially use less power. \$\endgroup\$ – bigjosh Jun 2 '17 at 0:58

You might use a single buffered 8 bit register such as a 74LS595 instead of two 4 bit registers. You'd shift the new data in and toggle the latch line to move the data to the output pins. No 'giberish' results. (What he said... lines crossed in editing!)

  • \$\begingroup\$ Well thanks for responding! Yeah, everyone just sort of responded at once... \$\endgroup\$ – Holden Jun 1 '17 at 19:35
  • \$\begingroup\$ To add to my answer... If you use 2 '595s in series and shift out 16 bits at a time you'd be able to get away with only using 3 lines total... \$\endgroup\$ – BobT Jun 1 '17 at 20:39

The 7495 is an old and rather primitive part. Avoid using it.

Instead, use a shift register with a data latch, like the 74(LS/HC)595. This shift register has separate sets of "shift" and "storage" registers internally -- you can update the storage register without affecting the output, then pulse the RCLK input to copy the shift register to the storage register.

As a bonus, the '595 is an 8-stage shift register, so you'll only need one of them.

To address one other aspect of your question:

Don't mess with VCC. "Undervolting" a digital part will often make it behave erratically. It'll also sometimes make the part start drawing power from its I/Os. This could be disastrous in your situation, as the shift register is providing power to LEDs, and would end up drawing power from one of the microcontroller's I/O pins, damaging it.

  • \$\begingroup\$ Thanks! I'll probably try that ( lol I just got so many different responses at once I'm not even sure which one to try first ) Funny story is that when I first started designing this thing I was really anxious to make an LED matrix didn't want to wait for parts to arive, so I just used what I had sitting around. That is why this thing is so oddly designed. At this point, I've been working on it long enough that I have no problem just ordering something, lol. \$\endgroup\$ – Holden Jun 1 '17 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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