Skip to content

Latest commit

 

History

History
35 lines (32 loc) · 2.41 KB

File metadata and controls

35 lines (32 loc) · 2.41 KB

PWM: digital dither for efficient (but noisy) analog control

Pulse density modulation is one alternative to Pulse Width Modulation,
with the advantage of being more easily lossless,
since presence or absense of fixed width pulses at fixed intervals is more robustly detected,
but for driving typical relatively slowly reponding loads,
PWM offers finer granularity at lower implementation cost, and consequently gets used for

  • hobby servos
  • illumination control
  • motor control
    • many think of PWM motor control in terms of speed, but PWM more directly controls DC motor torque.
  • class D audio amplifiers

Many low cost microcontrollers implement PWM in firmware,
but both STM32 and ESP32 support PWM with full hardware control.
Consequently, instead of using the generic Arduino PWM library,
this implementation will investigate so-called Fast PWM, which exploits that hardware.
As noted, these libraries have similar functions, simplifying porting among platforms:

FWIW, both SimpleTimer in Arduino Library Manager seem totally different and incompatible;  go figure..

16 Mar 2023:  working STM32 hardware PWM_FullConfiguration

drives Blue Pill LED, lacks predistortion controls, should be ported to Blue_ASCII_PWM_LED