I use a regular diode (1N4007) as a flyback diode for a 250ma 5v fan. My transistor is a 2N 3904 and the PWM generator is an attiny85:


I use this one because originally I was switching the PWM signal at low frequency (<1000hz).

I was able to ear a high pitch noise because the PWM signal was in the audible range. I decided to raise the PWM signal to 30khz. It seems to be working fine, I don't have a good scope to see the signal and most importantly, I can't hear the high pitch switching sound anymore.

But after watching the video from afrotechmods (https://www.youtube.com/watch?v=LXGtE3X2k7Y) he says that we need a Schottky diode when we are switching at >1khz.

Should I de-solder my diode and replace it with a 1N 5817?

Thank you

  • 3
    \$\begingroup\$ Some suppliers of 1N400x diodes have a 30 us reverse recovery time. Check the data sheet of the actual part you purchased. If it does not quote rr time then be suspicious of it and find a faster part. \$\endgroup\$
    – Andy aka
    Feb 7, 2018 at 17:11
  • 2
    \$\begingroup\$ YOu do not need to use a schotky diode, but you DO need to use a fast diode so it will turn off quickly. A 1N4007 is rather too slow for this purpose. \$\endgroup\$
    – Trevor_G
    Feb 7, 2018 at 17:11
  • \$\begingroup\$ @Andyaka So I just calculated that a 30khz signal is 33us appart. So the 1N400x would take the entire time to recover which is indeed not very good. What would be a good recovery time? Just for my curiosity? Is there a rule of thumb? Like no more than 1/10th of the cycle? \$\endgroup\$ Feb 7, 2018 at 17:20
  • 3
    \$\begingroup\$ BTW: 30kHz will drive pets insane.... close to, or over, 50kHz is more normal. \$\endgroup\$
    – Trevor_G
    Feb 7, 2018 at 17:32
  • 1
    \$\begingroup\$ A small 2-wire fan is likely to work well with PWM in the 30–60 Hz range. \$\endgroup\$ Nov 18, 2021 at 17:22

2 Answers 2


Yes, you should really use a diode with fast reverse recovery. A Schottky is a obvious choice at this low voltage. Schottkys have effectively instant reverse recovery for your purpose.

The lower forward voltage of the Schottky will also cause less backwards EMF on the inductance during the off time, making the overall system more efficient.

I see there is some discussion about comparing the PWM period with the reverse recovery time. This is not really relevant since with fast enough PWM the diode is forward-conducting during the whole off interval. The recovery time issue occurs at the start of the on time. Until the diode turns off, it looks like a short across the load. This is bad for the switching transistor, bad for the diode, and wastes a lot of power.

I saw a case once where the switching transistor got blown out because a slow recovery diode was accidentally installed in a motor driving application.

  • \$\begingroup\$ @MikeGleasonjrCouturier Yeah, Olin is a great teacher. I've learned from him a lot :) \$\endgroup\$ Feb 7, 2018 at 20:08
  • 1
    \$\begingroup\$ You have to be careful ....the diode is only applicable to brushed motors. It does nothing for BLDC fans such as the typical computer fan. \$\endgroup\$ Feb 7, 2018 at 23:27
  • \$\begingroup\$ @JackCreasey Yes it is a 2-wire computer fan. Will still add a 1N5819 which I found in my parts bin in case I use my module for a motor. If applying a PWM signal to a 2-wire computer fan breaks it, I will simply trade my module for a resistor. \$\endgroup\$ Feb 8, 2018 at 1:36
  • \$\begingroup\$ @JackCreasey Can we use a low pass filter instead of directly feeding the PWM signal to the fan ? \$\endgroup\$ Feb 11, 2018 at 10:43

If what you are driving is a 5 V (or 12 V) computer fan you ABSOLUTELY do not need a diode to suppress any transients from the motor.

The fans produced today are universally BLDC fans and have internal driving circuitry. They do not have brushes. Here's a quick view of the insides.

If you want good speed control of the fan then typically you would use a four wire fan that accepts a PWM signal, read this.

While there are many different ICs used to drive this type of fan, here's one from TI that explains the basic operation.

Here's a datasheet for a typical small BLDC fan.

Here's a link to Digikey for fans, pick any one you want ...I can't find one that's not a BLDC.

Warning The very basic self-commutated fan can react badly (rotor lock up) if you PWM from the supply (either high side or low side driver). Here is a datasheet for a very small fan that has such a warning .....see #7 on page 6. Speed control for these simple self commutated fans is typically by varying the DC voltage applied which severely limits the range of adjustment.

It is always advisable to use 3 or 4 wire fans if you want to PWM the fan speed, that way you keep the DC voltage stable, and control it via its on board controller.

The YouTube video you watched is not incorrect ....but applies only to brushed DC motors (notice the type of DC motor used). One error in the video however is that the energy from the spike is NOT returned to the power supply ....it is simply dissipated in the motor/diode circuit.

  • \$\begingroup\$ Thanks for your answer. I have "no control" over the fan. Sure I can change it but I can't find a datasheet. It is included in a case and it is a rather generic 5v fan (2 wires): youtu.be/y3Hpd-FV3W4?t=451. In this case: ae01.alicdn.com/kf/HTB1VO7uPFXXXXaZaXXXq6xXFXXX4/…. Thank you for all the details! The reading is interesting! \$\endgroup\$ Feb 8, 2018 at 0:15
  • \$\begingroup\$ It is a simple 5 V computer fan ...almost certainly BLDC with an on board controller ....you don't need a diode. Small fans like this do fall into the category that they don't respond well to PWM. Turning it on and off would be ok ....but I would advise against PWM speed control. These fans are standard sizes ...you can certainly find a 3 or 4 wire version. \$\endgroup\$ Feb 8, 2018 at 0:28
  • \$\begingroup\$ So when they say brushless it is actually BLDC? I will put a proper diode because the thing I made has screw terminals and can be reused for motors also. I will let the fan die of its slow death and make another module with a 3 or 4 wire fan until that day comes... thanks! Will read further on that topic \$\endgroup\$ Feb 8, 2018 at 0:55
  • \$\begingroup\$ I just thought about it, can we use a low pass filter to apply a variable le voltage to the fan instead of PWM \$\endgroup\$ Feb 11, 2018 at 10:23
  • \$\begingroup\$ @MikeGleasonjrCouturier, you could but this is essentially just reducing (with lots of ripple) the supply voltage for the fan. Fans don't respond well to reduction in supply voltage, and certainly PWM/rpm will be quite non-linear. \$\endgroup\$ Feb 11, 2018 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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