Confused about LED driving and pricing - Page 1
Forum section: electronics / beginners

author: c--
author_rank: Newbie
timestamp: December 22, 2024, 01:44:38 am
content: Hi everyone,For a hobby project I am looking into solutions for driving low power LED (5mm, 3mm, 1206 SMD, ...) from a 5V signal coming from CMOS ICs and a 12V power source, using a jelly bean transistor. I'd appreciate some help to clear up soem confusion I have regarding possible implementations.If I wanted to go the MOSFET route, that would be pretty easy. Any N-channel E mode device with a 1kΩ resistor would do the trick. [ Specified attachment is not available ]However, it seems BJTs are even cheaper, but their usage confuse me. From what I can see online for that usage, everyone seems to use them in saturation mode, effectively turning them into closed switches. In that case, you need a resistor on the base to control the BE current and also one to limit the LED current.But I don't get the point in that. If I'm not mistaken, used in linear mode, BJTs are essentially a glorified resistors.So shouldn't it be more economical, both in cost and in space saved on PCB to use the NPN in linear mode in order to limit the current flowing through the LED and getting rid of R2 in tat case?Otherwise I don't see the benefits of using a cheap BJT over a MOSFET in that use case as you would have to give up on the isolation, consume more current and use an extra resistor.

author: Konkedout
author_rank: Frequent Contributor
timestamp: December 22, 2024, 02:01:24 am
content: One resistor versus two is not generally a big deal. But a transistor operating in constant current mode does not act like a resistor, because the collector current will be relatively constant as the collector voltage varies.It may well be that using the bjt in constant current mode will work well enough, but possible issues are transistor heating and also oscillation.

author: golden_labels
author_rank: Super Contributor
timestamp: December 22, 2024, 03:56:09 am
content: Quote from: c-- on December 22, 2024, 01:44:38 amIt’s good to be curious, but also try to not overthink it.Quote from: c-- on December 22, 2024, 01:44:38 amYes, that makes perfect sense, but only under one condition. That you can set current through the BJT. You can’t with just a single BJT and a resistor.Try proposing a circuit that, in your opinion, could do that: you’ll see why not.Quote from: c-- on December 22, 2024, 01:44:38 amAs noted above, the cost is negligible in either case. In practice this isn’t even a problem: usually such a small LED is driven directly without an additional amplifier. The benefits are also not there. The current to drive the BJT is over two orders of magnitude lower than that through LED itself. There is also no isolation to give up.

author: lakis70
author_rank: Contributor
timestamp: December 22, 2024, 04:15:29 am
content: iam not specialist buti think you have to use a PNP transistor as you wired them to work. Calculate the leds resistor for 15mA or how much current it needs and the base resistor for 1/10 the current you calculate.If you want NPN transistor connect the led and its resistor between emitter and ground.They prefer mosfet because they have less on resistance but for low power like this and transistors at saturation are good. Look at some datasheets for transistors saturation Vce for the current you want and choose one with the smaller.

author: Peabody
author_rank: Super Contributor
timestamp: December 22, 2024, 04:31:01 am
content: You didn't ask about this, but is there a reason why you're using a 12V supply? About 80% of the power consumed will be dissipated as heat in the current-limiting resistor. And if it's just a few milliamps of LED current, the CMOS gates can probably drive the LEDs directly (through a resistor of course) without needing a transistor.

author: lakis70
author_rank: Contributor
timestamp: December 22, 2024, 04:44:54 am
content: i saw only the 5V at base. Use the same voltage for both with PNP transistor, because PNP will output 12V from its base and will destroy something in the vicinity.

author: TimFox
author_rank: Super Contributor
timestamp: December 22, 2024, 04:45:06 am
content: Yes, the base resistor determines the base current, but you can't design the BJT to output a known current from merely the base current and beta, since beta for an individual unit of a given part number has a wide variation.The resistor in series with the collector and LED will determine the LED current in a saturated BJT circuit, and the base resistor and current are designed so that with the minimum beta value for that part number the base current is more than required to force that collector current.

author: Konkedout
author_rank: Frequent Contributor
timestamp: December 22, 2024, 05:03:46 am
content: I am not particularly recommending the current source approach. But by switching 5V to the base on an NPN, you can use only one emitter resistor to ground to set current. Connect the collector to the LED cathode, and the LED anode to +12. I would normally use the NPN with a saturated switch, so have one each current limiting resistor in series with the collector and the base. Yup. Two resistors instead of one.

author: amyk
author_rank: Super Contributor
timestamp: December 22, 2024, 05:56:53 am
content: You can connect the LED and its resistor between the emitter and ground, and the signal to the base, which won't require a resistor in that configuration.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 22, 2024, 09:43:57 am
content: As others have pointed out: see the difference beween MIN/TYP/MAX of the Beta value of a transistor datasheet. Calculate the resulting LED current at MIN and MAX, and you will see the problem.

author: c--
author_rank: Newbie
timestamp: December 22, 2024, 03:54:55 pm
content: Quote from: golden_labels on December 22, 2024, 03:56:09 amBut a gate is isolated though? Unlike a base.Quote from: Peabody on December 22, 2024, 04:31:01 amEssentially because I am using an ATX power supply and these units deliver much power on 12V than on 5V and 3.3V. So the idea is to unload the maximum of load on 12V.Actually you don't even need a resistor at all to lit up an LED from a 5V CMOS output. In my current use case I'm using an ATF16V8B as a 7 segment display controller with LEDs connected directly between the outputs of that chip and GND. It works fine I guess but the chip is rather warm and I'm pretty uncomfortable putting 7 LEDs directly on the inputs. That's what? 15 to 20 mA? That's way over the max power supply current value from the datasheet.Quote from: amyk on December 22, 2024, 05:56:53 amBut isn't omitting a resistor to control the base emitter current how you blow up your NPN?

author: PGPG
author_rank: Frequent Contributor
timestamp: December 22, 2024, 05:42:29 pm
content: Quote from: c-- on December 22, 2024, 03:54:55 pmAccording to how I understand English (can be that wrongly) this sentence suggests that with resistor you can blow NPN while without not. I don't understand this sentence.You need not to use resistor in base to control base current. Base current can be self-controlled by negative feedback (emitter resistor in current source configuration).

author: c--
author_rank: Newbie
timestamp: December 22, 2024, 05:54:13 pm
content: Quote from: PGPG on December 22, 2024, 05:42:29 pmMy mistake I corrected.

author: golden_labels
author_rank: Super Contributor
timestamp: December 23, 2024, 12:07:59 am
content: Quote from: c-- on December 22, 2024, 03:54:55 pmFor some meaning of word “isolation”, perhaps. In exactly the same way a capacitor is isolated. Or a reverse-polarized P-N junction, including those in a BJT. But seeing that as beneficial calls for a different meaning of “isolated.” None that I see here.

author: Whales
author_rank: Super Contributor
timestamp: December 23, 2024, 12:30:42 am
content: Yes you can use just a resistor + BJT as a constant current source to drive an LED, but:(1) You will have to tune the resistor to match your individual transistor (as others have mentioned: the beta/hfe varies a lot between each one, unless you spend more for some tightly controlled transistors)(2) The gain/hfe depends on the temperature of the transistor and the load of the LED (which also changes depending on temperature). This may lead to thermal runaway or other unstable behaviours (the transistor self-heats). Also it might not be safe across all common ambient temperatures in your locale.Resistors are nice and stable across temperature and guaranteed identical to within a few percent, which is why we like to use them everywhereCompared to transistors they're almost perfect.

author: Whales
author_rank: Super Contributor
timestamp: December 23, 2024, 12:35:32 am
content: "the addition of resistors will continue until the circuit fucking behaves"-- previous designer