I need to make 2 sets of 4 Common Cathode RGB LEDS. In each set of 4, every led must be individually addressable. It doesn't matter if both sets have duplicate outputs or not. (Although optimally they shouldn't, but thats not essential).

Now, I can't use IC's for this, except the CD74HCT4094 shift register which will be used to limit the pin usage on my µC. I did not decide this and it is out of my control so please do not ask.

I have been trying different things for a while now, but I can't seem to find a better solution than what I have here. This still needs 12 transistors and I feel like it can be built more efficiently so I'm not quite happy with it yet.

Does anyone have any ideas for improvement? Thanks in advance!

RGB Multiplex

(Note that the switches are just for simulation / demonstration purposes and that they will be replaced with the according transistor setups.)

  • \$\begingroup\$ Are they single LEDs? With two shift registers you could address up to 16LEDs. More if you charlieplexed them. \$\endgroup\$ – Brendan Simpson Mar 4 '16 at 20:03
  • \$\begingroup\$ Nope, afraid not. they are packed into one component. Described in this thread I made earlier \$\endgroup\$ – TheAlPaca02 Mar 4 '16 at 20:10
  • \$\begingroup\$ So you really are only controlling 4 pairs of LEDs? or are you actually needing independent control of each of the 8 LEDs? \$\endgroup\$ – Robherc KV5ROB Mar 4 '16 at 20:15
  • \$\begingroup\$ You could use the shift registers as a current sink, but that's not really recommended. You would just wire the anodes to a common supply and the cathodes to an individual shift register output. Why cant you use a purpose built LED CC sink? Forcing yourself to use the wrong tool for the job is a recipe for frustration. \$\endgroup\$ – Brendan Simpson Mar 4 '16 at 20:17
  • \$\begingroup\$ Ideally I would like independent control of 8 RGB's to make everything completely randomized. But since its for a reaction based game and both players have 4 RGB's each to which they have to react as fast as they can, controlling 4 pairs of RGB's should not really make that much of a difference. \$\endgroup\$ – TheAlPaca02 Mar 4 '16 at 20:19

You can get away with 7 transistors. Not only that, you can go from 2 4094s to one. What you do is send 7 bits of data. The first 4 bits are LED select bits, with one bit high and the other 3 low. The next 3 bits are the color bits, but (you may not realize it) they should be inverted - that is, a low will turn the LED on, and a high will turn it off. Assuming you are using bipolar transistors for your switches, you'll need 4 NPNs as LED selectors, and 3 PNPs as color drivers:


simulate this circuit – Schematic created using CircuitLab Here I've shown only 2 LEDs, but you just connect the others in parallel.

You will probably be counseled that connecting LEDs in parallel (when lit) is a bad idea. Generally, that's true, but if you're not trying for high currents you can get away with only using 2 in parallel. At worst, they'll probably have different intensities. In order to get around this, (and be safe) you'll need to connect your pairs like


simulate this circuit

Note that, since only one set of LEDs is turned on at any one time, the limit resistors only feed one on LED at a time, and there is no possibility of current hogging.

With this sort of multiplexing, you will have to update the LEDs at least 100 times per second, cycling through the LEDs,and more is better up to about 150 to 200 per sec. This will cause the LEDs to flicker, but the flicker rate will be the update rate divided by 4, and 30 Hz is a reasonable lower limit. But this may not be fast enough, depending on various factors, so the higher rates will probably be better.

  • \$\begingroup\$ Very interesting, thanks for the proposal! Will give this a shot tomorrow morning. The update rate should not be a problem, pretty sure I can make them look constant. On another note, is circuitlab any good for simulation? I've found multisim to be quite clunky at times \$\endgroup\$ – TheAlPaca02 Mar 4 '16 at 20:52
  • \$\begingroup\$ Would the second method still work if I simple were to add two extra pairs in parallel? \$\endgroup\$ – TheAlPaca02 Mar 7 '16 at 12:33
  • \$\begingroup\$ @TheAlPaca02 - Yes, as long as you only have 1 LED drawing current through any resistor at any time. That is, if you want 4 red LEDs you need 4 limit resistors on the red PNP collector. \$\endgroup\$ – WhatRoughBeast Mar 7 '16 at 13:47

For idividual control of all 24 emissions (8x 3-color LEDs), you won't likely accomplish anything less complex than 14 transistors/switches (2 rows & 12 columns).

With that said, however, you could accomplish that control with 7 (or 5) 'bits' of output from your shift-register (would require a few more transistors, though). This would use 2 bits-color select, 1 bit row-select, then 4 bits 4-channel LED on/off control (or 2-bits to control one @ a time). This would take 6 cycles x 7 bits (or 24 cycles x 5 bits) to 'fire' all possible combinations, but would work with your 8-bit max width on the shift register.

I would recommend using gates, rather than independent transistors, if you can "sneak them in" past the "no other ICs" rule.


CD74HCT4094 has 8 outputs, each can source or sink max 25mA. The total consumption of the package shall not exeed 50mA according to the datasheet, so you have like 6mA per output to source/sink safely.

Instead using transistors, you can get away with the shift register itself. You have 8 leds, 3 output each, so 24 outputs which you can drive right from three pieces of 4094, and the problem is solved, no?

RGB leds such as any 5050 footprint SMD leds are a way too bright when driven from 20mA. Driving them with only 6mA (bigger resistors) will still make enough light output.

I am afraid that the problem is an academic problem. I feel a bit sad, since there are ways better solutions for this.

You can use a constant current led matrix driver such as MAX7221 or MAX7219, which allows you driving 64 individual leds (or 8 RGB leds) without any additional component. You can control this with two wires over I2C bus from your microcontroller.

Another (super easy and super inexpensive) solution is to use programmable serially chainable leds, such as WS2812. This allows you driving arbitrary number of RGB leds from only one microcontroller pin, and allows full color 24 bit color mixing on each led. Each led is addressable individually, of course. See more at https://learn.adafruit.com/adafruit-neopixel-uberguide/overview

I did use 4094 as an output expander, but that was in the 1990s. There are lightyears better tools and chips since then. :)


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.