14

Click here to load reader

ACIM_PIC18Fxx31_BW

Embed Size (px)

Citation preview

Page 1: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 1

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 1

AC Induction Motor (ACIM)ControlUsing

PIC18Fxx31

Welcome to the Microchip Web Seminar on AC Induction Motor Control using the

PIC18Fxx31. My name is Jon Burroughs, I am the AMAD applications engineer for

the PIC18Fxx31.

This Web Seminar is a summary of the application note �VF Motor Control of AC

Induction Motors Using the PIC18F4431�, which will soon be available on the

Microchip website.

Page 2: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 2

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 2

Agenda� Overview of motor control solutions from Microchip� PIC18Fxx31 peripherals for motor control� ACIM motor control using PIC18Fxx31

� Open V/F loop control� Closed loop control using Quadrature encoder

� Comparison to other PICmicro® microcontrollersolutions

� Recommended resources

This presentation is divided into the following topics:

�First, a brief overview of motor control solutions from Microchip,

�Second, a summary of the PIC18F4431 peripherals for motor control.

�Next, the main body of the presentation will be a discussion of ACIM control using

the PIC18Fxx31 in standard open loop V/F control and in closed loop with an optical

encoder for speed feedback.

�Finally, we will compare ACIM control solutions implemented with several other

PIC® microcontrollers.

�Because this presentation is relatively short, additional resources for learning more are

recommended at the end of the presentation.

Page 3: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 3

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 3

Motor Control from Microchip� Complete solutions for Stepper, Brushed DC,

BLDC, ACIM & SR motors utilizing PIC16, PIC18 &dsPIC devices

� Microchip Opamps & International Rectifier drivers� Provide everything a design engineer needs:

� Low-risk product development� Lower total system cost� Faster time to market� Outstanding technical support� Dependable delivery & quality

� Visit us at www.microchip.com/motor

Microchip Technology offers a broad product portfolio that provides a complete

system solution for your brushed DC motor, variable speed brushless DC motor, AC

induction motor, switched reluctance motor and stepper motor applications. This

includes the microcontroller with firmware to drive the motor, analog op amps and

comparators for sensors or feedback and power electronics from Microchip and

International Rectifier. With our sophisticated development systems and technical

documentation, Microchip makes it easy for designers of all experience levels to

complete a high performance electronic motor control design quickly and cost

effectively. Microchip provides everything a motor control design engineer needs:

low-risk product development, lower total system cost, faster time to market,

outstanding technical support and dependable delivery and quality. For access to

Microchip�s complete motor control design resources, visit the Motor Control

Design Center at www.microchip.com/motor.

Page 4: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 4

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 4

PIC18Fxx31 Overview

Timer0 Timer1 Timer2 Timer5

Data EEPROM256 Bytes

CCP(2K)

PBORLVD

14-Bit Power Control PWM

Motion Feedback- 3 input captures- Quadrature Encoder

Fault Interface

Flash Program Memory

(16KB)

RAM(768B)

SSP 200 Ksps10-Bit ADC

PIC18Fxx31 family of microcontrollers features 4 parts, having 28 pin and 40 pin packages with8Kbytes and 16Kbytes of program memory. The major peripherals that are useful in motorcontrol are indicated above in the darker blue blocks. Power Control PWM, Motion FeedbackModule, Fault Inputs, and High speed Analog-to-Digital Converter, make the family well-suitedto a variety of motor control tasks.Main features of PCPWM include:� Up to 8 channels output or 4 pairs complimentary outputs� Up to 14 bits PWM of resolution� Center aligned or edge aligned PWM operation.�Programmable dead band control for complementary outputs� Hardware Fault interface pins for fast PWM shut down in the event of fault.Main features of High speed ADC include:� Up to 9 channels input, with 2 Sample and Hold circuits� Simultaneous and sequential conversion capabilities� 4 word deep FIFO with flexible interrupt settingsMain features of Motion Feedback Module include:�QEI for measuring, position velocity and direction of rotation�3 Input Capture pins with multiple modes for pulse width and frequency measurements.

In this presentation we�ll examine how to use the PCPWM, Fault Inputs, and Motion FeedbackModule to control a 3-phase induction motor.

Page 5: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 5

Drive TopologyVDC+

VDC-

H1

L1

H2

L2

H3

L3

Phase A

Phase B

Phase C

As you may already know, control of a 3-phase AC induction motor requires pulse-

width modulated control of the six switches of a 3-phase inverter bridge connected to

the 3 legs of the motor�s windings. The six switches form 3 pairs of �half-bridges�,

which can be used to connect each leg to the positive or the negative high-voltage DC

bus. As can be seen from the figure, two switches on the same �half-bridge� must

never be on simultaneously, otherwise the positive and negative buses will be shorted

together. When one switch is on, the other must be off; thus they are driven as

complementary pairs. It should also be noted that the switching devices used in the

half-bridge (in this case, IGBT�s) often require more time to turn off than to turn on.

For this reason, a minimum dead-time must be inserted between the off and on time of

complimentary channels.

The PCPWM is well-suited for this application because it can provide up to four pairs

of complimentary outputs with programmable dead-time.

Page 6: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 6

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 6

3 Phase Action

60 120 180 240 300 3600

R Y B

-ΦY

120°

120°120°

+ΦY

+ΦB

-ΦB

+ΦR -ΦR

To drive the AC induction motor, the duty cycles of the PWM outputs to the 3-

phase bridge are modulated to synthesize sinusoidal waveforms (three-phase AC)

across the 3 motor windings, as depicted in this slide.

When 3-phase AC is applied to the three stator windings (sinusoidal currents, equal

in amplitude and frequency, but offset from each other by 120 degrees) the current

in the stator windings generates a rotating magnetic field (shown here as the rotating

vectors on the x-axis.)

This rotating field induces electromotive force in the rotor, which in turn produces a

magnetic field in the rotor that attempts to align with the rotating magnetic field in

the stator. This causes the rotor to rotate. See the ap notes listed in the resource

section at the end of this presentation, for a more detailed discussion of motor

construction which makes this happen..

Page 7: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 7

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 7

Open Loop Control

/MCLR 1 28

2

3

4

5

6

7

8

9

11

12

13

14

10

27

26

25

24

23

22

21

20

18

17

15

19

16

AN0

AN1

AN2

AN3

AN4

AVdd

AVss

OSC1

OSC2

RC0

/FLTA/CCP2

/FLTB/CCP1

RC3/INT0

PWM2

PWM1

PWM0

Vdd

Vss

RC7/RX/DT

RC6/TX/CK

RC5/INT2

RC4/INT1

PWM3

PWM5

RB6/PGC

RB7/PGD

PWM4

Motor

3 phase Inverter bridge

R-LowR-High

Y-Low

Y-HighB-High

B-Low

AC in

+ - DC bus

Potentiometer

+

DC bus current

Reference-

PIC

18F2

431

DC buscurrent

Here�s a typical example of how the PIC18F4431 is configured to control a 3-phase AC induction motor:A speed reference is provided by a potentiometer connected to analog channel 0.The PCPWM within the microcontroller is used in complimentary mode to generate three pairs of complimentary outputs on PWM channels 0-6. A built-in dead-time generator is used to insert the necessary deadtime between complimentary channels.The PWM outputs drive a 3-phase inverter bridge, which can be an integrated gate driver and 3-phase inverter, such as the IRAMS10UP60A from International Rectifier.The 3 motor phases of the ACIM are connected to a three-phase inverter bridge.DC bus current is monitored by measuring voltage across a shunt resistor and feedingit to a comparator. The bus current signal is compared to a reference. The comparator output is connected to the FLTA input of the PIC18F4431. When operated in cycle-by-cycle mode, an overcurrent condition will result in shut-off the PWM outputs in hardware for as long as the overcurrent condition exists. In addition, a flag is set which enables firmware to take corrective action, such as reducing the target speed.

Page 8: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 8

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 8

Open Loop VF Control

� Vary Voltage and frequency at fixed ratio� PCPWM used in complimentary mode with

dead-time to generate 3 output pairs.� A sine table is used for calculating the PWM

duty cycle of each output pair.� 120° phase shift between output pairs.� Timer defines the frequency by determining

how often the duty cycle is updated.� Scaling the maximum duty cycle determines

the voltage.

The algorithm for controlling the AC induction motor requires that the voltage

(amplitude of the sinuisodal inverter drive) and the frequency be varied in a fixed ratio.

Speed is controlled by varying the input frequency of the applied alternating current,

and torque is maintained constant by varying the voltage in direct proportion to the

frequency.

To accomplish this, the PCPWM is used in complimentary mode with programmable

deadtime to generate 3 complimentary output pairs. A sine table is used for varying

the duty cycle of each output pair. A 120 degree offset is maintained between phases

by using three offset pointers to the sine table. A timer is used to set frequency by

determining how often the duty cycle values are updated. Amplitude is determined by

scaling the maximum duty cycle based on the frequency.

Page 9: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 9

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 9

Implementing VF Control

� Sine table PWM duty cycle� 3 offset pointers, to give 120° phase shift

� Timer0 Motor frequency.� Timer0 reload value depends up on

� the potentiometer setting(frequency)� operating frequency� number of Sine values in the table

� In Timer0 overflow ISR, new PWM duty cycles arecalculated based on the Frequency and phaseangle on the Sine table and loaded to the dutycycle registers.

Let�s look at this a little more closely.

The duty cycle of the three PWM channels are changed in a regular manner using aTimer0 interrupt in order to synthesize the three-phase waveforms that drive themotor.

�A sine table is stored in program memory. Three registers are used as offsets to thetable. Each of these offset values is used to point to one of the values in the table,such that there is always a 120 degree phase shift between the phases.

�The preload value of Timer0 determines how quickly it will overflow, andtherefore how quickly new PWM values are loaded from the sine table.

�In this example, the potentiometer connected to AN1 determines the target motorspeed. The microcontroller uses the ADC measurement to calculate the maximumPWM duty cycle and the update rate. These parameters determine the amplitudeand frequency of the synthesized sine waves that drive the ACIM.

�New PWM duty cycles are calculated within the Timer0 interrupt service routine,and Timer0 is preloaded to determine the time until the next Timer0 interrupt.

Page 10: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 10

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 10

Closed Loop Control - QEI

1 402

34

56

7

9

12

1516

1718

14

39

38

37

36

35

34

3332

3029

26

31

28

INDX

Vss

OSC1

FLTA/CCP2

INT0/RC3

PWM2

PWM1

PWM0VddVssRD7RD6RD5RD4

PWM3

PWM5

PWM4RB6/PGC

RB7/PGD

8

10

13

Vdd

OSC2

1920

RD0RD1

11

27RC7/RX/DT

25 RC6/TX/CK

24 RC5/INT2

23 RC4/INT1

22 RD3

21 RD2

/MCLR

AN0

QEAQEB

AN4

AN5AN6AN7AN8

RC0

FLTB/CCP1

Motor3 phase Inverter bridge

R-LowR-High

Y-Low

Y-HighB-High

B-Low

AC in

+ - DC bus

QE

QE interface

Motor current

Potentiometer

Temp. sensor

+

DC Bus Current

Reference-

PIC

18F4

431

DCBus

current

ACIM motors are usually operated in open-loop with no velocity or positionfeedback. The V/f ratio is maintained constant to provide a constant maximumtorque over the operating range. The rotor is assumed to follow the rotatingmagnetic field created by the 3-phase AC input to the stator windings with theslip frequency being the difference between the frequency of the applied ACin the stator and the rotational frequency of the rotor. The actual torque generateddepends upon the degree of slip,

Velocity feedback can be used for more precisely controlling motor speedby controlling the slip, and therefore the torque, or by altering the drivefrequency to make the rotor speed more closely match the reference speed. To obtain velocity feedback from the rotor, a quadrature encoder mounted to the rotor may be connected directly to the QEA and QEB pins of the microcontroller. By using the Motion Feedback module as a quadrature encoder interface in velocity measurement mode, measuring the the rotational velocity of the motor is easy.

Page 11: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 11

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 11

Closed Loop VF Control

� Variety of closed loop methods exist� Speed error = Reference speed - actual speed� Output frequency is increased if speed error is

positive.� Output frequency is reduced if speed error is

negative� PID algorithm can be implemented to modify

output frequency based on speed error.� V/F ratio is maintained constant

A variety of closed-loop algorithms may be used, ranging from the relatively simple to

the very complex. A basic form of closed loop control is to calculate the speed error

by comparing the actual speed (as measured by the Quadrature Encode interface) with

the reference speed (the target speed as determined by the potentiometer). If the speed

error is positive (the target speed is greater than the actual speed) then the drive

frequency to the stator is increased. If the speed error is negative, then the drive

frequency to the stator is reduced. A PID algorithm can be used to adjust the drive

frequency based on the speed error. The voltage is maintained in a constant ratio with

the drive frequency as with normal V/F control.

As long as the the load does not exceed the maximum torque available, the speed of the

rotor can be controlled accurately using this method.

Page 12: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 12

Comparison

Microcontroller PWM outputs Deadtime ComplimentarySignalGeneration

VelocityFeedback

PIC18F452 2 CCP1 generated infirmware

Requiresexternalhardware

Requiresexternalhardware

None

PIC16F7X7 3 CCP Requiresexternalhardware

Requiresexternalhardware

None

PIC18F4431 8 PCPWM Built in toPCPWM

Built in toPCPWM

QEI/IC

We�ll end this discussion by comparing several possible PICmicro MCU solutions for3-phase AC induction motor control.

�A standard PIC18 part, such as the PIC18F452, may be used by using the PWMfeature of its 2 CCP modules and creating a third PWM in firmware. However,complimentary signal generation and dead-time must be generated with externalhardware.�The PIC16F7X7 may be used. With its 3 CCP modules, it is not necessary to simulatea PWM in firmware. Complimentary signal generation and dead-time still must begenerated with external hardware.�The PIC18F4431 features the power control PWM module, and can therefore provideup to 4 pairs of complimentary outputs, with programmable deadtime. It also featuresa motion feedback module with a Quadrature Encoder Interface that is well-suited toclosed loop control.

Each of these devices can be viable for implementing 3-phase AC induction motorcontrol, depending upon a customer�s cost and performance requirements. Greatestperformance potential is provided by the PIC18F4431, due to its specifically designedmotor and power control peripherals.

Page 13: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 13

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 13

Summary� PIC18Fxx31 peripherals for motor control� ACIM motor control using PIC18Fxx31

� Open V/F loop control� Closed loop control using Quadrature encoder

� Comparison to other PICmicro MCU solutions

In summary, we�ve discussed the PIC18Fxx31 peripherals for motor control. We�vediscussed the basics of open loop VF control for 3-phase induction motors, how toutilize current feedback with hardware fault input to the PCPWM, and how toimplement closed loop control by using the Quadrature Encoder Interface of theMotion Feedback Module. We�ve also briefly compared how AC induction motorcontrol can be implemented with other PICmicro MCUs.

Page 14: ACIM_PIC18Fxx31_BW

AC Induction Motor (ACIM) Control Using PIC18Fxx31

© 2004 Microchip Technology Inc. Page 14

© 2003 Microchip Technology Incorporated. All Rights Reserved. AC induction Motor Control Using PIC18Fxx31 Slide 14

Resources� Application notes:

� AN887 : AC Induction Motor Fundamentals� AN843 : Speed Control of 3-phase Induction Motor Using

PIC18 Microcontrollers� AN889: VF Control of 3-Phase Induction Motors Using

PIC16F7X7 Microcontrollers� AN627: 3-Phase AC Induction Motor Control Using the

PIC18F4431 Microcontroller� Demo and development board

� PICDEMTM MC - Completely isolated, low cost design� Microchip motor control web-page at:

www.microchip.com/motor

For more in-depth exploration of this topic, you are encouraged to examine thefollowing application notes:AN887 gives an overview of the operating principals of AC Induction motors.AN843 shows how to implement 3-phase AC induction motor control using a PIC18using two CCP modules and a firmware PWM.AN889 shows how to implement 3-phase AC induction motor control using thePIC16F7X7, which has three CCP modules, obviating the need for a firmware PWM.AN627 shows how to implement control of a 3-phase ACIM using the PIC18F4431with the PCPWM and MFM. (Available at the end of January.)An excellent development board for motor control applications is the PICDEM MC,which provides a fully isolated platform that can be safely used with an ICD2 orICE2000 development tool.

For the latest updates, please refer to Microchip�s motor control page atwww.microchip.com/motor.