Pulse Width Modulation (PWM) IO

Attempts to encode analog data into a digital signal by turning it all the way on or off with a duty cycle that matches the analog value. Typically, the freqency of the digital signal is kept constant, and the amount of time spent on or off (the duty cycle) is changed. Higher frequencies make it easier to average out the signal, but increase the costs associated with switching on and off. Lower frequencies are more efficient, but harder to smooth out.

The main advantage of PWM is that it keeps the switch (transistor, mosfet, etc...) in states were it drops little current. Linear drive, where the switch is held partly on or off, causes the switch itself to act as a resistive element or load, dropping the power not being sent on to the load as heat. When fully on or fully off, the switch is dropping no current. Only in the transition from one state to the other is there a load on the switch.

Talking motors?

Consider using the motor windings as a crude speaker. If the PWM is heard as an audible whine then it may be possible to produce an audio warning through the windings in cases of user abuse.

see also:

Questions

Interested: