Page 808 - Mechatronics with Experiments
P. 808

794   MECHATRONICS
                       11.11 EXPERIMENT 11: DC MOTOR SPEED CONTROL
                                USING PWM

                              Objectives
                              To control the speed of a DC motor using a PWM signal from a PIC 18F452 microcontroller
                              in conjunction with an H-bridge amplifier circuit.

                              Components

                              Item                      Quantity   Part No.       Supplier
                              DC Motor                     1       154915
                              Optoisolator                 1       114083         www.jameco.com
                              Potentiometer (200 Ω)        1       181972
                              IRF510 (MOSFET)              2       06F8238        www.newark.com
                              IRF9520 (MOSFET)             2       07B1521        www.newark.com
                              1N4003 Diode                 4       76970          www.jameco.com
                              PIC Demo Board/connectors  1 set     DM163022 or    www.microchipdirect.com
                                                                     DV164006



                              Theory
                              Pulse Width Modulation      A PWM signal has two variables that must be decided
                              by the control software:
                                1. PWM signal carrier (or base) frequency,
                                2. PWM signal duty cycle.
                                   The PWM frequency is generally a constant frequency in the kHz range. The duty
                              cycle is the value decided in real-time to indicate the equivalent analog value of the signal.
                                   This is accomplished by generating an ON-OFF signal of a high frequency, and then
                              varying the percentage of time that the signal is in the ON state versus the OFF state. This
                              is called varying the duty cycle. The average value of the signal is equivalent to an analog
                              signal, provided that the PWM switching frequency is much higher than the bandwidth
                              frequency of the electromechanical system. For example, assume that a voltage signal
                              between 2.5–3.0 V is required to drive a motor, while the supply voltage is a fixed 5 V.
                              The PWM signal will consist of a voltage that varies at a high frequency (i.e., 1 kHz)
                              between 0–5 V. If, in every time period (1 ms), the voltage level is kept high (5 V) for
                              50% of the period, and low (0 V) for the remaining 50%, then the average voltage seen at
                              the output will be 2.5 V. In this case, the duty cycle is 50%. Similarly, if a high voltage is
                              maintained for 60% of the period, and low for the remaining 40%, then the average voltage is
                              0.6 × 5V = 3V.
                                   Care must be taken to ensure that PWM frequencies are kept reasonably high com-
                              pared to the bandwidth of the control system, since a low frequency PWM signal may
                              actually be seen as varying, and not continuous, voltages, especially for loads with a
                              smaller electrical time constant. Typical PWM frequencies are of the order of a few kHz.
                                   The PWM signal format is used in two different contexts:
                                1. Power transistor circuits, where the transistors are operated in all ON and all OFF
                                   alternating states, which is called the PWM mode. In this mode of operation, as
                                   opposed to the linear mode of operation where the transistor is partially turned
                                   ON/OFF, the efficiency of the power transistors is significantly improved. In high
   803   804   805   806   807   808   809   810   811   812   813