Skip to main content

Pulse Width Modulation

PWM or Pulse Width Modulation is a unidirectional communication method that allows the communication of a single analog value between devices. It acts as a digital pulse where the width of the pulse is varied between no pulse all the way to a continuous pulse at a given frequency.

Common FRC Uses

PWM is commonly used in FRC to control motor controllers and servos. The roboRIO outputs a PWM signal to the motor controller, which then interprets the width of the pulse to determine the speed and direction of the motor. A wider pulse corresponds to a higher speed, while a narrower pulse corresponds to a lower speed.

It can also be used as an input signal. On our robots, we commonly use PWM absolute encoders for our swerve drive train to determine the angle of each wheel module on boot. The encoder outputs a PWM signal to the roboRIO, which then interprets the width of the pulse to determine the angle of the wheel.