What is PWM?
Typically variable voltage is generated by analog circuits. Digital circuits generate only HIGH
(3.3V) or LOW
(0V) voltage. Digital microprocessors/microcontrollers cannot produce analog voltages themselves. They need a Digital to
Analog Convertor (DAC). We have seen in the previous chapter that BeagleBone has a built-in ADC that converts captured analog voltage to a value. This raises our hope that BeagleBone might have a DAC to generate analog output voltage. But this is not true. Instead of providing a DAC, it uses a mechanism called PWM, which achieves similar results. Some of the GPIO digital pins are driven by BeagleBone's PWM subsystem. It can generate any voltage inside the 0V to 3.3V range on these pins.
Suppose that we have connected an analog output device DC motor to one of the GPIO pins on BeagleBone (with capacitor filter). The speed of a DC motor changes proportionally to the voltage applied. The more voltage applied, the higher the motor speed. The connected...