This tutorial will helps you how the PWM works. You will learn what is PWM, the usage of PWM also how to program a DC Motor with PWM. Some Robots need to control the motor speed for its to work. Just use PWM system and you will get your motor’s speed adjustable…
One of the easiest ways of generating an analog voltage from a digital value is by pulse-width modulation ( PWM ). I PWM a high frequency square wave is generated as a digital output. For example, a port bit continuously swiched on and off at a reltive high frequency. The signal is fed to a low pass filter. The voltage at the otuput of filter is equal to ther Roo Mean Squeare ( RMS ) of the squeare wave signal. The RMS of the square wave signal may then be varied by changing the duty cycle of the signal. A cycle is initiated by a low to high transition of the signal and terminates at the next such transition. During one cycle if the time the signal stays high is equal to the time the signal stays low, then the duty cycle is said to be 50 percent.
Figure 1. Duty Cycle 30 %
The following circuit shows a DAC constructed with PWM. The Program controls the speed of a DC motor by pulse width modulation ( PWM ). Bit P3.0 Drives a switching transistor as shown in the circuit diagram. Motor is swiched on for a period of time, and then off. The fraction of time the motor is on is call the duty cycle. Read the rest of this entry »