Electronic – Controlling MOSFET and LED from same PWM output

mosfetpwm

I am controlling a MOSFET and LED from the same PWM output from a PIC. The MOSFET is driving a fan, while the LED is used as rough visual indicator of the speed. The circuit is below and it seems to work and I have not experienced any problems yet. But, I am unsure if this is recommended.

enter image description here

Edit1:

Looking at the suggestions, I made the following changes.

  • added diode to fan
  • replaced R21 and with R22 and LED1

enter image description here

Best Answer

The MOSFET takes no significant current from the output pin and the 2k2 in series with the LED will not pull the voltage down. Q2 should be a digital type (turn on 5V). The 10K could be lowered to discharge the gate-source charge more quickly and I would add a (snubber) diode across the fan just in case of spikes when it is turned off.

It works!