What is a pulse width modulation (PWM)

A pulse width modulation (PWM)

A pulse width modulation (PWM) using a microprocessor to a digital output of the analog circuits for controlling a very effective technique, widely used in many fields from the measurement, control and communication to the power transformed.

Analog circuit

Value of the analog signal can be varied continuously, time and magnitude of the resolution in both. 9V battery is a kind of analog devices, because its output voltage is not exactly equal to 9V, but varies with time, and can take any real value. Similarly, a current from the battery is not within a defined set of possible values. The difference between analog and digital signals is that the latter values ​​only from a set of possible values ​​within the pre-determined, in this example, the value set {0V, 5V} in.

Analog voltages and currents can be used for controlling, such as controlling the volume of the car radio. In a simple analog radio, a knob is connected to a variable resistor. While tightening the knob, the resistance value becomes larger or smaller; current flowing through the resistor also increases or decreases, thereby changing the current driving the speakers, sound volume becomes correspondingly larger or smaller. Like the radio, the analog output circuit is linearly proportional to the input.

Although analog control may seem intuitive and simple, but it is not always economically attractive or feasible. For one thing, the analog circuitry is easy to drift over time, making it difficult to adjust. Precision analog circuits can solve this problem may be very large, heavy (such as older home stereo equipment), and expensive. Analog circuits can also get very hot, the power dissipated is proportional to the product of the voltage across the current working element. Analog circuitry may be very sensitive to noise, or any noise disturbance necessarily changes the magnitude of the current value.

digital control

By digitally controlling an analog circuit, it can significantly reduce the cost and power consumption. In addition, many DSP and microcontroller already contains a PWM controller on the chip, which makes the digital control becomes easier.

Briefly, PWM is a method for analog signal level digitally encoded. By using high-resolution counters, the duty cycle of the square wave is modulated to a specific level of the analog signal is encoded. The PWM signal is still digital, because in any given moment, the full DC supply is either fully (the ON), or completely (OFF). Repeating a pulse sequence is one kind of voltage or current source through (ON) or off (OFF) is applied to the analog load. When through which the DC supply is applied to the load when the off-time, i.e. when the supply is switched off. Sufficient bandwidth, any analog value can be encoded with PWM.
Here Insert Picture Description
Figure 1 shows three different PWM signal. Figure 1a is a 10% duty cycle PWM output, i.e., the signal period, 10% of the time on the remaining 90% of the time off. Figures 1b and 1c show respectively a duty ratio of 50% and 90% PWM output. The three PWM outputs encode the intensity is 10% of full scale, three different analog signal values of 50% and 90%. For example, assume that the power supply of 9V, 10% duty cycle, the corresponding amplitude is a 0.9V analog signal.
Here Insert Picture Description
FIG 2 is a PWM driving can use a simple circuit. FIG 9V battery used to power to an incandescent lamp. If connecting the battery and the lamp switch is closed 50ms, 9V lamp power obtained during that interval. If a 50ms will switch the lamp power will be obtained next 0V disconnected. If this is repeated in a second process 10 times, the lamp will be lit as connected to a 4.5V battery (50% 9V) of the same. In this case, the duty ratio is 50%, modulation frequency is 10Hz.

Most of the load (both inductive load or capacitive load) required modulation frequency higher than 10Hz. Imagine if the lamp is turned off and then five seconds to five seconds, then on again, off again ....... Still 50% duty cycle, but the bulb lighting head 5 seconds, 5 seconds, for the next off. Order for the bulb effect 4.5V supply voltage, the load-off cycle of the switch status change response time must be short compared. To achieve dimming lights (but remains lit) effect, the modulation frequency must be increased. In other applications of PWM same requirement. Typically the modulation frequency of between 1kHz to 200kHz.

Hardware controller

Many microcontrollers include the PWM controller. For example, Microchip's PIC16C67 includes two PWM controllers, each of which can be selected and on-time period. The duty cycle is the period of the ON time ratio; reciprocal of the period of the modulation frequency. Before performing PWM operation, the microprocessor accomplish the following in the software:

  • Arrangement provides modulated square wave cycle on-chip timer / counter

  • In the PWM control register set the on-time

  • Setting PWM output direction, this output is a general-purpose I / O pins

  • Start timer

  • Enabling the PWM controller

Although specific PWM controllers differ in the programming details, but they are usually the same basic idea.

Communication and Control

One advantage is the PWM signal from the processor to the controlled system is in digital form, without the need for digital to analog conversion. By keeping the signal in digital form may be noise to a minimum. Only noise is strong enough to change when a logic 1 or a logic 0 to a logic 0 to a logic 1, can also have an impact on the digital signal.

Increased noise immunity is yet a further advantage with respect to the analog PWM control, and this is sometimes the reason PWM communications. Switching from an analog PWM signal can greatly extend the communication distance. At the receiving end, a suitable RC or LC network can remove the high frequency square wave and a modulation signal into analog form.

PWM is widely used in a variety of systems. As a specific example, let us examine one kind of the PWM-controlled brake. Briefly, the brake is a device that clamps of something. In many brakes to control the size of the analog input signal clamping pressure (or braking power). The larger the applied voltage or current to the brake, the brake pressure generated by the greater.

Output of the PWM controller may be connected to a switch between the supply and the brake. To produce more stopping power, just to increase the duty cycle of the PWM output by software on it. If the braking pressure is a certain size, it is necessary to determine the mathematical relationship between duty cycle and pressure measurements (resulting equation or lookup table may be used to control the converted temperature, surface wear, etc.).

For example, suppose you want to pressure on the brake set at 100psi, the software will do a reverse lookup to determine the duty cycle to produce this amount of pressure should be. Then the PWM duty cycle is set to the new value, the brake would respond accordingly. If there is a sensor system, the duty cycle may be adjusted by the closed-loop control until the desired pressure is precisely achieved.

In short, PWM is economical, space-saving, anti-noise performance is an effective technique worthy of the majority of design engineers for use in many applications.

Published 41 original articles · won praise 61 · Views 140,000 +

Guess you like

Origin blog.csdn.net/qq_44710568/article/details/105122064