Electrolytic Capacitor to Smooth PWM


I know I can smooth the PWM using an electrolytic capacitor, however I'm also using an H-bridge, and the capacitors are polarized. Can I still simply hook the capacitor up in line with my motor even though I'm reversing the direction/polarity of current? I tested it, and the capacitor gets rid of the motor noise in both directions. I just want to make sure that I'm not going to blow up the cap.

If there's more circuitry that I need to wire the cap in line with my motor which is switching polarity, can you post a link?


Yes, that will destroy the capacitor.

How are you wiring it? In series with the motor or in parallel?

Is the motor noise you are trying to suppress electrical or mechanical?

If the capacitor is in series I suspect that all you are doing is reducing the current.


It’s a 2200uF cap in parallel.

The motor noise is electrical. I’m using pwm to control the motor speed of a 12v 1.5a motor, and the noise I’m getting from that is really loud.

I was thinking that maybe since it’s such a large cap that because it’s charging and discharging so rapidly with the pwm that it wouldn’t necessarily matter which direction it was in? Like I said, it gets rid of the motor noise (buzzing) for both directions when I place the cap in parallel with the motor.

OK the capacitor is in parallel. The H-bridge reverses the polarity to reverse the motor and the electrolytic cap won’t like it! Putting a big capacitor directly on the output of the H-bridge could also damage the H-bridge due to high peak currents.

You say the noise the motor is generating is electrical but also it is loud. I think you are confusing terms. If the noise is coming from the motor itself it is mechanical, caused by vibrations.

That is a small lightweight motor and you are driving it with a 500 Hz PWM signal which is an audible frequency, something just above an A on the musical scale.


A snubber circuit will reduce electrical noise. It won't do much for the mechanical noise. The best solution for that is usually to increase the PWM frequency.

I'm considering changing the frequency, I'm just a little worried about messing around with the clock since I am using timing functions.

Never connect an electrolytic capacitor backwards unless it is a non-polarized one.

If you do this it will explode spraying scalding steam and shreds of aluminium and
electrolyte everywhere.

Which Arduino and which pins are you using for PWM?

I just went ahead and changed the frequency using this PWM Frequency Library, and with the Uno I'm on pins 9 & 10 it looks like it's okay to change the frequency and not disrupt the timing functions like delay and millis. I ended turning the frequency up pretty high, something around 20,000hz

16kHz is often used as its beyond the range of engineer’s hearing (but not
their children or pets!). 20kHz is even better, so long as the switching devices aren’t
getting too lossy - at 20kHz they need to switch every 25us on average, so switching
time had better be < 1us to avoid heavy losses.

Do you know how fast your H-bridge is - what is it?

It's the seeedstudio motor driver shield, so it's using the L298 H-Bridge.

It's the seeedstudio motor driver shield, so it's using the L298 H-Bridge.

So look in the datasheet for the L298 to see how fast it is! Learning to
understand datasheets is very valuable skill, and they are, mostly, well
structured and thorough.

The only thing I'm unsure of right now is what you mean by lossy? What is a heavy loss/what am I loosing, and can it damage the board?

The max frequency for the 298 is 40KHz

Despite MOSFETS coming from high-level alien/magic technology, they still have a finite switching time. They don't instantly turn on or off. It takes time for the switch to change between fully-on and fully-off. For lower frequencies, this is not important: the switching time might be 0.1% of the total time. At high frequencies, it becomes very important.

You might expect that there is a high enough frequency when it is always switching and never quite reaching full saturation before the input changes and starts it going back the other way. In that case, your loss is 100% and there's a lot of power heating up the MOSFET, trying to expel the magic smoke.