Faster PWM

This is an exotic procedure! The standard PWM frequency on the Arduino is around 490 Hz. While it can get most jobs done, it is not really that fast. However, we can change that.

Faster PWM is especially useful when controlling motors. At low PWM, the torque is greatly affected, and it can also create audible noise. The best way to test this is to implement the Controlling speed with PWM recipe from Chapter 5, Motor Control, and increase the PWM frequency.


A note to remember: this might interfere with other functions, such as delay(). We have to be extra careful when this happens.

Getting ready

Following are the ingredients required to implement this recipe:

  • An Arduino board connected to a computer via USB
  • A DC motor
  • A resistor between ...

Get Arduino Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.