Sie sind auf Seite 1von 5

Digital Systems

(3rd Bachelor)

Laboratory session 2

PWM Control
(Academic year 2012-2013)

Luc Bienstman, Wei Wei

The target of this lab is to understand PWM modulation and to design the digital circuitry to generate useful PWM signals.

The PWM generator


Pulse-width modulation (PWM) is a commonly used technique for controlling power to electrical devices. In digital circuitry it's simple to generate a PWM signal. By controlling the pulse width it's possible to control the average value of the PWM signal. A PWM signal - for instance - can be used to control the speed of a DC motor. The DC motor will act as a kind of filter and the motor will receive an average voltage. This voltage will control the speed. The larger the pulse width, the larger the average value and the higher the motor speed. Via a PWM signal it's also possible to generate a sine wave or a trapezoidal wave. The PWM will be modulated with a sine or a trapezoidal in such a way that the average value of the PWM will be that sine or trapezoidal voltage. Some type of motors do require a sine or a trapezoidal to control their speed. The modulation is quite simple. One common way is to start from a sawtooth at a given fixed frequency. This so-called carrier Ec will generate the frequency of the resulting PWM. At every moment the carrier Ec is compared with the modulating voltage Er (here : the sine wave). When the modulating voltage is higher than the carrier, the outputs PWM will be high, else it will be low.

Luc Bienstman, Wei Wei

How to get a sine wave reference? The output of an 8 -bit counter can be used as address for an 8 -bit lookup table containing the sine wave. This lookup table can be implemented in a ROM. Project --- > New Source --- > IP Core ---> Memories -- > Ram & Rom ---> Block Memory generator ---> Single Port Rom (8 bit wide, 256 words deep). Also you can add a text file to be connected to the ROM (--- > load init file). This file should contain the sine wave (values between 0 up to 255). The format for this file should have the extension name .coe (you can find it on toledo). The value 0 corresponds to the most "negative" value of the sine, the value 128 is the zero crossing, the value 255 is the most positive value of the sine wave.

Assignment 1:
Generate a simple PWM signal with changeable duty cycle.The period of the PWM is fixed, an UP switch should be used to increase the pulsewidth, a DOWN switch should be used to decrease the width.

Assignment 2:
Generate a sine modulated PWM signal. Pushing the UP switch should increase the sine frequency, pushing the DOWN switch should decrease it. Apply an external RC filter to observe the sine wave inside the PWM.

Luc Bienstman, Wei Wei

The H-Bridge.
In order to easily control a motor running in both directions the H Bridge is used.

Figure 1 H Bridge In the figure 1, you can see when A1 and A2 are closed the motor is running clockwise and when B1 and B2 are closed, the motor is running counter clockwise. When both A1-A2 and B1-B2 have identical ON-times, the motor is standing still. When A1-A2 is more of the time active than B1-B2, then the motor will run clockwise. Else when B1-B2 is more active the motor will run anti-clockwise. The main advantage of PWM / H-Bridge system is that power loss in the switching devices is very low. When a switch is off there is practically no current, and when it is on, there is almost no voltage drop across the switch. That is why it is widely used to control motors. In theory, there are two PWM signals needed for the H Bridge and they should be exactly inverted from each other (see in Fig2). The switch A1/A2 is controlled by PWM_A, while the switch B1/B2 is controlled by PWM_B.

Figure 2 PWM signal for H Bridge Luc Bienstman, Wei Wei

However, in reality there is always a problem to get this system working well. Although both signals can be made to not overlap, in reality the delay of the switches can make them to be active at the same time : both switch A1 and switch B1 are on at the same time ! This generates a short circuit between Vcc and Ground, and the excessive current will kill the switches. To be avoided !!!

Figure 3 Short circuit when controlling the H Bridge Hence a minimum dead time is required to prevent this short circuit behavior. With appropriate dead time, you will never meet this short circuit situation. A switch going ON has to wait for a while till the other switch is really OFF.

Figure 4 PWM signal with dead time

Assignment 3:
Generate a PWM signal with programmable dead time for the motor. Starting from the main PWM signal the control signals A and B should be derived. Use I/O pins on the board (Expansion Connectors in the datasheet ex: B4 and A4) and output to an oscilloscope. The PWM period and pulse width might be constant, but the dead time should be adjustable by the UP and down switches.

Luc Bienstman, Wei Wei

Das könnte Ihnen auch gefallen