Filtering PWM to smooth DC - Page 1
Forum section: electronics / beginners

author: Rapsey
author_rank: Contributor
timestamp: September 21, 2018, 01:34:56 pm
content: Hi everyone,My question is more or less the same asthis onefrom 7 months ago, but I didn't want to gravedig.So we have a 5015 blower fan powered by 12V PWM (on the actual power, not just signal). This obviously introduceselectrical noisean audible whining noise which I am trying to eliminate.The fan can be voltage regulated to achieve the desired result without anyelectrical noiseaudible whining noise. It is rated for an operating voltage of 4.5 - 13.8V and a current of 170mA (= 2.04W). As with the voltage the current tolerance is +-15%.Now the question is how to convert that 12V PWM to (relatively) smooth DC power. I've seen a few solutions:Just put a capacitor onto itThis to me seems like a very poor solution, if you can even call it that. For one thing it messes up the PWM control, i.e. 80% PWM won't be 80% effectively. I'm also concerned about reverse current: during the off-portion of every duty cycle the capacitor will put voltage on the Arduino which is supplying the PWM power. Maybe this is fine but I'd rather ask here than find out the hard way.Capacitor with resistor in seriesI've heard that the resistor is added to slow down the charging of the capacitor. Is this accurate? Again, same reverse current concerns as before.Capacitor with inductor in seriesOkay, I understand that inductors resist changes in current and capacitors resist changes in voltage. I can see how those two would make a good team here. Again, worried about reverse current and also inductive spikes. Might need to add a diode in parallel with the inductor to allow the current to circulate back if the load is suddenly removed?Capacitor with inductor in series and a freewheeling (schottky) diode placed in parallel over both (= buck converter)This seems to be best way to do it, but I wonder if it is necessary. I'll probably need to place my solution in-line on the fan wires so the more compact I can make it the better.I am fairly new at this so please point out any mistakes or misinterpretations. Any and all feedback is greatly appreciated!

author: tszaboo
author_rank: Super Contributor
timestamp: September 21, 2018, 02:49:35 pm
content: "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?

author: Rapsey
author_rank: Contributor
timestamp: September 21, 2018, 03:47:56 pm
content: Quote from: NANDBlog on September 21, 2018, 02:49:35 pmMaybe 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.Noise is a "problem" because the 3D printer is located right next to the bedroom and often used for overnight printing. It's not a major issue since it's not that loud, I am simply trying to do what I can to make it as quiet as possible - and learn a thing or two in the process.I do believe you are correct in saying it's a brushless motor. It's categorized with the brushless fans anyway. 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.Unfortunately I don't have an oscilloscope (yet) so I can't measure the PWM frequency that way. I can't find any reliable information on it either since it's a firmware setting and I don't have the source code for the firmware that shipped with my printer. I suspect it's a fairly low frequency to reduce load on the Arduino that generates it. I do realize that I need to determine the frequency before I can try anything. Having a scope would also be extremely useful to study the effects of different solutions. It's definitely on my shopping list.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. If I can get the same results on the printer itself, why wouldn't I?Thanks for the reply!

author: Kleinstein
author_rank: Super Contributor
timestamp: September 21, 2018, 05:08:04 pm
content: The brush-less fans usually have a capacitor inside to buffer there supply. So if there is no series resistor or inductor, there would be significant current spikes that could act back on the PWM circuit. So it is a good idea to have at least some series impedance. The resistor way can work, though it produces some heat and does not allow full speed. The inductor method essentially needs the diode. Inductor and no diode can damage the PWM output, though there might be a diode inside.So one could get away with just a resistor or inductor and diode. It might still help to add more capacitance.

author: MiDi
author_rank: Frequent Contributor
timestamp: September 22, 2018, 12:21:59 am
content: Quote from: blueskull on September 21, 2018, 05:10:42 pmIf that's not enough try with a buck-converter

author: vk6zgo
author_rank: Super Contributor
timestamp: September 22, 2018, 03:10:43 am
content: Quote from: NANDBlog on September 21, 2018, 02:49:35 pmTypo?Commutators use brushes, otherwise they wouldn't work, so by definition, motors with commutators are not "brushless motors".

author: IanB
author_rank: Super Contributor
timestamp: September 22, 2018, 03:23:28 am
content: Quote from: Rapsey on September 21, 2018, 01:34:56 pmQuote from: Rapsey on September 21, 2018, 03:47:56 pmThis seems to be a language problem. What you described as "electrical" noise is apparently acoustic noise (i.e. audible noise, sound waves).This misunderstanding would have misdirected the people who first read your post.One way to reduce or eliminate the audible whining noise is to change the PWM frequency. You can either increase it above the audible range to 50 kHz or more, or decrease it below the audible range to 10 Hz or less (although this may produce clicking). You would have to experiment and see.

author: Gyro
author_rank: Super Contributor
timestamp: September 22, 2018, 09:31:36 am
content: If it isAudiblenoise that you are talking about, then yes, brushless fans can certainly generate noise when the supply is PWM driven. The problem can be particularly bad if the PWM frequency interacts with the commutation frequency of the fan.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.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.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

author: Audioguru
author_rank: Super Contributor
timestamp: September 22, 2018, 01:57:18 pm
content: Of course a brushless motor has 3 wires, a brushed motor has 2 wires. Maybe you have a brushless motor with an attached electronic circuit.A brushless motor does not run when powered by DC from a battery or power supply, its 3 coils must be fed pulses in sequence by an electronic circuit. A brushed motor runs fine when powered by DC.Therefore you have a brushed motor or a brushless motor with an attached electronic circuit.A whining sound is produced because the PWM frequency its too low and is audible.

author: Rapsey
author_rank: Contributor
timestamp: September 22, 2018, 04:15:56 pm
content: Thank you all for your replies, I have learned a lot already.First of all, I have gone out and bought myself an oscilloscope. With that I was able to determine thatthe PWM frequency is 500 Hz(2ms period). The shape of it seems like a fairly good square wave although there is a bit of jitter after each downward spike.To those suggesting that I change the PWM frequency, I'm afraid it can't be set arbitrarily. From studying the Marlin firmware source code it appears that the timers for the PWM frequency are shared by other PWM-controlled components such as the heaters and the stepper motors. The firmware does have a FAST_PWM_FAN setting (yes/no) which notes:QuoteThe 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.Quote from: IanB on September 22, 2018, 03:23:28 amIndeed, my apologies for the misunderstanding. I have edited it in my original post.Quote from: Gyro on September 22, 2018, 09:31:36 amI 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).Quote from: Gyro on September 22, 2018, 09:31:36 amNow I know it's 500 Hz, which seems correct for what I'm hearing. I'm convinced the noise is from the PWM frequency.May I ask why you opted for an RC filter over LC?

author: IanB
author_rank: Super Contributor
timestamp: September 22, 2018, 04:20:47 pm
content: Quote from: Rapsey on September 22, 2018, 04:15:56 pmMainly 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.* About efficiency, an inductor stores energy and gives it back to the system, while a resistor just throws energy away.

author: wraper
author_rank: Unknown
timestamp: September 22, 2018, 04:31:28 pm
content: Quote from: Rapsey on September 21, 2018, 03:47:56 pmBrusleless 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.3 wires for the motor itself is when you have BLDC motor which needs external motor driver which will switch windings.Quote from: blueskull on September 21, 2018, 05:10:42 pmLike blowing up electrolytic capacitor inside the fan?

author: wraper
author_rank: Unknown
timestamp: September 22, 2018, 05:21:24 pm
content: Quote from: IanB on September 22, 2018, 04:20:47 pmGiven 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.

author: Rapsey
author_rank: Contributor
timestamp: September 22, 2018, 05:57:01 pm
content: I've started by trying a low pass RC filter, mainly because I have plenty of resistors and capacitors lying around but no diodes or inductors. This is my maiden voyage into filter circuits so... brace for newbie mistakes.I calculated my resistor value based on a cut-off frequency of 10 Hz and a 330 μF capacitor (16V electrolytic). This may be too big a capacitor for the job but it does arrive at a convenient resistor value:R = 1 / (2×π×fc×C) = 1 / (2×π×10×330×10^−6) = 48.2 Ω => I used a 47 Ω resistor.The oscilloscope now shows a fairly constant voltage: a zigzag shape (linear up & down ramps) with 10mV peak-to-peak. So far so good I think.Controlling the fan through this now works without any whining noise. However... It doesn't get up to full speed anymore. Some voltage measurements:1/8 duty cycle: ~2.8V1/4 duty cycle: ~4.8V1/2 duty cycle: ~6.8V1/1 duty cycle: ~8.7VSo yeah, quite a long way off 12V at "full" speed.Best guess: I should increase my cut-off frequency to result in a lower resistor value? Maybe 50 Hz for 10 Ω?

author: MiDi
author_rank: Frequent Contributor
timestamp: September 22, 2018, 06:18:13 pm
content: This is the problem with rc filter: they have an attenuation dependent of the current through resistor - it is a loaded rc-filter, forming a voltage divider...So the resistance has to be so low, that negligible voltage drop due to current occurs at dc, which can lead to unreasonable high capacitor.LC filter would be an option, but has its own problems with resonance and this depends on input and output impedance as well...You should take the suggestions as serious, but it is always the best to make your own experience

author: Zero999
author_rank: Super Contributor
timestamp: September 22, 2018, 06:23:48 pm
content: As mentioned above, an RC filter will result in some voltage drop and power wastage. In this case, the current is 0.17A and the resistor is 47R, so that's a loss of 8V. In reality, the motor will just draw less current, so the voltage drop won't be that high, but it will still be significant, so the fan will be unable to run at top speed.

author: Gyro
author_rank: Super Contributor
timestamp: September 22, 2018, 06:32:24 pm
content: 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.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.EDIT: From your ripple readings, it sounds as if the fan drive is an open collector output, but best to double check that it isn't push-pull. You wouldn't want to blow it.

author: wraper
author_rank: Unknown
timestamp: September 22, 2018, 06:39:31 pm
content: Quote from: Gyro on September 22, 2018, 06:32:24 pmBut 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.

author: Gyro
author_rank: Super Contributor
timestamp: September 22, 2018, 06:45:49 pm
content: In my case (see my linked thread) I was stuck with a primitive 555 + opamp based thermistor sensing speed control on the Instek PSU board. I suppose I could have messed around with capacitor values to increase the 555 switching frequency, but that would have involved debugging and it was simpler to leave the PCB with heatsinks, thick transformer connections etc. in situ and just mod the fan lead.

author: Rapsey
author_rank: Contributor
timestamp: September 22, 2018, 08:12:48 pm
content: A couple of follow-up observations:With the 10 Ω resistor the fan is able to get up to 11V at 100% PWM. Evidently this does not scale linearly with the PWM: even at 1/32 duty cycle I was still getting ~4.7V.The output isn't quite as smooth anymore but still, no whining noise so that's alright. Wave forms are very interesting to see. At low PWM it's a sawtooth pattern (near-vertical up, ramp down) with 500-600mV peak-to-peak. At 50% PWM it's a nice zigzag ramp up & down, and at 100% it's... I don't even know. See attachments.Kinda surprising to see that, I guess 100% PWM isn't the same as continuous 12V DC after all.Apologies for the crappy portable scope, I don't have room for a big one right now.

author: wraper
author_rank: Unknown
timestamp: September 22, 2018, 08:29:14 pm
content: Quote from: Rapsey on September 22, 2018, 08:12:48 pmEven when you directly connect the fan through that resistor, you still will have a voltage drop over it.

author: Rapsey
author_rank: Contributor
timestamp: September 22, 2018, 08:39:19 pm
content: Quote from: wraper on September 22, 2018, 08:29:14 pmI 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.

author: MiDi
author_rank: Frequent Contributor
timestamp: September 22, 2018, 08:42:54 pm
content: 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.As they are quite near together this could be the cause for the noise, would suggest it was at around 200Hz and/or 800Hz...

author: Rapsey
author_rank: Contributor
timestamp: September 22, 2018, 09:00:22 pm
content: Quote from: MiDi on September 22, 2018, 08:42:54 pmThe 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.EDIT: Looks like you were right. Adding friction to slow the fan down widens the period of the entire wave form (both the sine and the spike) so they certainly don't have anything to do with the PWM frequency.

author: Zero999
author_rank: Super Contributor
timestamp: September 22, 2018, 09:15:45 pm
content: More than one RC stage can be used for a smoother output.A smaller value of R could be used to reduce the voltage drop, but make it too small, compared to the load and the PWM will no longer work. The capacitor will simply charge up with huge current spikes and the output will sit near to the full supply voltage, even with a fairly low duty cycle. 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.Rsw is a voltage controlled resistor which goes open circuit, well not quite but 1GΩ, when V1 drops below 13.8V and nearly closed circuit i.e. 1µΩ, when V1 is 13.8V. It's there to mimic the switching action of the PWM transistor. Without it, V1 will look like a low impedance and discharge back into it via R1, when the voltage drops. I could have used a voltage controlled switch or MOSFET but this is quicker to simulate and it's good to teach people about this. I could have also combined R1 with Rsw by changing the statement to R = if(V(PWM)<13.8,1G,1), but having a separate resistor makes the schematic easier to read.

author: IanB
author_rank: Super Contributor
timestamp: September 22, 2018, 09:57:31 pm
content: Quote from: Hero999 on September 22, 2018, 09:15:45 pmIf you were to replace the resistor with an inductor, what size inductor would produce reasonable performance?

author: Zero999
author_rank: Super Contributor
timestamp: September 22, 2018, 10:57:20 pm
content: Quote from: IanB on September 22, 2018, 09:57:31 pmBig, 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.Of course a resistor is much more economical, but it depends on what voltage drop and performance at low duty cycles is acceptable.There is another possibility: filter the PWM to pure DC using a rectifier and capacitor and use an emitter follower with a higher value RC circuit to drive the load. I'll post a schematic tomorrow.

author: Zero999
author_rank: Super Contributor
timestamp: September 23, 2018, 09:00:37 am
content: And here it is. It will drop nearly 2V at full output but that can be minimised by replacing D1 with a MOSFET rectifier and R3 with a current source. Another possibliity is to change it to low drop-out configuration, with a P device for Q1, but it will be difficult to stabilise.

author: Rapsey
author_rank: Contributor
timestamp: September 24, 2018, 02:36:48 pm
content: Wow, thank you so much Hero999, you are really going above and beyond!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: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)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.A few questions about your RC 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?And the LC circuit: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 for the rectifier circuit... I think I have some more studying to do.

author: wraper
author_rank: Unknown
timestamp: September 24, 2018, 08:40:26 pm
content: Quote from: Rapsey on September 24, 2018, 02:36:48 pmNo, it's stupid. Also that inductor is large and made for mains filters, hastwo47mH 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.

author: Zero999
author_rank: Super Contributor
timestamp: September 24, 2018, 10:02:48 pm
content: Quote from: Rapsey on September 24, 2018, 02:36:48 pmYes, I simulated it in LTSpice.80R was calculated using the load's current and voltage ratings and applying Ohm's law. I assumed it was a resistive load, which could be incorrect. If the current doesn't reduce much, when the voltage drops, use a constant current load.The 14A spikes, during start-up don't matter, as they don't last for long. The peak current can be calculated from the supply voltage and resistor value.Yes, tyhe ESRT of an inductor can be measured with a meter.As mentioned above, it makes more sense to use a higher frequency and smaller inductor, but if you can't change the frequency, then a large inductor is unavoidable. The losses won't be that high at the low frequency of 500Hz.

author: wraper
author_rank: Unknown
timestamp: September 24, 2018, 10:16:07 pm
content: 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.

author: David Hess
author_rank: Super Contributor
timestamp: September 24, 2018, 11:58:11 pm
content: The buck regulator structure using a capacitor, inductor, and diode is the best way. Some old motherboards worked this way to control the speed of non-PWM capable fans.Essentially it becomes a buck regulator without feedback control so the output voltage becomes the supply voltage * duty cycle.

author: Zero999
author_rank: Super Contributor
timestamp: September 25, 2018, 07:45:07 am
content: Quote from: wraper on September 24, 2018, 10:16:07 pmAssuming 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.I wouldn't even bother with the regulator, just use an emitter follower. Remove D1 and C1 from the circuit I previously posted and connect 13.8V directly to Q1's collector.

author: Rapsey
author_rank: Contributor
timestamp: September 25, 2018, 02:09:12 pm
content: Quote from: Hero999 on September 24, 2018, 10:02:48 pmHow would you calculate that?Quote from: Hero999 on September 25, 2018, 07:45:07 amThat'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.

author: wraper
author_rank: Unknown
timestamp: September 25, 2018, 02:29:42 pm
content: Quote from: Rapsey on September 25, 2018, 02:09:12 pmDon'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.

author: Zero999
author_rank: Super Contributor
timestamp: September 25, 2018, 03:38:01 pm
content: Quote from: wraper on September 25, 2018, 02:29:42 pmThere'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.Quote from: Rapsey on September 25, 2018, 02:09:12 pmOhm's law. It's no coincidence the peak current is nearly 14A, the supply voltage is nearly 14V and the series resistor is 1Ohm.QuoteThose inductors are completely unsuitable. The DC current rating is far too low.

author: Rapsey
author_rank: Contributor
timestamp: September 25, 2018, 04:27:54 pm
content: Quote from: Hero999 on September 25, 2018, 03:38:01 pmLooks 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 wasthis thing... I guess this will remain a thought experiment after all.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.Quote from: Hero999 on September 25, 2018, 03:38:01 pmSo then you divide your resistor voltage drop by the resistor value? ~0.8V / 1Ohm seems like the only way I can arrive at ~830mA.

author: wraper
author_rank: Unknown
timestamp: September 25, 2018, 04:29:32 pm
content: Quote from: Hero999 on September 25, 2018, 03:38:01 pmI 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.

author: Rapsey
author_rank: Contributor
timestamp: September 25, 2018, 05:41:52 pm
content: Quote from: wraper on September 24, 2018, 10:16:07 pmI'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).As far as I know linear regulators are also no more efficient than resistors so the only benefit I can see is that they give you linear control over the output voltage, whereas with RC it's a logarithmic curve where most of the control is between 0 and 30% PWM (depending on R/C values).

author: wraper
author_rank: Unknown
timestamp: September 25, 2018, 06:35:47 pm
content: 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.

author: Rapsey
author_rank: Contributor
timestamp: September 25, 2018, 06:59:12 pm
content: Quote from: wraper on September 25, 2018, 06:35:47 pmThat'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.Also, I just made a rather worrying observation... The control box of my printer (which houses all the electronics) can be powered in two ways: either from the printer's own power supply or via 5V USB.I wanted to do a test with a different power supply so I powered off the printer (unplugged both mains and USB) and then hooked up a 12V wall wart to my testing breadboard. Of course being the newb that I am I forgot that the printer's fan connector was still connected to the breadboard power rails as well. Guess what, the damn thing powers on. Apparently putting 12V on those fan leads somehow goes back through the FET to supply power to the internals. Guess that answers that, there's no diode in there.Now I'm even more concerned about having a capacitor discharge into those fan leads during the off-portion of the PWM cycles...

author: Zero999
author_rank: Super Contributor
timestamp: September 25, 2018, 08:57:04 pm
content: Quote from: Rapsey on September 25, 2018, 04:27:54 pmYes, to get smoothing at low frequencies, a big fat inductor is required.QuoteLook at the voltage, when the 14A peak is drawn.

author: Rapsey
author_rank: Contributor
timestamp: September 28, 2018, 01:36:02 pm
content: By the way, at 100% PWM that LC filter you provided shows a voltage spike before stabilizing. Is that something I should be concerned about? I'm not sure if ~20ms is long enough for such a spike to be dangerous.EDIT 1: Changing the placement of the diode seems to cut off the spike as it should:EDIT 2: Because I do not need the smoothing to be perfect I tried an LC filter with a smaller inductor. This actually seems to work quite well. The control curve is much better than an RC filter while also getting closer to 12V. The question remains:is this a sane thing to do?I'm using a 1N5819 here because I have a few of those lying around. For the inductor values I used a 5900-222-RC (axial, 2.2mH, 1.7RDC, 500mA).10% PWM: (this would be the lowest setting for practical use)20% PWM:30% PWM:50% PWM:100% PWM:EDIT 3: This is probably a better way to do the flyback diode:Having the diode in this configuration does raise the output voltage at low duty cycles: 10% PWM has gone from 3.3V to 5V.EDIT 4: Added a resistor to the flyback diode to dampen the effect of the inductor during the off-portion of the PWM cycles. Mostly to improve the control curve, so I can have access to low voltages (3-4V) without resorting to ultra-low PWM duty cycles (<=5%).Control curve now looks like this:Code:PWM% => Vout5 => 1.36 => 1.77 => 2.18 => 2.69 => 3.010 => 3.511 => 3.912 => 4.313 => 4.714 => 5.115 => 5.516 => 5.917 => 6.218 => 6.519 => 6.820 => 7.025 => 8.230 => 9.035 => 9.640 => 10.050 => 10.660 => 11.080 => 11.3100 => 11.8

author: Zero999
author_rank: Super Contributor
timestamp: September 29, 2018, 06:48:56 pm
content: Did you model the ESR of the inductors?Why do you want the inductor over the plain RC circuit? If it's efficiency, then in the first two edits, the diode is dissipating quite a bit of the power. In the fourth and final edit, R1 is dissipating a lot of power. Of course, if you're not bothered about efficiency, then this isn't a problem.Another approach is to build a PWM circuit, running at a much higher frequency, run off a diode and capacitor rectifier and use much smaller inductors and capacitors.

author: Rapsey
author_rank: Contributor
timestamp: September 30, 2018, 07:18:54 am
content: Yes, I took the ESR or the inductor into account. The reason for using an inductor is that compared to a resistor, it seems to do a much better job of slowing down the capacitor charging while having less ESR, thus getting closer to 12V. The resulting ripple is more like a sine and less like a sawtooth.R1 is indeed dissipating a lot of power in edit 4 but only during the off-portion of the PWM cycle. That way it does not hamper the max voltage at 100% duty cycle but the lower the duty cycle, the more it reduces the average output voltage. This way it's not like 10% duty cycle results in 90% output voltage.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.Do you have any examples of that diode+capacitor rectifier? I thought these things were for AC-to-DC conversion. Not entirely sure what there is to rectify when the wave function has no negative portion...

author: wraper
author_rank: Unknown
timestamp: September 30, 2018, 10:33:00 am
content: Quote from: Rapsey on September 30, 2018, 07:18:54 amResistor + 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.

author: Rapsey
author_rank: Contributor
timestamp: September 30, 2018, 02:55:36 pm
content: Quote from: wraper on September 30, 2018, 10:33:00 amI 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?

author: wraper
author_rank: Unknown
timestamp: September 30, 2018, 02:57:08 pm
content: Quote from: Rapsey on September 30, 2018, 02:55:36 pmIt means pulling to GND as well, not leaving open circuit.

author: Gyro
author_rank: Super Contributor
timestamp: September 30, 2018, 03:44:13 pm
content: It sounds like a really fun discussion but are you sure you're not going a little OTT just to stop a fan whining?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.

author: Rapsey
author_rank: Contributor
timestamp: September 30, 2018, 04:32:13 pm
content: Quote from: wraper on September 30, 2018, 02:57:08 pmSorry, I still don't get it. I thought my last 2 circuits were closed. I only put the GND in because LTSpice requires it.Quote from: Gyro on September 30, 2018, 03:44:13 pmOn the contrary, I'm sure I'm going completely over the top. At this point it's mostly just a fun learning exercise.The PWM doesn't actually adjust to temperature, it's purely software-controlled and it can be configured at will. This is the part cooling fan of a 3D printer, it blows air over the molten filament exiting the nozzle.A common example would be to print the bottom layer with no cooling to improve adhesion to the print bed. After that you would use a middle-of-the-road fan speed depending on the temperature you're printing at and the material you're using. The bottom few dozen layers would still be printed at a higher fan speed to compensate for their proximity to the heated bed. If there is any bridging in your model you would use 100% fan speed for those lines because the faster they cool and become solid, the less hanging there will be. So yea, it varies throughout the print.The bottom line is that pretty much the entire spectrum of the speed control gets used, and that most of the time you're not running at 100% which means the whining noise is always there. It doesn't matter what the duty cycle is, the noise is caused by the PWM frequency so it makes a constant ~500Hz tone at any speed below 100%. Not ideal to have next to your bedroom during a 24h+ long print.

author: wraper
author_rank: Unknown
timestamp: September 30, 2018, 05:01:24 pm
content: Quote from: Rapsey on September 30, 2018, 04:32:13 pmYour 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.

author: Rapsey
author_rank: Contributor
timestamp: September 30, 2018, 07:29:43 pm
content: 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.EDIT: In hindsight, better to use a much smaller capacitor and a much larger resistor. (plot remains the same)

author: Zero999
author_rank: Super Contributor
timestamp: October 01, 2018, 08:10:52 am
content: Quote from: Rapsey on September 30, 2018, 07:29:43 pmTo 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.

author: Rapsey
author_rank: Contributor
timestamp: October 01, 2018, 05:19:16 pm
content: I also came acrossthis articlewhich 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.

author: wraper
author_rank: Unknown
timestamp: October 01, 2018, 06:09:12 pm
content: Quote from: Rapsey on October 01, 2018, 05:19:16 pmThis 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.QuoteNothing interesting. Just normal design contrary something abnormal you tried to do.

author: Zero999
author_rank: Super Contributor
timestamp: October 01, 2018, 10:53:27 pm
content: Quote from: Rapsey on October 01, 2018, 05:19:16 pmIt also requires an extra power wire, which I thought you wanted to avoid.Here's another possibility which will give as lower voltage loss as possible, using only jelly-bean parts. It does this by using a common emitter amplifier on the output and a differential pair input. The simulation says it can go from 0.6V to 11.58V, with a 12V input. If lower loss is required, the Schottky diode can be replaced with an ideal diode MOSFET rectifier circuit.