N-power Mosfet pc fan control.

I am trying to use this low-side switching schematic to control the fan speed of a 12V 0.4A pc fan. So far it works ok.. I added a 46u medium blue capacitor and a small brown one which says 224 on it across the power sockets for the fan which help reduce noise to some extent, but it still buzzes a bit at lower duty cycles. Do I need a larger or smaller capacitor for this (low frequency?) noise?

The problem I am having at the moment is actually with the diodes. I don't understand why they are wired in parallel in the schematic. Well I wired them up anyway, and as I expected it simply bypasses the mosfet and turns the fan on regardless. It would seem to make more sense with the diode between the negative motor terminal and the drain pin in series. What am I missing here?

You sure you're using a n channel mosfet? The pull down resistor is important to keep the damn thing off.

Which is the frequency of pwm are you using? Which PWM pin? Arduino default is low pwm frequency.
To make noise dissapear it's recommended to use above 20 khz freq on pwm.

And the diode is ok where it is now.

It works as expected WITHOUT the diodes, but I don't want to damage my arduino Pro Micro by not having them correctly in place. NO the diode is not fine where it is, it bridges the source and drain pin effectively cutting out the mosfet and making it useless. So the schematic is not correct unless I'm missing something.

Yes it is a N-power mosfet, and I am using a 10k resistor between pin 10 and gate, connected to ground. The negative source from the 12v adaptor used to power the fan is also connected to pro micro's gnd before anyone asks.

Duty cycle starts at 255, decreasing by 15 every second until it reaches zero. My code is simply:

int cycle=255;

void setup() {
  
  analogWrite(10,cycle);


}

void loop() {
  if (cycle>=15) cycle-=15;
  analogWrite(10, cycle);
  delay(1000);

  
}

Someone please explain to me how adding that diode in parallel across the mosfet is not the same as connecting a jumper wire from source to drain, effectively creating an alternative path between the negative source and negative motor terminal, which is supposed to be bridged only by the mosfet?

I am using a small 180 point breadboard by the way if that matters somehow.

How can the diode D1 bridge the source and drain pin if it is backward? Check your schematic diode 1 is inverted Id current wont go through it. Thats why I told you. And you have not answeed about frequency on pwm about noise solution.

Is D1 a zener btw? As pegwatcher said, if it is a low volt zener It will let current pass. Then you should remove it if thats the case.

Schematic symbol of that diode says it's a zener. Either you have that diode connected backwards from how it's shown on the schematic or it is less than a 12 volt zener

Do not remove the diode across the motor. It is most important. Be sure to orient is with the cathode (horizontal band) towards Vdd.

I think that diode is meant to be a schottky diode. The schotty and zener symbols are a bit similar. The symbol in the diagram in the OP is not strictly a zenner or schottky symbol but is probably meant to be schottky (without the little ‘hooks’) as the zenner will let the current past.

Zener_diode_symbol-2.svg.png

Schottky_diode_symbol.svg.png

The filter should go ahead of the FET. Give us the frequency of the PWM and I will give you the values of a simple 1st order low pass filter. It is just a capacitor and a resistor.

@lemming - it sure looks like a zener to me. Whatever... I don't think it's needed. Every FET I'm familiar with already has a reverse biased diode between drain and source internal to the device.

The diodes I have are 1N4007, with "MIC" printed underneath not sure if that helps determining whether its a zener or not. I guess I didn't understand the diode symbol. It looks like the triangle bit points to the direction the current is supposed to be allowed through, and the line in front of it seemed to indicate the current would be blocked from that direction. I also think I had the current convention mixed up. Its positive to negative not negative to positive correct? So the diode is suppose to redirect the back current from negative to source, so that it ends up back at drain? (if I was wrong about current convention, but right about diode symbol). Or vica versa if I was right about current convention but wrong about diode symbol?

Here is a picture and link to data sheet for the pro micro:

I am unsure of the frequency of the PWM pins (I assume your not taking about duty cycle frequency or something). I am using pin 10 at the moment but just tell me which pin is the best to use on this particular board. Im not even sure if the pro micro has high frequency PWM pins (if thats what you mean).

The diode across the MOSFET is the MOSFET's internal "body diode". The diode across the fan is required to prevent damage to the MOSFET. Think of the fan as an inductor. Think of what happens when there is a current flowing through the inductor and then you remove it instantly. The inductor "tries to maintain the current flow". If there is no current path, the voltage increases until it breaks the MOSFET and current flows. The diode provides a "discharge path" for the inductor. The resistor in series with the diode isn't necessary here.

So can I just plug the diode directly into the fan plug, with the horizontal band side in the + terminal and the other in the -?

It looks like the triangle bit points to the direction the current is supposed to be allowed through, and the line in front of it seemed to indicate the current would be blocked from that direction. I also think I had the current convention mixed up. Its positive to negative not negative to positive correct?

So can I just plug the diode directly into the fan plug, with the horizontal band side in the + terminal and the other in the -?

You are correct. Conventional current flow is considered to be from positive to negative and you are correct with your orientation of the diode. But, in electronics, we don't use current flow, we think in terms of electron flow, which is from negative to positive and this can be confusing to some. In the future, if you are serious about electronics, think in terms of electron flow.

As far as your diodes are concerned, the 1N4007 is not a zener, it is a 1000 volt 1 amp rectifier. It will work ok across the fan, but eliminate the resistor that is in series with it. That diode is not needed across the FET, eliminate it too.

I need to ask; what is that AND gate doing there? Are you using the AND function for some purpose? If not, eliminate that too, just connect the FET gate in series with a 10K or greater resistor to the output of the ProMicro. It is late here. Tomorrow I will give you values for the low pass filter to place between the ProMicro and the FET which should eliminate or greatly reduce your noise, unless someone else does it before I get to it.

motors needs torque to spin, and torque comes from the magnetic field applied to the coil.
if you give it too less current, it won’t be able to create a enough magnetic field, thus not enough torque to get it spin.

like it moves a little bit, but not enough to reach the next angle, and when the magnet field change pole, it just got “suck back” to its old position.
that’s why you see the fan “shaking” instead of spinning.

if the spec of the fan says “800 ~ 2550 rpm”, you may be able to analogWrite(FAN, 80) to get 800rpm, or even analogWrite(FAN, 60) to get 600rpm, but definitely not analogWrite(FAN, 20) to get 200rpm, because it just simply can’t do it.

if you put a capacitor in parallel with the fan, its like extending the duty cycle of the pwm signal.
looks like you’re not using a resistor in series with the cap, it will sink as many current as it can, thus creating a “current spike” during T(on), and source the energy to the fan during T(off).

see the attachment, red line is the pwm signal, and blue like is the voltage across the motor coil.
and, if you choose a too large capacitor, the voltage across the motor would be like the green line (the cap didn’t get enough time to fully discharge).

syphex, pin 10 on your pro micro has a pwm frequency of 490 Hz. I need to know what FET you are using and I will give you the resistor and capacitor values to make a low pass filter to knock down or eliminate that buzz.

[edit] I forgot that the pro micro uses the 32U4 chip, so I don't yet know the frequency of PWM on pin 10. Will see if I can find it.

pegwatcher:
You are correct. Conventional current flow is considered to be from positive to negative and you are correct with your orientation of the diode. But, in electronics, we don't use current flow, we think in terms of electron flow, which is from negative to positive and this can be confusing to some. In the future, if you are serious about electronics, think in terms of electron flow.

No.

Mathematically, the flow of positive charges one way and the flow of negative charges the other way is exactly the same. Electronics most definitely uses conventional current flow, best illustrated by the diode symbol. It makes no sense if you follow electron flow, and perfect sense for conventional current flow.

Tomorrow I will give you values for the low pass filter to place between the ProMicro and the FET which should eliminate or greatly reduce your noise, unless someone else does it before I get to it.

Do not do this.

The entire point of a PWM signal is to turn the FET all the way on and all the way off really fast. Low pass filtering the PWM output turns it into a relatively flat analog signal which will partially turn the MOSFET on, causing it to dissipate power and heat up. You do not want this to happen. You want the PWM signal to remain as square as possible.

pegwatcher:
syphex, pin 10 on your pro micro has a pwm frequency of 490 Hz. I need to know what FET you are using and I will give you the resistor and capacitor values to make a low pass filter to knock down or eliminate that buzz.

[edit] I forgot that the pro micro uses the 32U4 chip, so I don't yet know the frequency of PWM on pin 10. Will see if I can find it.

These are what I have.

Mathematically, the flow of positive charges one way and the flow of negative charges the other way is exactly the same. Electronics most definitely uses conventional current flow, best illustrated by the diode symbol. It makes no sense if you follow electron flow, and perfect sense for conventional current flow.

Just because the symbols are shown backwards doesn't make current flow logical. In physics it is electron flow. My textbooks used electron flow. It makes more sense because it agrees with physics. There are migrating holes in semiconductors only because the electrons move from atom to atom. All movement is electrons. Atoms didn't move, protons didn't move, electrons moved. If you have a hole in your yard and I dig a hole and use my dirt to fill your hole, did the dirt move or the hole? Ask a hundred people and most will say the dirt moved. There might be a couple of characters that say the hole moved, but __electron__ics is not philosophy, it is science.

Do not do this.

The entire point of a PWM signal is to turn the FET all the way on and all the way off really fast. Low pass filtering the PWM output turns it into a relatively flat analog signal which will partially turn the MOSFET on, causing it to dissipate power and heat up. You do not want this to happen. You want the PWM signal to remain as square as possible.

Yes, do this, use the low pass if you want to eliminate the noise. I would not use the low pass if it were a very high current load but the maximum current here is 400 ma and maximum power dissipation in the FET in this case is 1.25 watts (50% duty cycle) and your FET can dissipate 2 watts without a heat sink. Don't get caught up in arguments that are for the sake of being contrary without examining the facts in the case.

This PWM has a frequency of 490 Hz. A good PWM should have a frequency in the order of 20 kHz or more to use the square wave without filtering for some loads, such as your fan motor.

Your low pass filter should work fairly well with 3K3 ohms between pin 10 of your Pro Micro and the gate of the FET and a capacitor of .1 uF from the gate to ground.

No other resistor is needed.