Enable an RGB LED with a single transistor - Page 1
Forum section: electronics / projects

author: laxamar
author_rank: Contributor
timestamp: August 22, 2022, 06:14:47 pm
content: Hi,I tried using a single transistor to enable/disable an RGB LED (SMD) where the RGB signals are coming from a stable source. .. It did not work. Can anybody tell me what I did wrong and how to do this?---EDITThe values are coming from a IC chip and I have resistors that manage the value. The conclusion was I was not using the right voltage and I now see that the resistor values for RGB_ENABLE is waaaaay wrong:

author: Benta
author_rank: Super Contributor
timestamp: August 22, 2022, 06:23:04 pm
content: Quote from: laxamar on August 22, 2022, 06:14:47 pmWhat does this sentence mean?

author: laxamar
author_rank: Contributor
timestamp: August 22, 2022, 06:27:43 pm
content: Means they are of proper voltage and proper resistance applied beforehand. The signals are used ELSEWHERE on the circuit and work well.I swear I speak English

author: pcprogrammer
author_rank: Super Contributor
timestamp: August 22, 2022, 06:28:05 pm
content: You are not showing to what the emitter of the transistor is connected, nor how the base is controlled.With the emitter connected to ground you need a resistor in the base control line to control the current. It should work then, but only if the RGB signals also have current limiting and it all depends on the supply voltage of course. It has to be high enough to overcome the voltage drop the transistor has between emitter and collector and what the needed voltages are for the RGB leds.A bit strange are the two other leds D16 and D17 in what they suppose to do.

author: mariush
author_rank: Super Contributor
timestamp: August 22, 2022, 06:29:27 pm
content: Are you limiting the current going into the base of the resistor, or you just push voltage into it and blow it?Current going into the base will enable the transistor, which creates a connection between collector and emitter.When you no longer push current into the base, the transistor may remain active because it's like having a capacitor, there can be some charge in the transistor keeping it active.Limit the current going into the base with a resistor - something like 1kohm , 4.7kohm , even 10kohm depending on transistor - and you could have a resistor several times bigger between base and ground, to discharge the transistor.edit: yeah, there's gonna be a voltage drop across collector and emitter, something like 0.6v , maybe less.Here's a video about transistors :

author: Terry Bites
author_rank: Super Contributor
timestamp: August 22, 2022, 06:35:38 pm
content: More detail needed. Show more of your schematic and your intention.Where do these input lines come from exactly?Does the emitter have a path to ground?Is the transistor dead or the wong way round?

author: laxamar
author_rank: Contributor
timestamp: August 22, 2022, 06:38:50 pm
content: Quote from: pcprogrammer on August 22, 2022, 06:28:05 pmEach of the RGB LEDs (RGB_RED, RGB_GREEN, RGB_BLUE) are supposed to go to ground. They can theoretically be combined. I am trying to use the transistor as switch to connect/disconnect the ground. Base is a switch signal that connects/disconnects the ground. It's used elsewhere and works as advertised for the other LEDs. It has a proper resistor.Quote from: pcprogrammer on August 22, 2022, 06:28:05 pmQuote from: pcprogrammer on August 22, 2022, 06:28:05 pmThose are other LEDs that I need, unrelated to the RGB. But since I did a screenshot, you can see them. We can ignore. They work great!

author: laxamar
author_rank: Contributor
timestamp: August 22, 2022, 06:44:35 pm
content: Quote from: mariush on August 22, 2022, 06:29:27 pmYes, there are at least another 16 signals/LEDs controlled with the same resistor/transistor logic that work perfectly. I am sure about the input voltages/resistors used. I got the NPN transistor working correctly there. In ***THIS*** case, I am trying to use ONE transistor to enable/disable essentially 3 LEDs (that's what an RGB LED is). I will try to use a breadboard to see it this is a sound design, but since I'm using SMD, the parts are not the same.

author: laxamar
author_rank: Contributor
timestamp: August 22, 2022, 06:51:15 pm
content: Quote from: Terry Bites on August 22, 2022, 06:35:38 pmI really need to know if I can enable/disable an RGB LED (which is essentially 3 LEDs) with one control signal. The rest of the circuit is irrelevant for this discussion.Quote from: Terry Bites on August 22, 2022, 06:35:38 pmThey are the output of a IC and go through a resistor before being fed to the RGB LED. The other LEDs on the circuit are single color and work great. I want this one siganl (RGB_ENABLE) to turn on/off the RGB.Quote from: Terry Bites on August 22, 2022, 06:35:38 pmYes, the emitter is DIRECTLY connected to ground. I am using it as a switch to connect all 3 LEDs to ground. The PCB layout actually shows this very clearly.Quote from: Terry Bites on August 22, 2022, 06:35:38 pmI send the design for manufacturing and got the circuit back. I have 5 samples and none work. Not dead. Wrong way around with transistor/LED is one of my questions. I can't see it.

author: Kalvin
author_rank: Super Contributor
timestamp: August 22, 2022, 06:58:25 pm
content: Have you checked the Vf of the LEDs you are using with a multimeter? If you are running the RGB LEDs from a 3.3V supply, the Vsat of the transistor Q8 + Vf of the RGB LED D10 may be more than the power supply voltage VDD. If so, the the RGB LEDs won't turn on.It is stated in the data sheet of the RGB LED that typical Vf is 3.3V for Blue, 2.2V for Red and 3.2V for Green. Maximum Vf is stated to be 4.0V, 2.8V and 4.0V, respectively. So, if you are running the RGB LEDs from 3.3V supply, the voltage may not be high enough to turn on the LEDs.

author: laxamar
author_rank: Contributor
timestamp: August 22, 2022, 07:04:10 pm
content: 2 Things/Questions:Quote from: mariush on August 22, 2022, 06:29:27 pmWhat would be the impact if I used a resistor that's too low on the base. I realize I used the same resistor as my other LEDs, but they are NOT going to a transistor. Base current too high would make the transistor ineffective?Quote from: mariush on August 22, 2022, 06:29:27 pmNot sure I follow. You mean an EXTRA very large resistor between base and ground?? I don't use it elsewhere, not sure I've seen this

author: laxamar
author_rank: Contributor
timestamp: August 22, 2022, 07:06:55 pm
content: Quote from: Kalvin on August 22, 2022, 06:58:25 pmI think that would explain is all!It is used with a 3.3V supply. Ugh. I missed that.Would you know a better part that would work with a 3.3V supply?-- EDIT --Shouldn't the RED LED work anyways?

author: Kalvin
author_rank: Super Contributor
timestamp: August 22, 2022, 07:16:59 pm
content: Quote from: laxamar on August 22, 2022, 07:06:55 pmQuoteSorry, I have no suggestions.QuoteMaybe. You need to measure the voltage across the Red LED with a multimeter when you are driving the transistor and the Red LED.

author: Benta
author_rank: Super Contributor
timestamp: August 22, 2022, 07:18:55 pm
content: Quote from: laxamar on August 22, 2022, 06:27:43 pmWell, why didn't you put hat in your OP? "Stable source" can be anything. And apparently the voltage is NOT "proper".I'm sure your English is perfect, but your terminology is not.

author: mariush
author_rank: Super Contributor
timestamp: August 22, 2022, 07:24:44 pm
content: Quote from: laxamar on August 22, 2022, 07:04:10 pmtoo low of a resistor value means you're pushing a lot of current into the base, and you risk blowing up the transistor.you want the resistance low enough to fully turn on the transistor, not to have the transistor in that in-between state... but also only as low as needed.For example, datasheet of BC850 :https://assets.nexperia.com/documents/data-sheet/BC849_BC850.pdfit says peak base base current : 200 mA and max collector current 100mA and on next page it saysDC current gain IC = 2 mA; VCE = 5 V;see Figs 2 and 3BC849B; BC850B 200 290 450 (min, typ, max)BC849C; BC850C 420 520 800So assuming a less than typical hFe of 200 for BC850B or 400 for BC850 you can still achieve that 100mA of collector current with less than 1mA on the base 1mA x 200 = 200mA which is twice the maximum for BC850B, or 400mA which is 4x the maximum for BC850CNote they only test with 5v, so if your leds are 3.3v, the hFe may be different with such low voltage.The current in the base will be Ib = (Input voltage - ~ 0.7v ) / Resistor ... so let's see what resistor you'd need to push 250mA in the base and blow it up if you have 3.3v as voltageRb = ( 3.3v - 0.7 ) / 0.25 = 10 ohmso less than 10 ohm resistance on base could in theory damage the transistor, unless my math is wrong ... and provided the microcontroller or whatever can source that much current.A lot of microcontrollers can only do 15-25mA per i/o pin, some shift registers can only do 50mA or something like that.But considering you only need around 1mA or less current in the base, your resistor could be (3.3v - 0.7) / 0.001 = 2600 ohm ... so you could use 1500 ohm for a bit more than 1mA, or 3.3k for a bit less than 1mA, with the specified hFe values the transistor would be fully open either way.QuoteSee the answers athttps://electronics.stackexchange.com/questions/215110/what-is-the-objective-of-a-base-emitter-resistor

author: laxamar
author_rank: Contributor
timestamp: August 22, 2022, 07:46:17 pm
content: With all of that said and done (3.3V might not be enough, the resistor might be too low) my question remains - so I don't build another dud:Is this LOGIC sound?Can I use a single transistor to act as an on/off switch for 3 LEDs by being a gatekeeper of the ground signal?If the logic is sound, I can find the proper components. If there are better designs, I'm all ears (technically eyes, this is a text blog)

author: laxamar
author_rank: Contributor
timestamp: August 22, 2022, 07:52:37 pm
content: Quote from: Kalvin on August 22, 2022, 07:16:59 pmCan't. It's one single RGB SMD soldered on top the connectors in a PCB. No access to individual signals. I would need to redo the circuit with test points. Next version, once I know what components to use.

author: Benta
author_rank: Super Contributor
timestamp: August 22, 2022, 07:54:54 pm
content: Provided the absolute upper trace to which the emitter is connected is ground, and the base current is limited, then yes, the circuit should work.

author: mariush
author_rank: Super Contributor
timestamp: August 22, 2022, 07:57:22 pm
content: A n-channel mosfet may make more sense ... pick something with low Rds(on) value to do low side switching and you're good to go.for example something like this :https://www.digikey.com/en/products/detail/alpha-omega-semiconductor-inc/AO3422/1855787you would still need a resistor between gate and source (ground) but can be some generic easy value like 10kohmSee videos below :

author: laxamar
author_rank: Contributor
timestamp: August 23, 2022, 04:40:25 pm
content: My understanding was that MOSFET is for high power usage. And I'm using SMD, not sure which part or what value.I now see the resistor values going to the R-G-B and RGB_ENABLE are wrong values.The RGB_ENABLE resistor should be 27K and not 68 ....These color represent a BCD value, and I should make the Blue LED the most significant digit ..==Why won't the RED LED part work? Have I blown the it??

author: laxamar
author_rank: Contributor
timestamp: August 23, 2022, 05:05:09 pm
content: My errorFor those who would like to learn: I used to have a simple Red LED there, but decided to color code my result with a RGB from a BCD value. That's why I was sure that the signals were correct. I didNOTchange the resistor from a value of 68 going to the LED to 27k going to the transistor base, which I use everywhere else on the circuits (duh). These signals communicate across multiple different boards .. so I missed it during the zillion times I double checked.In hindsight, on the BCD coding, I should put Blue as the most significant digit since values larger then 4 are the most rare ...Live and learn and waste time/money.I am open to hear what proper values for the resistors I should use for this circuit. My breadboard is obviously using different parts and I'm not sure if it translates.THANKS EVERYBODY FOR YOUR EXPERT HELPMy apologies toQuote from: Terry Bites on August 22, 2022, 06:35:38 pmTerry Bites for not listening to him and showing more of the circuit.

author: Benta
author_rank: Super Contributor
timestamp: August 23, 2022, 06:24:33 pm
content: Quote from: mariush on August 22, 2022, 07:57:22 pmNo reason to, except throw money out the window. BJTs have saturation voltages of 50...100 mV at LED current levels.

author: laxamar
author_rank: Contributor
timestamp: August 24, 2022, 04:59:55 am
content: Bread board done.Non SMD RGB works great with 3.3V source and 27k resistance to BJT transistor and 68-680 resistors to R-G-B.I just had wrong resistors.=== Question about RGB ===Green light overwhelms the other colors when combined, So annoying. I could put a bigger resistor.Any suggestions?