Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I've built the circuit in the schematic below to control my TV, the D1 and D2 LEDs are the two mini LEDs from this IR Extender:

I've cut it below the female headphone jack and I'm using my Raspberry Pi using LIRC to send commands.


simulate this circuit – Schematic created using CircuitLab

Everything works great except that I'm not sure about the two 10k Ohm resistors.

For the BC547b transistor I saw the max mA for the base was 100mA so I thought that for the 3.3V an R1 of 70Ohms would be about 47mA and would be safe. However when playing around with it more I found that even with the 10k Ohms resistor (0.33mA) it still worked.

Would this 10k resistor be safe to use and not cause any issues that for example the current is too low, or should I stick with the 70 Ohm resistor? Better would probably to actually calculate the best R1 value?

With the LEDs (R2) I just tried a number of resistors and the 10k Ohm still worked and isn't too bright as with for example a 2.7k Ohms resistor. Could the 10k resistor influence the lifetime of the LEDs?

share|improve this question
I'm looking at this with a mobile device or I would provide a more elaborate answer, but I just wanted to point out that with an NPN transistor in saturation has the equivalent of a diode forward voltage drop (~700mV) between the emitter and base when the emitter is grounded. That being said, the base current is actually '(3.3-0.7)/10000 = 0.26mA'. Also, driving LEDs at higher power certainly reduces the device's life. –  sherrellbc Jul 5 at 19:24
That schematic can never work. Your LEDs are backwards. What is the forward voltage \$V_f\$ of the LEDs? –  Majenko Jul 5 at 22:32
Yes, Wouter van Ooijen also mentioned this below. In the actual circuit I did put the LEDs in correctly as I had a working circuit already! –  Piet Paulus Jul 6 at 10:45
Why not edit your schematic to show the circuit you actually built? –  The Photon Jul 6 at 15:07

2 Answers 2

up vote 3 down vote accepted

Steps to design:

  1. The collector current of the transistor is given by $$I_C=\frac{5V-V_{D1}-V_{D2}-V_{CEsat}}{R_2}$$ Where \$V_{D1}\$ and \$V_{D2}\$ are the forward drop of LEDs. \$V_{CEsat}\$ is around 0.2V for BC547.
    So first fix the value for \$I_C\$ by selecting a value for \$R_2\$. The value of \$I_C\$ must be less than the maximum collector current of the transistor (100mA).

  2. Find the base current of the transistor as: $$I_B=\frac{I_C}{h_{fe}}$$ This is the minimum base current required to place transistor in saturation. From the circuit, $$I_B=\frac{3.3V-V_{BE}}{R_1}$$ Where, \$V_{BE}\$ is 0.7V.
    So design \$R_1\$ such that \$I_B\$ is sufficient to make the transistor put into saturation.

High current flowing through the LEDs can reduce the life time. So choose \$R_2\$ wisely. The datasheets of LEDs will give the current ratings.

share|improve this answer
Thanks for the info! Unfortunately I don't have the datasheets for both the LEDs (they look smaller than the separate IR LEDs I bought in the store) and the transistor (it just says BC547b on the transistor but no manufacturer). –  Piet Paulus Jul 5 at 19:54
@PietPaulus you can use datasheet from any manufacturer for BC547. I can not help with the LEDs. Typically a current of 5-10mA is fine for LEDs. –  nidhin Jul 5 at 20:03

Your circuit is not good.

  • The LED are in the wrong direction
  • 10k far too high to get a reasonable LED current
  • 10k is also too high to put the transistor in saturation

Put the LEDs in the right direction. Assuming they are standard LEDs, assume 1V per LED @ 10mA, hence R2 must be ( 5 - 2 ) / 0.01 => 300 ohm, use 330 Ohm.

Use ~ 1k for R1.

share|improve this answer
Ahh yes, in the real circuit I've connected the LEDs the correct way though! What I don't understand is that the circuit works perfectly. The TV reacts great to the commands I give it using the Raspberry Pi. Is this just a bit of luck? –  Piet Paulus Jul 5 at 19:50
If R1 is realy 10k the range will be very limited compared to 330 Ohm. –  Wouter van Ooijen Jul 5 at 23:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.