"This obviously introduces electrical noise which I am trying to eliminate."Maybe it's not that obvious, I always thought it was. Any motor I have seen that was controlled by PWM on the power has produced this whining noise, from small PC fans to brushless motors in RC planes and heli's. I thought it was a universal side-effect of supplying power in pulses, caused by the PWM frequency itself (unless perhaps when the frequency is outside the audible range for humans). That assumption may very well be wrong.
Why obviously? Why is noise a problem?
Fans are brushless motors, they have a commutator, they are noisy, no matter what you do with them. On the other hand they are an inductor, so they resist the change in current. So it is possible that you already have a preatty smooth signal, depending on the PWM frequency.
Have you connected an oscilloscope to it. Do you understand electrical noise, an it's effects on the system?
Don't filter it. Reduce PWM frequency to ~160Hz, and magic may happen.
"This obviously introduces electrical noise which I am trying to eliminate."
Why obviously? Why is noise a problem?
Fans are brushless motors, they have a commutator, they are noisy, no matter what you do with them. On the other hand they are an inductor, so they resist the change in current. So it is possible that you already have a preatty smooth signal, depending on the PWM frequency.
Have you connected an oscilloscope to it. Do you understand electrical noise, an it's effects on the system?
This obviously introduces electrical noise which I am trying to eliminate.
Maybe it's not that obvious, I always thought it was. Any motor I have seen that was controlled by PWM on the power has produced this whining noise, from small PC fans to brushless motors in RC planes and heli's.
...
And no, I don't know the first thing about electrical noise or its effects on the system. Maybe I used a wrong term for it. All I know is that with PWM it makes a very audible whining noise (even when the fan is not spinning, say at very low PWM %). When I connect the fan to a lab power supply and change the voltage I get the desired speed control without the annoying whining noise.
Increase the FAN PWM frequency. Removes the PWM noise but increases heating in the FET/ArduinoThe heating is probably why the setting is disabled by default. Judging by the source code the FAST_PWM_FAN option results in the PWM frequency being calculated as follows: CPU_FREQ / 256 / 8. Since the CPU on my board runs at 16 MHz that would result in a PWM frequency of 7,812.5 Hz, which is still well within the audible range. I've also read that this setting reduces the control resolution because scaling modifiers need to be used internally. All in all it does not look like a very good solution either.
This seems to be a language problem. What you described as "electrical" noise is apparently acoustic noise (i.e. audible noise, sound waves).Indeed, my apologies for the misunderstanding. I have edited it in my original post.
This misunderstanding would have misdirected the people who first read your post.
The first thing to check (you didn't say if you did this) is to run the fan on a variable DC supply and see if it is any quieter, if not, then it is just a noisy fan (wind noise or commutation). Note that you also need to check that the fan can reliably start as the DC supply is ramped up to minimum rated voltage.I have indeed done that. On a DC lab supply I could control the speed by adjusting the voltage without any whining noise. The fan starts spinning at around 1.8V. I tested its ability to restart several times at 2V and it seemed to have no problems with that (even though the manufacturer specifies a minimum of 4.5V).
You really need to know the PWM frequency to effectively understand and fix the problem. What sort of noise is the fan making? If it is a wining noise then the PWM frequency is in the low kHz range, if you are not able to change it, then a small RC or LC filter may solve the problem.Now I know it's 500 Hz, which seems correct for what I'm hearing. I'm convinced the noise is from the PWM frequency.
I've linked a fix that I did for a GW Instek Bench PSU fan, this presented as an apparent 'rattling bearing' sound. In this case, the PWM frequency was very low (65Hz) meaning that the internal supply capacitor in the fan was completely unable to cope. I introduced a simple RC filter that completely solved the problem...
https://www.eevblog.com/forum/repair/cured-my-gps2032-psu-rattle/msg931131/#msg931131 (https://www.eevblog.com/forum/repair/cured-my-gps2032-psu-rattle/msg931131/#msg931131)
May I ask why you opted for an RC filter over LC?
Someone once told me brushless motors are always 3-phase and thus have 3 wires (this fan only has 2) but I'm pretty sure it's brushless anyway. It's a Sunon MF50151VX.Brusleless fans have 2 wires, if they have 3rd wire it's tachometric output. They have internal circuit which switches the windings. And MF50151VX is certainly a brusheless fan. PWMing it will certainly cause damage to it (although it likely will keep working). You need to make a proper buck converter.
Don't filter it. Reduce PWM frequency to ~160Hz, and magic may happen.Like blowing up electrolytic capacitor inside the fan?
Given heat dissipation on that resistor, proper buck converter likely will be smaller in size. Total component count needed is almost the same. Also you won't be able to go near to full voltage unless using very low resistance, which will mean huge current spikes. I don't see any good reason using MOSFET + large resistor + cap vs MOSFET + diode (or second MOSFET) + small inductor + cap. If avoiding buck converter for any reason, instead of using RC filter, just smooth PWM before pass element and go linear.May I ask why you opted for an RC filter over LC?
Mainly for convenience. All though an LC filter is much more efficient*, it is generally the case that resistors are small and cheap while inductors tend to be bigger and more expensive. But by all means use an LC filter if you can calculate the sizes of L and C correctly and have space to install them.
Yes, as IanB said, I used RC for convenience, at that low a frequency (65Hz) I think a decent inductance conveniently small inductor would probably have had >10R DCR anyway. The fan being 24V fan made supply current lower too.But why would you use low frequency for LC (it's just a buck converter really) to begin with? Just use timer in MCU to generate high frequency PWM.
It looks as if you've had a nice quiet first stab. A 47R series resistor is going to result in a fair voltage drop. As your PWM frequency is 500Hz, you have quite a lot of leeway. You only need to get rid of the nasty edges, so, yes, I'd shift to 10R (2V drop or less) and then tune it down further by ear.
Kinda surprising to see that, I guess 100% PWM isn't the same as continuous 12V DC after all.Even when you directly connect the fan through that resistor, you still will have a voltage drop over it.
I wasn't talking about the voltage drop, rather the ripple in the output. Then again I don't know how much of that is from the PWM + RC LPF and how much is from the power supply itself.Kinda surprising to see that, I guess 100% PWM isn't the same as continuous 12V DC after all.Even when you directly connect the fan through that resistor, you still will have a voltage drop over it.
If the PWM frequency is around 500Hz and as the screens show ~300Hz ripple, I would suggest that this ripple is not from PWM (100%) and is the commutating frequency of the fan.The rated speed for the fan I used there (a MF50151V1 this time) is 5000 rpm (or ~83 Hz), though at 11V it would be a little less than that. I'll continue to experiment with different resistors/capacitors/fans, probably try an LC or RLC filter too.
As they are quite near together this could be the cause for the noise, would suggest it was at around 200Hz and/or 800Hz...
Attached is a simulation which takes things to the extreme R = 1R, C = 1000µF and a load resistance of 80R to be close to the 170mA. The PWM frequency is a bit higher at 2kHz and a duty cycle of 20%. The voltage across the load settles at 13V, with 830mA current spikes being drawn each pulse.
Big, especially if the frequency is 500Hz as per the original poster's circuit, not the 2kHz I used in my simulation. Without calculating anything properly, just plugging figures into the simulation, I get around 47mH, which would need to be rated to 200mA.Attached is a simulation which takes things to the extreme R = 1R, C = 1000µF and a load resistance of 80R to be close to the 170mA. The PWM frequency is a bit higher at 2kHz and a duty cycle of 20%. The voltage across the load settles at 13V, with 830mA current spikes being drawn each pulse.
If you were to replace the resistor with an inductor, what size inductor would produce reasonable performance?
And the LC circuit:No, it's stupid. Also that inductor is large and made for mains filters, has two 47mH coils, that thing likely would experience tremendous losses. Viable would be like 30kHz PWM and inductor in hundreds of uH range. If done decently there will be barely any energy losses and 100-220uF capacitor would be more than enough.As for the rectifier circuit... I think I have some more studying to do. :)
- Would, say, a B82791H2251N020 be a good inductor here? (47mH, max 250mA / 2.4R, 30% tolerance)
- How would the characteristics differ from an RC circuit? Why is this better?
If these big inductors have resistance values in the same ballpark as the resistors we used for RC, is there still a point in using them?
Wow, thank you so much Hero999, you are really going above and beyond!Yes, I simulated it in LTSpice.
I've spent a few hours playing around with different RC vaues and studying the results. Getting a good feel for how it all fits together now. It seems that for the specific scenario of feeding PWM through an RC LPF you could say that:Therefore in practice it seems best to do a balancing act choosing your resistor (as low as possible for the upper limit but not so low that it destroys your control curve) and then choose an appropriate capacitor based on how much ripple you can tolerate. Of course all of the above depends on how great the load is. Greater loads will require smaller resistors and larger capacitors to maintain similar results.
- Capacitor value primarily affects ripple (smaller cap will drop more in voltage during off-portion of PWM cycles)
- Resistor value primarily affects control range in two ways:
- Limits the top end of your PWM control (smaller resistor will drop less voltage and thus get closer to the 12V max)
- Shifts your control curve (smaller resistor will charge the capacitor faster, e.g. 10% pulses could be enough to fully charge the capacitor and if it is big enough to carry through the remaining 90% this would shift your effective control curve to ~0-10% PWM)
A few questions about your RC circuit:And the LC circuit:
- Is that LTSpice?
- How do you arrive at a load resistance of 80R?
Do you simply use Ohm's law and divide the voltage by the rated current? If so, then judging by my volt/amp measurements this remains fairly constant at lower speeds.
Can you measure the ESR of a component like this by simply measuring resistance with a multimeter?- You mention 830mA current spikes but the graph shows the spike going as high as 14A and eventually settling at 830mA?
As for the rectifier circuit... I think I have some more studying to do. :)
- Would, say, a B82791H2251N020 be a good inductor here? (47mH, max 250mA / 2.4R, 30% tolerance)
- How would the characteristics differ from an RC circuit? Why is this better?
If these big inductors have resistance values in the same ballpark as the resistors we used for RC, is there still a point in using them?
As I said before, I see barely any sense going resistive PWM as well. Just use something like LM1117-ADJ and put smoothed PWM on it's ADJ pin. No current spikes, no large cap needed. As a bonus, output voltage will be independent from the load.Assuming there's a permanently live conductor, then that would work perfectly. When I designed the previous circuit, I made the assumption that it was just a two wire connection: one 0V and one PWM.
The peak current can be calculated from the supply voltage and resistor value.How would you calculate that?
Assuming there's a permanently live conductor, then that would work perfectly. When I designed the previous circuit, I made the assumption that it was just a two wire connection: one 0V and one PWM.That's correct, at present there's only those two wires going to the fan. I could always lay an additional 12V line from the PSU but the simpler the solution the better.
Now I'd like to try an LC filter but I'm getting completely lost in the massive spectrum of inductors that are available. My local hardware store has 2 radial 47mH inductors (both shielded), one with an RDC of 82 (Q=70) and one with an RDC of 52 (Q=100). Both have an IDC of 8mA.Don't bother with that. It's a completely non viable solution. And with those small inductors even non working. Unless you get into 10+kHz range, forget about LC.
There's no reason why an LC filter won't work. It will just need an inductor 50 times the size of the equivalent circuit, working at 25kHz. Now this may not be ideal, but it's certainly possible and the current is under 200mA, which helps to make it easier too.Now I'd like to try an LC filter but I'm getting completely lost in the massive spectrum of inductors that are available. My local hardware store has 2 radial 47mH inductors (both shielded), one with an RDC of 82 (Q=70) and one with an RDC of 52 (Q=100). Both have an IDC of 8mA.Don't bother with that. It's a completely non viable solution. And with those small inductors even non working. Unless you get into 10+kHz range, forget about LC.
Ohm's law. It's no coincidence the peak current is nearly 14A, the supply voltage is nearly 14V and the series resistor is 1Ohm.The peak current can be calculated from the supply voltage and resistor value.How would you calculate that?
Those inductors are completely unsuitable. The DC current rating is far too low.Assuming there's a permanently live conductor, then that would work perfectly. When I designed the previous circuit, I made the assumption that it was just a two wire connection: one 0V and one PWM.That's correct, at present there's only those two wires going to the fan. I could always lay an additional 12V line from the PSU but the simpler the solution the better.
Now I'd like to try an LC filter but I'm getting completely lost in the massive spectrum of inductors that are available. My local hardware store has 2 radial 47mH inductors (both shielded), one with an RDC of 82 (Q=70) and one with an RDC of 52 (Q=100). Both have an IDC of 8mA.
Is the RDC value really the series resistance I can expect in a DC circuit? If so, then values this high render it completely useless here.
Is the IDC value really the max DC current it can handle? If so, then values this low are equally useless here.
Looks like you aren't kidding about that size. Maybe I'm looking in the wrong places but after browsing DigiKey and Mouser I still haven't been able to find an inductor that would be even remotely usable for this. Anything with sufficient inductance, current capacity and a low enough DC resistance is massive and often insanely expensive. So far the closest I could find was this thing (https://www.digikey.be/product-detail/en/hammond-manufacturing/193T/HM4797-ND/455243)... I guess this will remain a thought experiment after all.Don't bother with that. It's a completely non viable solution. And with those small inductors even non working. Unless you get into 10+kHz range, forget about LC.There's no reason why an LC filter won't work. It will just need an inductor 50 times the size of the equivalent circuit, working at 25kHz. Now this may not be ideal, but it's certainly possible and the current is under 200mA, which helps to make it easier too.
So then you divide your resistor voltage drop by the resistor value? ~0.8V / 1Ohm seems like the only way I can arrive at ~830mA.Ohm's law. It's no coincidence the peak current is nearly 14A, the supply voltage is nearly 14V and the series resistor is 1Ohm.The peak current can be calculated from the supply voltage and resistor value.How would you calculate that?
I said it won't fork with particular inductors. And such circuit is just not feasible even if it works (with big inductor and capacitor) due to size and price.There's no reason why an LC filter won't work. It will just need an inductor 50 times the size of the equivalent circuit, working at 25kHz. Now this may not be ideal, but it's certainly possible and the current is under 200mA, which helps to make it easier too.Now I'd like to try an LC filter but I'm getting completely lost in the massive spectrum of inductors that are available. My local hardware store has 2 radial 47mH inductors (both shielded), one with an RDC of 82 (Q=70) and one with an RDC of 52 (Q=100). Both have an IDC of 8mA.Don't bother with that. It's a completely non viable solution. And with those small inductors even non working. Unless you get into 10+kHz range, forget about LC.
As I said before, I see barely any sense going resistive PWM as well. Just use something like LM1117-ADJ and put smoothed PWM on it's ADJ pin. No current spikes, no large cap needed. As a bonus, output voltage will be independent from the load.I've gone over the LM1117's data sheet and I don't think it would work well for this. I only have 12V to work with and at my target current of 170mA the LM1117 has a dropout voltage of 1.1V, so unless I misunderstand linear regulators that means I'll never get much higher than 10.9V out. An RC circuit with 5R drops less than that, and with 2.5R I can get up to 11.5V in practice (at the expense of squishing my control curve into the bottom of the PWM range).
Nobody prohibits using LDO with lower voltage drop. As of 2.5R, it's on border with insane circuit design, my condolences to the smoothing capacitor. No sane engineer would ever place something like this into actual product.That's what I thought. I suppose I should not expect too many years out of that capacitor before it blows up like a balloon? On the bright side, it's "only" cycling at 500Hz.
Yes, to get smoothing at low frequencies, a big fat inductor is required.Looks like you aren't kidding about that size. Maybe I'm looking in the wrong places but after browsing DigiKey and Mouser I still haven't been able to find an inductor that would be even remotely usable for this. Anything with sufficient inductance, current capacity and a low enough DC resistance is massive and often insanely expensive. So far the closest I could find was this thing (https://www.digikey.be/product-detail/en/hammond-manufacturing/193T/HM4797-ND/455243)... I guess this will remain a thought experiment after all.Don't bother with that. It's a completely non viable solution. And with those small inductors even non working. Unless you get into 10+kHz range, forget about LC.There's no reason why an LC filter won't work. It will just need an inductor 50 times the size of the equivalent circuit, working at 25kHz. Now this may not be ideal, but it's certainly possible and the current is under 200mA, which helps to make it easier too.
Does it really need to have that much inductance though? I don't need to smoothen my DC output that much. Even with 2V ripple it would still be good enough to eliminate the PWM noise. Then again I don't think I fully understand the impact of inductance in an LC circuit.
Look at the voltage, when the 14A peak is drawn.So then you divide your resistor voltage drop by the resistor value? ~0.8V / 1Ohm seems like the only way I can arrive at ~830mA.Ohm's law. It's no coincidence the peak current is nearly 14A, the supply voltage is nearly 14V and the series resistor is 1Ohm.The peak current can be calculated from the supply voltage and resistor value.How would you calculate that?
PWM% => Vout
5 => 1.3
6 => 1.7
7 => 2.1
8 => 2.6
9 => 3.0
10 => 3.5
11 => 3.9
12 => 4.3
13 => 4.7
14 => 5.1
15 => 5.5
16 => 5.9
17 => 6.2
18 => 6.5
19 => 6.8
20 => 7.0
25 => 8.2
30 => 9.0
35 => 9.6
40 => 10.0
50 => 10.6
60 => 11.0
80 => 11.3
100 => 11.8
An additional PWM circuit was my next option to explore. I haven't been able to find any PWM IC's that are also PWM-controlled (hardly surprising), they all seem to be voltage-controlled. Which brings me back to my original problem of how to convert the 500Hz PWM to a linear scaling voltage.Resistor + capacitor. What you've seen so far was not linear because pulling only to one side, not up/down and because of the load attached.
Resistor + capacitor. What you've seen so far was not linear because pulling only to one side, not up/down and because of the load attached.I don't understand, without a load any DC supplied to the capacitor through a resistor would eventually charge it to 12V, regardless of the PWM duty cycle. What do you mean with pulling to one side vs up/down? It sounds like DC vs AC but that's probably not what you meant?
It means pulling to GND as well, not leaving open circuit.Resistor + capacitor. What you've seen so far was not linear because pulling only to one side, not up/down and because of the load attached.I don't understand, without a load any DC supplied to the capacitor through a resistor would eventually charge it to 12V, regardless of the PWM duty cycle. What do you mean with pulling to one side vs up/down? It sounds like DC vs AC but that's probably not what you meant?
It means pulling to GND as well, not leaving open circuit.Sorry, I still don't get it. I thought my last 2 circuits were closed. I only put the GND in because LTSpice requires it.
It sounds like a really fun discussion but are you sure you're not going a little OTT just to stop a fan whining? :)On the contrary, I'm sure I'm going completely over the top. At this point it's mostly just a fun learning exercise. ;)
Presumably the PWM changes in response to some kind of temperature sensing, so as long as the fan control range is able to keep up, then is there a problem?
Just asking. :)
Your last 2 circuits are LC. What I mean is that you both charge and discharge the capacitor through resistor. If there is no any significant load at the output, like when controlling IC as you mentioned, output voltage will be completely proportional to PWM duty cycle.It means pulling to GND as well, not leaving open circuit.Sorry, I still don't get it. I thought my last 2 circuits were closed. I only put the GND in because LTSpice requires it.
Aha, I think I get what you're saying now. But then you do need something to switch that GND discharge on & off inversely to the PWM duty cycle. I've used another one of these conditional resistors to simulate it here, not sure which solution would be best for that.To make it shorting, simply remove the Rsw component. The default behaviour of the pulsed voltage source is shorting and Rsw was added to make it non-shorting. Unfortunately this will not model your circuit correctly, which will just be a single transistor in series with the fan, which leaves it open circuit, when off. Another transistor will need to be added to short the output, when the input goes low.
I also came across this article (https://origin-www.maximintegrated.com/cn/app-notes/index.mvp/id/3530) which offers a more complex circuit to convert PWM to linear voltage to reduce acoustic noise. I'm still trying to wrap my head around it. It's interesting that he was able to do it without resorting to large capacitors even though his PWM frequency is a measly 93.5Hz. I'm not sure why he inverted the output though (100% PWM = 0V), that's something I could do without.This is what I was suggesting. Convert PWM to DC for control and go linear. In your case you can do it simpler. You don't have tachometric output from the fan so you can control voltage on the GND side as well.
It's interesting that he was able to do it without resorting to large capacitors even though his PWM frequency is a measly 93.5HzNothing interesting. Just normal design contrary something abnormal you tried to do.
I also came across this article (https://origin-www.maximintegrated.com/cn/app-notes/index.mvp/id/3530) which offers a more complex circuit to convert PWM to linear voltage to reduce acoustic noise. I'm still trying to wrap my head around it. It's interesting that he was able to do it without resorting to large capacitors even though his PWM frequency is a measly 93.5Hz. I'm not sure why he inverted the output though (100% PWM = 0V), that's something I could do without.It also requires an extra power wire, which I thought you wanted to avoid.
(https://origin-www.maximintegrated.com/cn/images/appnotes/3530/3530Fig02.gif)