PWM and motor noise filtering

I'm working on PWM circuits to drive a small pump motor in our river models ( The motors are brushed 12V, and are sealed so we can't add caps or anything at the motor itself.

The nice square wave here is what I get driving the motor with a Critical Velocity SPD215-D unit: Critical Velocity - 15 Amp DIGITAL High Frequency PWM Motor Speed Controller P/N: SPD-315-D . Works great, but is expensive and way overcapacity for us -- the pump needs 4amps max.

So I'm working on simple MOSFET circuits driven by Arduino native PWM.

This is the noisy scope trace. My questions:

  1. How much does this noise really matter? Clearly it introduced some inefficiency, but other than than, does it matter? I should note that the noise is all from the motor; driving a 12V incandescent bulb, for example, the output is a nice perfect square wave.

  2. What causes the wave to hop up to a plateau at about 4v and hang there before sharply jumping to the full 12V?

  3. Are all the little spikes brush noise?

  4. If this stuff matters somehow, how can I filter it. I've tried to figure out the Critical Velocity board's circuits, but without tearing it apart I lose the traces; seems to involve a small transistor, though.

A capacitor across the output does smooth things out, but this puts some slope in the rise/fall transitions, which overheats the MOSFET.

Many thanks for any insight.


I can't answer any of your questions, but, I do know that knowing WHICH MOSFET you are using will be an important piece of information.

By the way, this isn't a software issue.

I'm using an IRLI520G; datasheet here:

Paralleling two of these works very nicely, almost no heating at 3.6 amps out.

Here's the circuit.


I don’t think you’re driving your MOSFET’s powerfully enough. I think you’re seeing Miller capacitance effects in which it takes extra charge to get over the “plateau” of the MOSFET. The 10k resistor in series with the gate forms an RC circuit (of sorts) with the MOSFET gate and that limits how quickly the MOSFET gate can take on charge to fully turn on. Now, the Arduino itself isn’t going to be able to supply very much charge to begin with (I’d stay <20mA on a digital output).

Using the total gate charge of your MOSFET as a rough approximation (12nC) your 10k resistor forms an RC circuit with time constant t=RC=120us. So it would take about 0.5ms for 5 time constants to go by and “fully charge” the MOSFET.

I think you can safely reduce your 10k resistors to 1k or even 470ohms and see a marked improvement in the length of this plateau. At 470ohms the peak output current of the Arduino I/O pin will be about 11mA.

How fast is your PWM waveform? You don’t want to go too quickly as you will just increase the inefficiency.

The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

Thanks RuggedCircuits! I hadn't thought of that. Mainly because I'm mostly a geoscientist :slight_smile: and not much of an E-designer . Makes sense though, we'll work on that. I got this circuit (and the high value resistor) from the forums here, and though it's been discussed a lot I think the community consensus could use some improvement, and you've done that--will do some testing see what happens.

PWM freq is the native Arduino, ~490Hz, which gives the pump a nasty whine; wish I could easily make that higher or lower and thus inaudible, but that one's been discussed here a lot and I haven't seen a good answer.

Please send me a PM at, thanks.

RuggedCircuits, I forgot to mention--maybe you missed it in my initial post, but my circuit drives an incandescent bulb (auto headlamp, don't know amperage) with a nice perfect square wave; no noise or distortion. Does your capacitance idea still hold true?

The headlamp data is interesting, and unexpected. I am guessing it will be about 1A-2A so comparable to your pump. I did miss this in your original post. That suggests that the problem could be (partially) due to how you physically have the grounds connected together. On your schematic diagram you just use the generic ground symbol but the actual physical routing of wires makes a big difference when "large" currents flow in inductive loops. Basically, the ground of the high-power loop (i.e., the source terminal of the MOSFET) should run directly back to the power supply and not share any wiring with the Arduino circuit, or the voltage regulator.

The PWM frequency of 490Hz suggests the timescale on your "dirty" oscilloscope trace is 500us/div hence the "plateau" lasts for about 1ms. That's a bit long for my proposed explanation of how long it should take to turn on the MOSFET. That coupled with your lamp data suggests there's more going on, perhaps the grounding issue I described above.

You can change the PWM frequency but it depends specifically on which pin you are using for PWM, hence which one of the on-chip timers. If you let us know this detail perhaps we can suggest a fix for increasing the frequency (though this is NOT a good idea until the whole "plateau" issue is taken care of else the MOSFET can dangerously overheat).

The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons

MOSFET ground is directly connected to the power supply, and no wiring is shared per your advice.

I'll run more tests and post the results, thanks.

For fast PWM switching of power MOSFETs the gate resistance should be more of the order of 1 to 50 ohms, certainly not 10k, that’s a recipe for burning them out. You need a very low impedance driver circuit to charge and discharge the gate capacitance. Its not unusual to source/sink amps into a gate on the switching transients.

There are many circuits or chips that can do that, but a Arduino output can only deliver upto 40mA which is usually insufficient, meaning the switching is very slow and the MOSFET dissipates large amounts of power in the linear region (where it is neither on nor off). The faster the PWM frequency the more this matters.

As a run of thumb you want the switching time to be < 1% of the cycle time… you appear to have 50%. Try replacing the 10k resistor with 180 ohms for now, but ideally you want something like a MIC4422 or similar driver buffer with appropriate decoupling to properly switch the gate.

I notice you are using a MOSFET with an Ron of 0.27 ohms. This is underspeced, for a 4A load I’d suggest an Ron of 0.020 ohms or less - currently you are wasting over 4W in the MOSFET which requires a big heatsink. Modern n-channel devices for low voltage go down to 3 milliohms Ron or so!

Also it is possible to change the PWM frequency on the Arduino but this requires delving into the datasheet for the ATmega328 or googling around. There are 3 different counter timers on the arduino and each controls 2 of the PWM pins. One of the timers is used for millis() though and its not good to alter that one!

MarkT; thanks. Wow this is more complicated than I thought. I understand the Ron thing now.

On the MIC4422, it appears it can switch 9A–if I only need max of 4A for my motor, would something like this alone work? We need low parts count and simplicity–this is an educational product. And efficiency is pretty low on the list (most of the time the motor is run a very low speeds, pulling <1.5 A; it only pulls 3.5A during brief “mother of all floods” demos!).

I also want the circuit to be as simple as possible because part of the learning experience can be hacking/understanding the circuit driving the pumps (for engineering students who study pumping power, etc., though many disciplines, from physics to river ecology, use our models).

Also of course the parts should all be as common, accessible, and open source as possible (hence my use of Arduino.)

Would really like to simply drive a single MOSFET from Arduino output, do you think that’s impractical? Many thanks, this really helped my understanding :slight_smile:

BTW at 3.6A out the MOSFET barely gets above room temp with a small heat sink–maybe its Ron is below spec? Also the freq is only 500Hz, probably that helps reduce heating?

OK, after some testing. Here’s the revised circuit, comments really appreciated ! :slight_smile: :

Note this MOSFET is different; datasheet here: --Ron is very low (0.008 ohms if I remember right).

Traces are below; I drove a motor and also a 50W halogen bulb for comparison. On none of these did the MOSFET heat up above 90F or so (with a minimal heat sink).


–lowering Arduino>gate resistor to 220 ohms had no effect on the halfway plateau before full voltage you see.
–wave is perfectly square driving bulb, (no “halfway plateau”) so has to be the motor, right?
–MOSFET barely got warm driving “dirty” signal.
–Also MOSFET didn’t heat with motor and 100uf cap across output, which made on/off transients quite a bit longer.

Frequency is native Arduino ~500Hz.

What do you think? Can we use a simple circuit like this to drive our river model pumps, which run 90% of the time in <2 amp range and rarely up to 4 amps, if we don’t care too much about efficiency?

Here's one of the best overviews on this topic I've seen, a PDF from Microchip:

Something else that may help

I experimentd with this ages ago and as far as making things quieter goes, upping the pwm frequency helps a lot, but I had to use a high voltage (10V) to get the mosfets to switch cleanly.

Surprise, it turns out this has to do with the MOSFET turning OFF, not ON.

Grumpy Mike has authorized me to summarize a PM on this:

Hi Steve,
I am assuming that the waveforms show the voltage across the FET rather that the voltage across the motor as that voltage would be difficult to measure. In which case the problem here is that you are switching an inductive load. This is why you don't see it when you have a resistive load or a capacitor across the motor (you are changing the power factor). What happens with that circuit is that when the FET turns on you are connecting one end of the motor to ground and the current flows. However when you turn off the FET you in effect "let the end of the motor go", in other words it is not connected to anything. Now the motor acts as a generator as the magnetic field collapses. This is what you are seeing as a plato. I don't think it is anything to do with the drive to the FET.
What you probably need (what I would try) is to drive the motor with a half H-bridge circuit. In this way when the motor is turned off in the PWM cycle it is actually being connected to the motor supply positive, like the other motor connection. This will hard drive the PWM and cause a bit of fly wheel breaking on the off cycles.

The noise on that last waveform on the plato is probably caused by voltage generated by the motor brushes.

You could also try a reverse biased diode across the motor as a half way house between what you have and a half H-bridge.

And another note from him:

Hi Steve,
A diode can only short out a reverse voltage, it is passive. An inductive load on AC has the voltage and current out of phase, that is maximum current doesn't occur at the same time as maximum voltage. This lag is called the power factor and it can make oscilloscope traces hard to read. What is happening when the FET is off is that your scope lead is in effect disconnected, or floating. This can look like odd intermediate values. If you put a resistive load across your scope, say a 1K resistor then you will see a better representation of what is happening. This is often a problem when looking at multiplexed LEDs, the waveforms don't match what you think.

Thanks Mike. Lied to by my scope :slight_smile:

Some of you will want to note I do have a Fairchild P FFPF10UP20S, datasheet: Intelligent Power and Sensing Technologies | onsemi as a flyback or flywheel or whatever you call it across the motor.