PWM and DC Motors

I’m testing DC motors, PWM and PID algoritms in a system. And i noticed that the PWM on Arduino (or maybe on any PWM) is creating instability for the motor. If you look at the attached file you will se two graphs:

  • On top: DC motor feed with 3 x 1,2V AA battery direct current.
  • Bottom: Same DC motor fed with Arduino uno PWM through a LM… H-bridge.
    None of the runs are affected by PID control.

The Y-scale is dots per second on a 32-bit/turn decoder. Both examples run aprox. 24 dot/sec.
Both graphs are - same motor -same encoder.

My Qs are:
Is there a posibiity that this can be optimized via PWM (clock) settings on Arduino?
Or do i need to design a RC filter to take car of this?

Best Regards!

Svante

PWM problem.pdf (91.2 KB)