I'd like to use several LEDs on a project, with brightness control (it's a scale model of a street with houses, with LEDs of different brightness in each house, which I've been working on with my son). However, I'd want the brightness of the LEDs not to change when I turn some of them on and off (or equivalently, if I add or remove LEDs).

I know I can control dimness of LEDs either by directly varying the current applied to them as in this project from someone else or by using PWM as suggested here -- but in both cases (I implemented the two projects listed above as a test), the current source is the same so their brightness will vary depending on the number of connected LEDs (which make sense, since the full LED set is plugged on a single transistor's collector).

What would be the simplest way to achieve what I'd want in this case? I'd rather avoid using, for example, an Arduino (would be too physically large and would involve programming -- I'd like this to be as simple, small, cheap as possible, without microcontrollers). Is there some simple way to decouple each LED from the others, and still have central control of their brightness?

Connecting the LEDs in serial would not be good either, since I would not be able to remove those in the middle (and this would require a too high voltage to work, because of the accumulated voltage drop of the LED string).

Thank you!

  • 1
    \$\begingroup\$ Yes, you can do this VERY simply. Use a voltage supply. Each LED is connected to the voltage supply by way of a resistor (could be a variable resistor for individualized brightness control). If you change the main voltage supply, all the LED's will dim together, to an extent. If you turn some LED's on or off, they will have no effect on the others. \$\endgroup\$ – mkeith Mar 4 '17 at 22:46
  • 1
    \$\begingroup\$ Why constant current driver? Why not constant voltage with PWM, and series resistors for each LED? \$\endgroup\$ – Szidor Mar 4 '17 at 22:47
  • 1
    \$\begingroup\$ Oh, I see the problem. You don't even have a variable voltage supply available. \$\endgroup\$ – mkeith Mar 4 '17 at 23:23
  • 1
    \$\begingroup\$ given enough LEDs, the microcontroller approach might be actually the simplest solution (using e.g. WS2811) allowing you to connect any number of lights to a single chain and precisely control their individual brightness \$\endgroup\$ – szulat Mar 5 '17 at 0:15
  • 1
    \$\begingroup\$ How many LEDs? 16? 25? 36? 49? 64? Minimum and maximum. What kind of LEDs, or how much current? Are SMD parts an option? How will the project be laid out, custom PCB? Bread board? Budget for each LED circuit? There are so many ways to do this, but without these answers I have no direction to go with it. This is a very common problem. Lots of individual LEDs in need of a simple inexpensive matrix controller to drive and dim them individually. I am thinking a matrix of common anode drivers with time slicing to share the drivers with multiple LEDs. No microcontroller. Shift registers. \$\endgroup\$ – Misunderstood Mar 5 '17 at 15:00

Update: Op has noted his issue is with using a NPN transistor as a high-side controller. It would not be working in a saturated mode and as the load changes it will have odd voltage and current properties. The proper simple solution is to use a PNP transistor suitable for the load. Or switch to a NPN low side setup, noting that the PWM period will be inverted.

I'm looking at the PWM circuit, a simple high-side transistor + 555 timer setup. I'm not seeing why this would change the brightness if you remove a series string from it. Unless you are removing a single led from a series string.


simulate this circuit – Schematic created using CircuitLab

Here, all the leds and resistors are the same. So the voltage between Node1 and Node2 are the same, as is the voltage and current going through all the strings.

If you turn off string 2 (R2, D3, D4 via SW1), the other strings should not see any change in voltage, and thus, current and brightness. If you turn off D6 in string 3, via SW2, then the voltage across D5 goes up, and thus current and brightness (if it doesn't burn out right away). But String 1 and String 2 are still the same.

If you add leds to any of the strings, you will see a brightness change as the voltage is divided among them. You would have to adjust the resistor value to make sure the same amount of current still goes through.

The only problem you may face is if your voltage source is a constant current source instead. Or if your voltage source is very load sensitive. If the source has a high equivalent series resistance, then as your load increases in current, a higher voltage drop is seen, affecting everything. Use a high current capacity and/or quality power supply. Also keep in mind that your transistor needs to be sized for your load. A 2n3906 will only handle 200mA, so if your load is more than that you will see problems.

  • \$\begingroup\$ I'll review what I did here, but starting with four LEDs and then removing three made the remaining one brighter... \$\endgroup\$ – Jay Mar 4 '17 at 23:42
  • \$\begingroup\$ By the way -- I used a 2N2222, with 800mA max current, and I tested with only four yellow LEDs, so this should not be an issue... \$\endgroup\$ – Jay Mar 4 '17 at 23:44
  • \$\begingroup\$ @jay did each have a ballast resistor? Or is it 4 leds in parallel, with a single resistor? \$\endgroup\$ – Passerby Mar 4 '17 at 23:51
  • 1
    \$\begingroup\$ OH WAIT! You mentioned a 2N3906 -- PNP! Now I just noticed in your diagram you put a PNP tansistor there. So, I removed the 2N2222 and put a 2N3906 and the problem seems fixed! (Byt I fail to see why) \$\endgroup\$ – Jay Mar 4 '17 at 23:53
  • 1
    \$\begingroup\$ @Jay the circuit is designed for a PNP transistor, a high-side controller in a common collector topology. If you put a NPN there, it will mess up due to how the transistor works. There is a very technical explanation and has been asked before multiple times. You could switch the circuit around and put the NPN on the low/ground side of the leds instead. In this case the PWM will be inverted from what you already experience (so 80% on would become 20% on). \$\endgroup\$ – Passerby Mar 5 '17 at 0:16

Put all of the LEDs in series. Drive the series string of LEDs with a current source (or sink). All of the LEDs will light.

Put a short across any LED (s) that you want to turn off.

Because the string of LEDs is driven with a constant current, the brightness of the remaining LEDs will remain the same.

  • \$\begingroup\$ This would work but not really allow very good individualized tuning of LED brightness. I guess you could put a bypass potentioemeter in parallel with every LED. \$\endgroup\$ – mkeith Mar 4 '17 at 22:55
  • \$\begingroup\$ 20, 30 LEDs in series would need a really high voltage, that's why I didn't try that... \$\endgroup\$ – Jay Mar 4 '17 at 23:25
  • \$\begingroup\$ I think you are on the right track. But rather than just short them, turn them on or off sequentially at a high frequency creating a PWM signal for each LED. Using registers to store the on-off values. The number of registers would depend on the resolution of the dimming desired. \$\endgroup\$ – Misunderstood Mar 5 '17 at 15:12

The starting point should be a common anode LED matrix and just on and off. Once you have the on off working, add dimming.

And if desired in the future add a micro.

This is the matrix used in signs.

Typically driven with a micro-controller, but could be done with out one.

Rather than a micro-controler build a state machine with a PLD. The PLD would also have registers holding the on off values

State machine logic is a good way to learn how a micro controller works. After all a micro is just a large state machine.

To "program" the on off use two 8 position switches, one for address and one for data.

Common Anode LED matrix

Once the on off is working add another dimension to the on off registers and up the frequency of the on off matrix and tweaking the state machine logic. You will need a set of on off registers for each level of dimming. Registers come cheap in PLCs.

When, if, you want, remove the two sets of switches and replace them with a micro controller.

When you are done, if there is not a chip already out there doing this the state machine PLC could be a salable product.

I do not know how well you will understand this. In the 1980s I was designing data networking ICs for IBM (token ring 802.5) and GE (token bus 802.4). This project as described is how ICs are designed. You build your model with off the shelf logic then migrate it to custom silicon.


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.