Electrical – somehow use one PWM output to set various LEDs to different brightness

ledpwmtransistor-array

I would like to build a project in which 15 groups of LEDs are set to a brightness level. I have an Arduino with digital PWM outputs (which can mimic a range of voltages.) How can I do this?

One idea: connect each LED to a capacitor and use a transistor array to charge these capacitors with a voltage which will produce a controllable brightness in the LEDs? I was thinking that I could charge each capacitor with a different voltage, then re-charge them every 10th of a second of so to maintain the set level of brightness.

If so:

Will I need to use a small capacitor to turn the initial PWM output into a voltage?

How big will the individual LED capacitors need to be to maintain illumination?

How often will the capacitors need to be charged?

How will I need to use resistance in the circuit?

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

This is not exactly what you asked for, but if you want to control multiple LEDs with a single signal, I would look into WS2812 (and similar) family of LEDs and LED drivers. They only need one wire signal(plus supply rails) to control a very large number of LEDs (the more LEDs, lower the "framerate" you get).

Any "diy" implementation of a single PWM to drive multiple LEDs with independent brightnesses would require much more than a "transistor array" and capacitors. (although, yes, an IC is an array of transistors, but what I mean is that doing it from scratch might not be viable solution).

If you are willing to use more than one signal, you can look into ShiftPWM (based on 595 IC's), or into i2c based port expanders, such as PCA9685.

TLC5940 might also be useful.