Electronic – L298n PWM frequency

dc motorl298pwm

I'm using the L298 Dual H-Bridge to control a pair of 6V @ 1600mA DC motors for a line follower robot. I'm connecting "Enable A" and "Input 1" to Vcc and "Input 2" to uC with PWM.

Which frequency do I have to use on the PWM?

Best Answer

It's not obvious in the ST L298N datasheet. What it does tell you on this is (a) the delay between the PWM input edge and a driver output starting to respond and (b) the rise/fall time of the driver output. These are listed for both edges of both control signals and for the high-side and low-side transistors, so there's quite a pile of data to extract figures from.

What is shows is that (a) is in the range 0.7..3 us and (b) in the range 0.1..0.7 us.

To make most efficient use of the power available to the motor, as little as possible should be wasted during PWM edges. It follows that edges should be as small a percentage of the motor PWM waveform period as possible. This must be traded off against having a high-enough PWM frequency to get good averaging of the waveform from the DC motor.

When I designed in a lot of brushed DC motors on a system, then motor manufacturer recommended a PWM frequency of 2 kHz. This was echoed across the other information we had on it in those pre-internet days. There's the common argument that it should be driven above 20 kHz "so you couldn't hear it" but some basic experiments showed that we simply heard the sub-harmonics. All in all, we found no worth in the 20 kHz argument.

So if you have brushed DC motors then I would recommend a PWM frequency of 2 kHz. This gives you a 500 us PWM waveform period and your worst-case switching duration is 1.4/500 = 0.28 % of the period, which is good.