Switchable LED's with one PWM brightness control - Page 1
Forum section: electronics / projects

author: SQWave
author_rank: Newbie
timestamp: January 19, 2021, 09:58:22 am
content: Hello everyone!I'm building flight simulator hardware and I'm running into a question. There are multiple ways to skin this cat, and I am curious to see what other people would prefer as a solution.Situation: 10 indicator/warning 'lights', each is illuminated by 2 LED's (Würth 151034YS03000) in parallel. This all runs at 5 volt with each LED drawing 25mA (2x 10 LED's = 500mA in total).It should be possible to individually turn on and off each indicator, but brightness control (PWM) should be the same for all. I do not have enough PWM pins on my uC to have individual PWM control for each indicator. So I prefer to have one PWM pin that does the brightness control for all 10 indicators simultaneously.Possible solutions:- Have one PNP PWM'ing the 5V to all indicators for brightness control, and a NPN for each indicator to turn them on and off individually.- Have a NPN for each indicator to turn them on and off, and one NPN below this to do the PWM'ing for the brightness.I hope this is clear, if not then I apologize, and shall draw the proposed schematics.There may be more solutions to this which could work better. Thank you all in advance!

author: ledtester
author_rank: Super Contributor
timestamp: January 19, 2021, 10:32:34 am
content: There are LED controller chips you can use. They are sometimes called "display drivers" or "segment drivers". You communicate with them via SPI or I2C and they handle all of the PWM for you.One such commonly used by hobbyists:https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdfHowever, there are tons of other possibilities. Maybe have a look at this Mouser catalog page:https://www.mouser.com/Semiconductors/Driver-ICs/LED-Display-Drivers/_/N-9l13tand filter by "Features".Or scan through TI's Product Portfolio:https://www.ti.com/power-management/led-drivers/overview.html

author: ledtester
author_rank: Super Contributor
timestamp: January 19, 2021, 10:42:15 am
content: Ok, another possibility...You have 1 GPIO generating the PWM waveform and 10 other GPIOs assigned to control whether the lights are ON or OFF. Each warning light is controlled by a MOSFET. The signal sent to the gate of the MOSFET is the logical AND of the PWM waveform and the corresponding control signal. You could use a couple of 74HC132 chips, for instance (see attached schematic). This only works because your PWM waveform is common to all of the warning lights.

author: SQWave
author_rank: Newbie
timestamp: January 19, 2021, 10:54:27 am
content: To be sure I've attached an example of my two solutions.The AND idea sounds like an interesting idea, I will investigate this. Thank you!

author: ledtester
author_rank: Super Contributor
timestamp: January 19, 2021, 11:07:15 am
content: An issue with using bipolar transistors is that it takes current to activate a transistor and your PWM GPIO pin may not be able to supply enough current to drive 10 BJTs.

author: SQWave
author_rank: Newbie
timestamp: January 19, 2021, 12:12:02 pm
content: That's certainly true about the current. We're using an ATSAMD20, not that 'powerful'. Using a high Hfe might help, but a FET is probably smarter. I think that the NAND gate solution as you suggested will be suitable. I guess an AND will work better in this case, but potato potato.

author: EEauroro
author_rank: Contributor
timestamp: January 20, 2021, 01:55:50 am
content: I think you meant for the on-off switch to be on individual branches (10x branches in total) sch attached. As previously mentioned, swap BJTs for FETs for lower operating current

author: SQWave
author_rank: Newbie
timestamp: January 20, 2021, 10:02:03 am
content: It's 10x 2 LED's in parallel, but yes I guess we mean the same thingI've gone for the logic gate option with a Nexperia 74AHC2G08DP and Infineon BSS806NH6327XTSA1 Mosfets.