I tried searching some but couldn’t find anything. I have a Particle Photon that I’m using to control a small fan with a Mosfet. When I use the default PWM Frequency (500Hz) the fan starts spinning at about 25% duty (60/255). If I increase the frequency to 10,000Hz it doesn’t start until around 50% (130/255). If I change it to 20,000Hz it’s closer to 75% before the motor starts turning. If I lower the clock to 250Hz it starts turning at around 20%.
I’m not sure if this is somthing inherant in the changing of frequencies or if I have a poor selection for certain components. I’m using:
12V Power Supply
This Diode as a Flyback Diode
Here is my circuit:
The fan motor is an inductive load. After your mosfet switches on, it will take some time for the current to build through that inductance. The time-constant is determined by the inductance and the channel resistance of the mosfet. When you increase the switching frequency, you reduce the time available for the current to build, producing the results that you have observed.
Now, why are you wanting to increase the PWM frequency? Do you expect to see any benefit over using the 500Hz or 250Hz frequency?
Increased PWM frequency might be desirable when a PWM frequency in the audible range causes extra noise.
But that said, filtering caps might help in either case.
@woodwhcker Thank you for the explanation. I was trying to increase the frequency to reduce noise - but it’s not critical. I just liked the idea of a quite fan but it’s for a BBQ Outdoors so it doesn’t really matter.
@ScruffR Something like this: https://electronics.stackexchange.com/a/103638
Actually more along the line of this discussion of filtering PWM signals
Thanks! I read through that and started recalling it a little from my college circuits class.
I also found THIS and THIS.
In the calculator, I figured out that a cutoff frequency of around 300Hz seems like it would work for me. With the PWM Frequency at 20kHz I would get:
- Peak-to-peak ripple voltage: 0.078V
- Settling Time: 0.0012s
Both of those seem plenty fine for my fan.
You might consider placing a ~220uf cap on that circuit. When switching inductive loads like this it’s going to make the particle’s power supply much happier.
The fan you linked to is a 24V model. Is that correct? That might also explain the tardy start up characteristics if you’re using a 12V supply.
Closing the loop with optically or magnetically sensed feedback would be the way to go if speed control accuracy is important, but that might be over-engineering things for your application.
I should have looked at your fan link rather than just looking at your image. You have to be careful as that fan is not a simple DC motor in the sense of how you drew it. It could be a motor with a circuit board on the back of it which controls its fan speed at 24vdc. Just like a computer fan would. If that is the case you cannot try to regulate its RPM via the power leads.
@woodwhcker That’s correct 24V fan 12V power supply. According to the data sheet, the fan should run fine at 12V just draw more current. Fan speed isn’t super critical.
@seulater I think you’re right, there is part of a circuit board visible.
More than likely it looks like this inside the hub.
You can read more about how those types of motors work here, this is why you cannot PWM those through the “power leads”. They do make fans like yours with an extra input wire so that you can give it a PWM signal to control its speed. Typically these types are dead giveways to know which ones they are because they will typically have 4 wires on the, Power, GND, tack (output), RPM (input)
@seulater So I probably should have gotten something like this: https://www.digikey.com/product-detail/en/delta-electronics/BFB0512VHD-SP01/603-1244-ND/2309198
Then, in theory, I wouldn’t need the MOSFET at all.
You CAN, you just have to be careful about the operating conditions. It does work and I’ve used it in many products.
The commutation in those fans is so simple that it basically just gives it a brief ‘kick’ during the on-time. It works alright down to about 1/2 the max RPM in most cases.
This is likely why your fast PWM is performing poorly… as your on-time becomes smaller and smaller, the slight delay in turn on becomes a larger and larger percentage of the on-time you’re giving it.
The major downside of this approach is that when you have a 3-wire (+,-,RPM open collector) fan, it becomes really obnoxious to detect the RPM when you’re switching the power on and off.
Technically you can on the older models. The reason I said you can’t is because they might not know the difference on how to detect which ones they can and can’t do this with. Some of the newer fans you can’t do this as I have seen 8pin uP’s in them and switching them on and off does not allow the micro enough time to startup. On the cheaper fans you can get away with it. So i thought its just best to say you cant.
But rather than say you can would lead someone down the wrong path one day. The newer ones out have