I would like to be able to control around 100 independent LEDs using an Arduino. The problem is that the Arduino does not have nearly enough pins that can be configured for this. What would be a way to solve this problem? Is there a chip that can demux a more complex signal from the Arduino that could then control the LEDs? Or is there another solution?
-
what are your refresh rate requirements? how much current draw per LED? – vicatcu Nov 02 '12 at 04:15
-
refresh rate of around 1 second. thinking around 8ma per LED. Would be powered by external adapter - not the Arduino – Alexis K Nov 02 '12 at 05:42
-
There are many demultiplexing solutions. But consider the complexity of your task; will the algorithm you need to generate the data fit within the constraints of the Arduino's mcu? Some tasks will, others will not or will only fit via create designs which can be quite satisfying to create but may make code maintenance challenging. – Chris Stratton Nov 03 '12 at 14:13
1 Answers
First off, an Arduino cannot directly drive 100 LEDs, as the combined current that the device must source or sink will far exceed both the microcontroller, and the voltage regulator on the Arduino board. A custom Arduino Shield with its own power source and regulation might fit the bill, though.
There are several easy approaches, the simplest approach is detailed below:
TLC5940 constant-current LED driver in cascaded configuration:
The TLC5940 drives 16 LEDs per IC, controlled by serial input through a slight variant of an SPI interface. Up to 40 TLC5940 devices can be cascaded, but 7 of them will be sufficient to drive the 100 LEDs in the question.
There are at least a couple of Arduino libraries (1, 2) for the TLC5940.
Suggested clock rates to send from the Arduino, and corresponding refresh rate:
- 1 MHz GSClk using code in this thread.
- 330 KHz SCLK (serial data clock)
- Thereby, LED data refresh rate 244 Hz
This is based on the formulas from the datasheet:
f(GSCLK) = 4096 * f(update)
f(SCLK) = 193 * f(update) * n
where:
f(GSCLK): minimum frequency needed for GSCLK
f(SCLK): minimum frequency needed for SCLK and SIN
f(update): update rate of whole cascading system
n: number cascaded of TLC5940 devices
The TLC5940 is a constant current sink, so the anodes of the LEDs would be tied to a voltage a couple of volts greater than the LED Vf, or around 7 volts, whichever is lower, powered independently of the Arduino's power pins. This voltage source needs to be capable of supplying 100 * (whatever current you run the LEDs at), but can be an unregulated source.
The LED cathodes go to the drive lines of the respective TLC5940 ICs.
The TLC5940 itself consumes up to Icc = 60 mA per device during data write, so powering 7 of them from the Arduino won't work, it will require an independent 3.3 to 5 volt regulated Vcc to be provided, ideally the same value as the Vcc of the Arduino being used, and the ground traces need to connect back to the Arduino's ground, of course. Operating the TLC parts at a different voltage than the Arduino would bring in a need for level conversion of the serial signal, hence best avoided.
Several YouTube videos demonstrate using Arduino with cascaded TLC5940 ICs.
MAX7219 (serial) / MAX7221 (SPI) 8-Digit LED Display Drivers:
Although these ICs were designed for driving 7-segment numeric LED displays, they provide individual LED control, so can be used for up to 64 LEDs per IC. Two of them can be cascaded to drive the 100 LEDs required. Page 13 of the datasheet shows a cascade configuration.
The LEDs would have to be electrically connected as groups of up to 8 LEDs each sharing one cathode line (common cathode), for this design.
The MAX7219/7221 are multiplexing LED drivers, hence maximum brightness of LEDs will be lower than for a static LED driver like the previous section.
Here is a useful LED matrix library and guide using the MAX7219.
Some relevant YouTube videos (1, 2) may be of interest.
Charlieplexing: SPI LED drivers, MAX6950 / MAX6951
Again, these ICs were designed for driving 7-segment numeric LED displays, they provide individual LED control, so can be used for up to 40 / 64 LEDs per IC. Two / three of them can be hooked up on an Arduino SPI bus to drive the 100 LEDs required.
Design notes remain the same as the previous section. Also, individual LED maximum brightness would be lower than for the straight multiplex design of the MAX7219.
There are some YouTube videos that might be of interest.
Discrete component designs, shift registers, IO expanders, cuttable LED strips with individual controllers, and many more...
These are all approaches that have been used with varying levels of simplicity and success. They are more complex implementations than the 3 approaches above, hence not detailed any further. Searching the web would yield useful guides for these approaches, if needed.
One key irritant with such designs is the need for current control resistors on every LED or LED string. Devices specifically designed for LED driving typically do not need this.
I don't have personal experience with this last set of options, so cannot help much.
Footnote: After responding to this question, I found an older question, that has answers detailing and discussing several of the approaches in my last section. That thread makes interesting "further reading as homework".

- 50,188
- 8
- 103
- 200
-
1
-
Also how does the Max5951 provide "individual LED control" -- it only seems to have 7-segment control (8 pins for 8 digits), no? – Thomas E Nov 02 '12 at 07:19
-
Yup, those too. Need a lot of resistors for protecting the LEDs, and then the wiring's complex compared to the purpose-built ICs. – Anindo Ghosh Nov 02 '12 at 07:19
-
@ThomasE No: "The MAX6950 drives up to five 7-segment digits or 40 discrete LEDs. The MAX6951 drives up to eight 7-segment digits or 64 discrete LEDs.". One just hooks up groups of 8 LEDs each to one cathode line, as described in the MAX7219 section of my answer. – Anindo Ghosh Nov 02 '12 at 07:23
-
So then it would be grouped control of the 8 LEDs together, wouldn't it? I'm asking because I assumed so and passed on this chip when I encountered it earlier – Thomas E Nov 02 '12 at 07:25
-
-
@ThomasE No, every individual LED can be controlled by the MAX6950/6951 - that is a prerequisite for charlieplexing anyway. As a matter of fact, these ICs actually cannot control multi-digit displays (though the datasheet suggests a work-around), since they require individual access to each LED for Charlieplex scanning. – Anindo Ghosh Nov 02 '12 at 07:31
-
-
The TLC5940 is overkill if you don't need to change the LEDs brightness, it is somewhat expensive. Though if you want to its 12 bit PWM it is very nice, there are variant ICs for up to 48 LEDs. – starblue Nov 02 '12 at 13:53
-
2@starblue *Overkill v/s ease of DIY implementation*: For a one-off or hobby effort, would the TLC5940 ($3.78 in single quantities at DigiKey) not remain the **simplest** solution, because of the Arduino libraries and active support within the Arduino community? Unless there are other equally well-supported parts such as you pointed out, that the Arduino forums love. – Anindo Ghosh Nov 02 '12 at 14:02
-
I've recently had great success with 16 LEDs using a two 595 shift registers.. however like others have said you'll need more power for driving 100 (and more shift registers if you go that route...) – John Hunt Mar 21 '13 at 09:19