Problem with BJT attached to PWM pin, no problem with led

I found that IRemote don´t work as expected if I attach a bjt to other PWM pin (IRremote attached to pin11). I know about the relation between IRemote and internal timers but I am sure that isn´t the problem because the IRremote problem is produced by a NPN attached to pin 6 in PWM mode, the transistor is BC547 (max 100mA) and it is used to power (with GND) a 5v@200mA fan, and also was added a transients protection diode between GND (from the bjt output) and +5V .
If change the bjt, resistor, fan and the diode, and if I connect a led with the mandatory resistor, all work as expected. All is powered from the laptop USB.

If I use the fan configuration with PWM, sometimes IR receive remote control data, and sometimes do not receive.

What is happening?

Thanks in advance

What if you only remove the fan?

A 200mA fan is very much load for a 100mA transistor.

@DrDiettrich Yes if I remove only the fan also is working ok. I am agree, the fan consumes the double of current that the transistor can achieve (I have this spare components and I tryed the pwm with this, despiste the classic led dimming. But, why this transistor current comsumption can influence MCUs other PWM pins? I dont understand, It is a 1k resistor in the transistor base to limit mcu I/O current

Get a BJT that can switch 200mA at least. Or a logic level MOSFET...

Try powering the fan separately, e.g. from a second USB connector, bypassing the USB 5V routing over the board..

When using a BJT in a switching application its good to drive the base with approx 1/10 of the load current (collector current).

If you have a 5V mcu the 1k limits the base current to approx (4.5 +0.7)/1000 = 3.8 ma not nearly enough to switch a 200 ma load.

BTW the 4.5 is a typical output of an mcu output pin, it does not go to 5V.

The suggestion of a MosFet is the best choice. The input Gate of a mosfet draws almost 0 current from the mcu.

1 Like

(4.5 +0.7)/1000 = 3.8 ma

4.5 = approx output voltage of an Arduino output pin ( and that is being generous)
0.7 = voltage drop across the Base Emitter junction of the BJT
1000 = your 1k base resistor

The resulting current is:
4.5-0.7 = 3.8 volts across the 1k
I = e/r = 3.8 / 1000 = 0.0038 amps = 3.8 ma.

Even if you said "...well I could get by with 1/20 of the load current for the base current.."

200ma/20= 10 ma into the base. You might be able to get by with a 500 ohm base resistor and a BJT with more capability. I would use a BJT capable of at least 500 ma.