Pulse-Width Modulation (PWM)

Implement algorithms for controlling electrical power using pulse-width modulation (PWM)

Pulse-width modulation (PWM) is a common digital technique to control electrical power to a load using square wave pulses at some determined duty cycle. Proper control of pulse-width modulation ensures efficiency and accuracy in applications such as brushless motor control, solar power inverter control, and voltage regulation. A common challenge with these applications is evaluating the correctness of the control architecture early—before committing to the expense of hardware testing.

PWM Workflow

An efficient process for developing and implementing accurate algorithms for regulating pulse-width modulation involves:

  • Designing and testing PWM control algorithms in a simulation environment
  • Generating ANSI C code for real-time testing and implementation
  • Integrating pulse-width modulation control algorithms into an existing code base

To learn more about how PWM is implemented with Simulink ®, see the video Speed Control of a DC Motor Using PWM (7:27).

PWM Support on Arduino, Raspberry Pi, and BeagleBone

Cost-effective hardware like Arduino®, Raspberry Pi™, and BeagleBone supports pulse-width modulation. These boards can provide PWM signals over specified pins so you can easily build PWM controllers such as those used for motors or fans.

To implement PWM controllers on these boards with Simulink, you can download Support Packages for Arduino, Raspberry Pi, or BeagleBone.

See also: Simscape Power Systems, Simscape Electronics, Simulink Control Design, Embedded Coder, motor control, pulse-width modulation videos