I am a kind of self-taught electronics dabbler and being a selftaught tinkerer has the unfortunate consequence of reinventing the metaphorical wheel quite often. I'd like to avoid this fate again if it's possible and asking smarter people is one of ways to do it.

My current project requires me to drive, among other things, multiple LEDs (60), in a scheme of 1 diode on - 2 diodes on - 3 diodes on - and so forth up to 60 diodes simultaneously on, as opposed to first diode on - second diode on - and finally 60th diode on - one LED alight at any given time. I obviously can't use one microcontroller digital output per one LED approach due to sheer amount of outputs required. I have my hands on arduino mega2560 with 54 i/o ports and I need most of them for those other things - and obviously one needs 6 bits to encode 60 different signals, not 60 of them.

The solution I thought of, adequate to my knowledge and experience, is combining 8 CD4028 3-to-8 decoders like this


That would provide me with 1 of 64 output and here I run into first snag. I thought of joining the outputs with diodes so I have k outputs in "1" state instead of k-th - but the voltage drop while sending the signal through 60 diodes will be massive. Horrendous. How should I "unsnag" here? Is there some k-of-n integrated circuit decoder I am unaware of and can't google?

Then there's the matter of cost and complexity. I tried to avoid charlieplexing LEDs on 9 bits, because that would be one unholy mess of wires. Too big jumble of semiconductors and ICs would also be more expensive to solder than just buying another mega2560 and using one as 6 bits in - 40something LEDs out "dedicated driver".

Anybody has ideas how should I commence from here? I'll be happy even with just a general direction because another arduino is a plan that will work, I just thought I would like more elegant solution. OFC, I will not power such an amount of LEDs through microcontroller, the question above is all about driving them, not powering.

  • \$\begingroup\$ Look up the idea of multiplexing and LED sign displays, for example. In addition, I'd definitely recommend HP's "Optoelectronics Fiber-Optics Applications Manual," 2nd edition. In that book you will find almost every idea ever used for applications like this, with thorough discussions and worked out details. \$\endgroup\$ – jonk Nov 9 '18 at 8:22

One simple way to do this is to use multiple shift registers. Each one will have 8 outputs, and 3 data lines necessary to control it. The best part about them is that they can be easily daisy chained. You can easily control 60 LEDs using just 3 microcontroller pins.

There's a great tutorial on how to use them here: https://www.arduino.cc/en/Tutorial/ShiftOut shift register diagram

| improve this answer | |
  • \$\begingroup\$ Wow, I looked shift registers up before asking question and somehow missed the bit of info they can be serialised together without increase in required i/o ports (eg. not 24 ports). That's the advantage of having formal or at least thorough knowledge :/ But can these ICs power 8 LEDS without extra transistors safely? That would another great bit of simplification (and cost reduction) and essentially I'd end any further research and simply go for it. \$\endgroup\$ – vonzgred Nov 9 '18 at 13:48
  • 1
    \$\begingroup\$ Instead of 74HC595, use TPIC6C595 for 100mA current sink capability on each output, or TPIC6B595 for 150mA, vs the 8-9mA current source capability as currently drawn (74HC595 VCC & Gnd pin are only rated for 70mA absolute max). No transistors needed. Voltage to the LEDs can be higher also if you wanted a string of 3 LEDs powered from 12V for example. Don't forget a 0.1uF cap from each shift register Vcc pin to Gnd. Nice thing about shift registers, you can output whatever pattern you want. Keep 8 bytes in an array, update the array and send it out when there is a change. OE low or PWM it. \$\endgroup\$ – CrossRoads Nov 9 '18 at 14:02
  • \$\begingroup\$ As an example, a board made with TPIC6B595s drives the 3 and 6 LED segments of this display, one chip per digit. youtube.com/watch?v=6HZ0Mr51jUY \$\endgroup\$ – CrossRoads Nov 9 '18 at 14:08
  • \$\begingroup\$ Thank you, CrossRoads. They are exactly what I could use and the price difference compared to 74hc595 is marginable. And thank you, Drew, for the main direction to follow. \$\endgroup\$ – vonzgred Nov 9 '18 at 15:39

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.