0

I am trying to calculate the resistor value I need to achieve 35mA in my circuit. Vcc is 5V. Can someone explain the values I need to find in the datasheet as well as formula to use to find the correct Resistor value? I would like to learn this for future projects using transistors.

Transistor used is S8550
UV LED used is here

schematic

simulate this circuit – Schematic created using CircuitLab

presish
  • 39
  • 1
  • 8
  • 1
    What are the characteristics of your LED? Specifically, what is the voltage across the LED when it is passing a current of 35mA? How precisely do you want to control the current...is 35+/-5mA OK? – Elliot Alderson Feb 08 '20 at 01:27
  • Ideally I would like to control it as close to 35mA as possible (LED is rated for 40mA max but I have settled on 35mA). I haven't been able to achieve 35mA in this circuit but currently have a 20 Ohm resistor for R2 and there is 3.8V across the LED but my current measured from LED (-) to Emitter is 13mA. I placed a 7 Ohm resistor for R2 hoping triple my current but now it only reads 19mA. – presish Feb 08 '20 at 01:32
  • Are you sure, your GPIO can sink any current when logic high? Even if limited by gate resistor, LED and so, it might destroy your logic circuit if it isn't protected by TVS circuitry. – Ariser Feb 13 '20 at 09:33
  • @Ariser I am using the Raspberry Pi 3B+ GPIO. How do I find out if it can sink a current? – presish Feb 13 '20 at 19:36
  • Even if it can sink a current in logic high, you should not do this, because it abuses a protection device in normal conditions. It will lead to unpredictable behaviour. – Ariser Feb 13 '20 at 20:00
  • Why do you use a PNP transistor here? This circuit normally uses an NPN transistor. It will work either way, but using a PNP makes it an emitter follower instead of a simple switch. – user253751 Feb 14 '20 at 11:24
  • 2
    Any reason you favour a BJT over a MOSFET? – Colin Feb 14 '20 at 11:31
  • What is the purpose of R2???? – Ariser Feb 19 '20 at 07:15

3 Answers3

2

You should not use an emitter follower to drive that LED, the voltage drop is too high in relation to the supply voltage.

If your GPIO is 5V you can still use the PNP 8550 transistor as so:

schematic

simulate this circuit – Schematic created using CircuitLab

The value of R2 shown is probably a bit high, and depends on the LED Vf at 35mA.

Incidentally, your measured voltage seems a bit high to me, you may be putting too much current through the LED for continuous operation.

If your GPIO is 3.3V, you should use an NPN transistor such as a 8050 and flip everything around and reduce R1 to about 860 ohms.

Note that LOW = ON in the PNP schematic shown, with an NPN transistor HIGH = ON.

Spehro Pefhany
  • 376,485
  • 21
  • 320
  • 842
  • my GPIO is 3.3V, even though the voltage drop is high is it possible to still achieve 35mA? – presish Feb 08 '20 at 01:48
  • 2
    See my comments above. Suggest you use an NPN transistor (eg. S8050). You may be able to get 35mA with the emitter follower, but it won't be very stable. For example, as the LED and transistor heat it will draw more and more current and might fail. – Spehro Pefhany Feb 08 '20 at 01:52
  • When you say might fail, does that mean the circuit will get fried? Or the current will fluctuate? If so, what is the fluctuation range? The LED will not be on for more than a few seconds at a time – presish Feb 08 '20 at 01:55
  • 1
    It may draw a lot more than 35mA which could lead to early LED failure. Or you may get away with 0\$\Omega\$, hard to predict. – Spehro Pefhany Feb 08 '20 at 01:56
  • I will have to go with the NPN decision to avoid excess heat, to complete the answer... how do you calculate the R2 needed to achieve the current wanted? – presish Feb 08 '20 at 02:01
  • 2
    R2 = (5V - Vce(sat) - Vf) / 35mA. Vce(sat) is from the transistor datasheet. Vf is the voltage across the LED at 35mA (3.8V in your case). Vce(sat) might be something like 0.2V or 0.3V. So 27 Ohms or 30 Ohms might work. – user57037 Feb 08 '20 at 02:08
  • 1
    OK, I have to correct myself. Looking at the datasheet for the 8050, Vce(sat) is probably much lower at Ic=35mA. Maybe only 30 or 40 mV. So you can almost ignore Vce(sat) in the calculation. So 30 or 33 Ohms might work well. – user57037 Feb 08 '20 at 02:13
  • What @mkeith said, including the addendum. The 8050 is a chunky little transistor for its cost in applications where 25V Vceo is good enough. – Spehro Pefhany Feb 08 '20 at 02:17
  • I used a 20Ohm resistor (closest one to 30Ohm) and my current through the LED is 13mA. The voltage across the LED is 4V. I used the circuit build on the right now with the S8050 to test. It is the same current I was getting with the S8550. – presish Feb 10 '20 at 21:21
  • How are you measuring the current? Measure the voltage across the 20 ohm resistor and calculate it, don't insert an ammeter. Make sure the base resistor is < 1K. You said 3.8V at 13mA and now it is 4V? Sounds like you're grossly overdriving a small LED. You will likely destroy the LED, but anyway to get the current you are asking for you need more voltage. Sometimes with very short fast pulses you can drive an LED far beyond the ratings, but if you let it cook it will die quickly. – Spehro Pefhany Feb 10 '20 at 22:15
  • @SpehroPefhany the LED is a UV LED rated for max current of 40mA. I have seen it achieve 30+mA when I bypass the transistor but using the transistor I have not seen it exceed 13mA. Your suggestion is decrease the base resistor? What does this improve? My max input voltage is 5V. Are there any further adjustments I can make without changing input voltage as that is fixed? – presish Feb 13 '20 at 20:19
  • @presish Ok, UV wavelength would explain the relatively high Vf. Can you link the LED datasheet or at least a measurement of (preferably a few units) Vf at your desired operating current? – Spehro Pefhany Feb 13 '20 at 20:22
  • UV datasheet is now linked. – presish Feb 13 '20 at 20:32
  • You need to tell us the part number since that datasheet covers 5 quite different UV LEDs. – Spehro Pefhany Feb 13 '20 at 23:43
0

I think you will need a higher voltage to supply the LED. Depending on the LED you are using, the forward voltage is between 4 to 6 volts at 20ma. This device has a much higher forward voltage drop than a standard LED. Look on the spec sheet for the Forward Voltage Vf for the exact LED you are using. Note on the second page that the Forward Voltage vs Forward Current varies greatly depending on the LED you are using. Also note that the maximum Forward Current is 40ma. Operating at 35ma is close to the maximum allowable. I agree with Roland that regulating the current would be better to protect the LED.

newbee101
  • 11
  • 1
-1

The function of R2 is to regulate the led current, which is very important. However, with 3.8V over the led and min.0.7 V over Q1 only leaves 0.5 V over R2. Not enough to really regulate the led current. When the led heats up, the led voltage will get a little lower, the voltage over R2 the same amount higher and the current quite a lot higher. Thermal runaway.

You need more than 5 V, or a current source with better feedback.

A fet instead of a normal transistor will give you 0.5V more voltage over R2, e.g. double voltage, and might also be cheaper.

Why not first forget about the transister (bipolar or fet) and just try to hook up the led with a resistor to 5 VDC and see if you can get a stable current? It may turn out that you will need a higher supply voltage, e.g. 7 or 10 volt. Fortunately, you can get very cheap dc/dc converters for voltages like 5 to 10 V, for under or around 10 buck (EUR/$). With a higher voltage, you can work out more interesting schematics that actually regulate your current more easily.

Roland
  • 736
  • 5
  • 13
  • 1
    why is a fet better? there is less voltage drop? would the circuit be more like the left or right? Load to Vcc or Load to Gnd? – presish Feb 14 '20 at 00:03
  • voltage drop of a fet can be very low, e.g. your 35 milliampere times 20 milliohm source-drain resistance. Also, a fet can be very cheap. Circuit is a different question, but not that difficult. Others already noted that your transistor diagram is not optimal. I just focus on R2. – Roland Feb 14 '20 at 11:13