AN1208 Integrated Power Factor Correction (PFC) and Sensorless Field Oriented Control (FOC) System Author: Vinaya Skanda Microchip Technology Inc. (ADC) and the Pulse Width Modulator (PWM), enable the digital design and the implementation of such a complex application to be simpler and easier. INTRODUCTION Digital PFC and Motor Control In recent years, the motor control industry has been focusing on designing power efficient motor control drives for a wide variety of applications. The consumer demand for improved power quality standards is driving this trend. The power quality can be enhanced by implementing Power Factor Correction (PFC), and efficient control of a motor can be realized using Sensorless Field Oriented Control (FOC) techniques. The appliance industry often requires low-cost implementation of these algorithms. This can be achieved by integrating PFC and Sensorless FOC algorithms on a single Digital Signal Controller (DSC). The majority of motor control systems often use PFC as the first stage of the system. Without an input PFC stage, the current drawn will have significant harmonic content due to the presence of switching elements of the inverter. In addition, since motor loads are highly inductive, the input currents will induce significant reactive power into the input system, thereby reducing overall efficiency of the system. A PFC stage which is a front-end converter of a motor control application, provides better output voltage regulation and reduces harmonic content of the input current drawn.The standard boost converter topology with average current mode control is the preferred method for implementing digital PFC in these applications. This application note describes the process of integrating two complex applications: PFC and Sensorless FOC. These applications are implemented on a Permanent Magnet Synchronous Motor (PMSM). In addition, this application note also describes the integration of the algorithms, lists the necessary hardware requirements, and provides the guidelines to optimize the development procedure. The integrated solution is based on these application notes: • AN1106, Power Factor Correction in Power Conversion Applications Using the dsPIC DSC • AN1078, Sensorless Field Oriented Control of PMSM Motors Using dsPIC30F or dsPIC33F Digital Signal Controllers The application note AN1106, describes the Power Factor Correction (PFC) method. The application note AN1078, describes the Sensorless Field Oriented Control (FOC) method. The detailed digital design and implementation techniques are provided in these application notes. This application note is an addendum to the above application notes. The integrated application is implemented on the following families of dsPIC® DSC devices: • dsPIC30F • dsPIC33F The low cost and high performance capabilities of the DSC, combined with a wide variety of power electronic peripherals such as the Analog-to-Digital Converter © 2008 Microchip Technology Inc. The dual shunt Sensorless FOC method is a speed control technique that drives the PMSM motor. The Sensorless FOC technique overcomes restrictions placed on some applications that cannot deploy position or speed sensors. The speed and position of the PMSM motor are estimated by measuring phase currents. With a constant rotor magnetic field produced by a permanent magnet on the rotor, the PMSM is very efficient when used in appliances. When compared with induction motors, PMSM motors are more powerful for the same given size. They are also less noisy than DC motors, since brushes are not involved. Therefore, the PMSM motor is chosen for this application. Why Use a Digital Signal Controller? The dsPIC DSC devices are ideal for a variety of complex applications running multiple algorithms at different frequencies and using multiple peripherals to drive the various circuits. These applications (e.g., washing machines, refrigerators, and air conditioners) use various motor control peripherals to precisely control the speed of the motor at various operating loads. The integrated PFC and Sensorless FOC system uses the following peripherals: • Pulse Width Modulator (PWM) • Analog-to-Digital Converter (ADC) • Quadrature Encoder Interface (QEI) DS01208A-page 1 AN1208 These peripherals offer the following major features: used to implement PFC on a dsPIC DSC device. In this control method, the output DC voltage is controlled by varying the average value of the current amplitude signal. The current amplitude signal is calculated digitally. • Multiple sources to trigger the ADC • Input Conversion Capability up to 1 Msps rate • Methods to simultaneous sample multiple analog channels • Fault detection and handling capability • Comprehensive single-cycle DSP instructions (e.g., MAC) The third and the final stage of the integrated system is a three-phase inverter stage that converts the DC voltage into a three-phase voltage. The converted three-phase voltage is the input to the PMSM motor. This stage is controlled by implementing the Sensorless FOC strategy on the dsPIC DSC device. The Sensorless FOC controls the stator currents flowing into the PMSM to meet the desired speed and torque requirements of the system. The position and speed information is estimated by executing mathematical operations on the dsPIC DSC. SYSTEM OVERVIEW Figure 1 shows a block diagram of the integrated PFC and Sensorless FOC system. The first stage is a rectifier stage that converts the input line voltage into a rectified AC voltage. The rectified AC voltage is the input to the second stage, which is the boost converter stage. The integrated system uses five compensators to implement PFC and Sensorless FOC technique. The PFC technique uses two compensators to control the voltage and current control loops, and the Sensorless FOC technique uses three compensators to control the speed control loop, torque control loop, and flux control loop. All of the compensators are realized by implementing Proportional-Integral (PI) controllers. During the second stage, the boost converter boosts the input voltage and shapes the inductor current similar to that of the rectified AC voltage. This is achieved by implementing digital power factor correction. The Average Current Mode Control method is FIGURE 1: INTEGRATED PFC AND SENSORLESS FOC SYSTEM BLOCK DIAGRAM L D 1 3 5 2 4 6 A C L N PMSM Amplifier Gains K1 K2 K3 K4 K5 Analog-to-Digital Converter IAC VAC Power Factor Correction Ib Ia VDC Sensorless Field Oriented Control PWM Generator PWM Generator A 1 PFC PWM Duty Cycle DS01208A-page 2 2 3 4 5 6 Inverter PWM Duty Cycle © 2008 Microchip Technology Inc. © 2008 Microchip Technology Inc. A NOVEL APPROACH FOR DIGITAL IMPLEMENTATION OF PFC AND SENSORLESS FOC ALGORITHMS Figure 2 shows a block diagram of the PFC and Sensorless FOC control loops implemented digitally using the dsPIC DSC device. FIGURE 2: DIGITAL PFC AND SENSORLESS FOC BLOCK DIAGRAM a + 1Φ AC Bridge Rectifier Boost Converter b Three-Phase Inverter – c PWM PWM Id Control + 0 d -q to α −β PWM VDC + VDCREF + Voltage Control + + V AC IAC + + ω Ref Speed Control + + Iq Control ω/Θ Estimator 1 VAVG VAVG Id 2Φ Rotor System α −β to d-q Iα Iβ 2 Φ Stator System Sensorless Field Oriented Control (FOC) System Ia a, b, c to α −β Ib 3Φ Stator System DS01208A-page 3 AN1208 Power Factor Correction (PFC) Vα Vβ Θ Iq VAC PWM Θ Current Control ω + SVM AN1208 Digital Power Factor Correction The inductor current (IAC), input rectified AC voltage (VAC), and DC Output Voltage (VDC) are used as feedback signals to implement the digital PFC. These signals are scaled by hardware gains and are input to the analog channels of the ADC module. The PFC algorithm uses three control loops: the voltage control loop, current control loop, and the voltage feed forward control loop. The voltage compensator uses the reference voltage and actual output voltage as inputs to compute the error and compensate for the variations in output voltage. The output voltage is controlled by varying the average value of the current amplitude signal. The current amplitude signal is calculated digitally by computing the product of the rectified input voltage, the voltage error compensator output, and the voltage feed-forward compensator output. The rectified input voltage is multiplied to enable the current signal to have the same shape as the input voltage waveshape. The current signal should match the rectified voltage as closely as possible to have a high power factor. The voltage feed-forward compensator is essential for maintaining a constant output power for a given load because it compensates for variations in the input voltage. Once the current signal is computed, it is fed to the current compensator. The output of the current compensator determines the duty cycle of the PWM pulses. The boost converter can be driven either by the Output Compare module or the PWM module. Refer to application note AN1106, Power Factor Correction in Power Conversion Applications Using the dsPIC® DSC (DS01106), for information about the system design and digital implementations of this control method. Sensorless Field Oriented Control The phase currents, Ia and Ib, are used as feedback signals to implement the Sensorless FOC technique. The third phase current, Ic, is calculated digitally. The three-phase currents are first converted to a two-phase stator system by using Clarke transformation before being converted to a two-phase rotor system by using Park transformation. This conversion provides two computed current components: Id and Iq. The magnetizing flux is a function of the current Id and the rotor torque is a function of the current Iq. After the speed is determined by mathematical estimation, the error between the desired speed and the estimated speed is fed to the speed compensator. The speed compensator produces an output that acts as a reference to the Iq compensator. For a permanent magnet motor, the reference to the Id compensator is zero value. The PI controllers for Iq and Id compensate errors in the torque and flux, thereby producing Vd and Vq as the output signals respectively. The Inverse Park transformation and Space Vector Modulation (SVM) techniques are applied to generate the duty cycle for the Insulated Gate Bipolar Transistors (IGBTs).The motor control PWM module is used to generate PWM pulses. Refer to application note AN1078, Sensorless Field Oriented Control of PMSM Motors (DS01078), for information about how to design, implement, and tune the compensator. The implementation details and the hardware configuration details required to develop the integrated system are discussed in the following sections. INTEGRATED PFC AND SENSORLESS FOC IMPLEMENTATION ON A dsPIC DSC DEVICE The following control parameters and routine are used, when the integrated system is implemented by using a dsPIC30F or dsPIC33F device: • • • • • • • PFC PWM frequency: 80 kHz FOC PWM frequency: 8 kHz PFC Control loop frequency: 40 kHz FOC Control loop: 8 kHz Point of execution for PFC routine: ADC ISR Point of execution for FOC routines: PWM ISR Trigger Source to the ADC: Timer Figure 3 shows the timing diagram of the integrated PFC and Sensorless FOC system. Figure 4 through Figure 6 shows the state flow diagram of the integrated system. A position estimator estimates the rotor position and speed information. The motor model uses voltages and currents to estimate the position. The motor model essentially has a position observer to indirectly derive the rotor position. The PMSM model is based on a DC motor model. DS01208A-page 4 © 2008 Microchip Technology Inc. AN1208 FIGURE 3: TIMING DIAGRAM PTPER PTPER PWM1 Timer PITMR PWM2 Timer PITMR 8 kHz 80 kHz ADC Trigger Event 80 kHz A/D Interrupt Events 40 kHz PWM1 Interrupt Events 8 kHz PWM1 Pulses PWM2 Pulses © 2008 Microchip Technology Inc. 8 kHz 80 kHz DS01208A-page 5 AN1208 FIGURE 4: STATE FLOW DIAGRAM OF INTEGRATED SYSTEM Reset Initialize Variables Initialize PI Parameters Enable Interrupts PFC Switch Pressed PFC DS01208A-page 6 FOC Switch Pressed FOC © 2008 Microchip Technology Inc. AN1208 FIGURE 5: STATE FLOW DIAGRAM OF DIGITAL PFC PFC Switch Pressed of Po we r-o n De lay Voltage PI Control y Measured VAC n Dela Calculate ∑VAC and Sample Count 'N' En d r-o f Powe Start o A/D Interrupt Service Routine Calculate ∑VAC and Sample Count 'N' Update PWM2 Duty Cycle Read IA and IB Wait for ADC Interrupt Power-on delay Measured VDC Current PI Control Measured IAC Calculate Reference Current IACREF Calculate VAVG and Voltage Feed-forward Compensate Measured VAC © 2008 Microchip Technology Inc. DS01208A-page 7 AN1208 FIGURE 6: STATE FLOW DIAGRAM OF SENSORLESS FOC FOC Switch Pressed Wait for PWM Interrupt Measured IA, IB Start-up State Read Reference Torque Convert Currents to Iq and Id Execute PI Controllers for Iq and Id A/D Interrupt Motor Running Start-up Set New Duty Cycles using SVM Increment Theta Based on Ramp End of Start-up Ramp Measured IA, IB Sensorless FOC State Set New Duty Cycles using SVM Read Reference Speed from POT Convert Currents to Iq and Id Execute PI Controllers for Speed, Iq and Id Compensate Theta Based on Speed DS01208A-page 8 Estimate Theta using SMC Calculate Speed © 2008 Microchip Technology Inc. AN1208 IMPLEMENTATION ON A dsPIC30F6010A DEVICE Development Resources To develop and test the integrated algorithm, the following software and hardware tools are required: This section describes the following topics: • • • • • Hardware Tools: - dsPICDEMTM MC1H 3-Phase High Voltage Power Module (P/N: DM300021) - dsPICDEMTM MC1 Motor Control Development Board (P/N: DM300020) - dsPIC30F6010A digital signal controller (P/N: MA300015) - PMSM motor - MPLAB® REAL ICE™ Debugger/Programmer - 220V, 50 Hz AC power source - 9V DC power supply • Software Tools: - MPLAB IDE - Version 7.61 (or later) - C30 Compiler Version 3.01 (or later) ADC Configuration Details Hardware Setup Hardware Setup System Execution Procedure ADC Configuration Details Figure 7 shows the connections between the various analog inputs and the analog channels of the ADC module. It also shows the resulting buffer locations where the digital results are stored. FIGURE 7: ADC CONFIGURATION ADC Result Buffer AN7-POT Speed Ref. CH0 AN0 CH1 Phase Current 1 ADCBUF0 ADCBUF1 MUX A AN1 Phase Current 2 CH2 AN2-POT CH3 AN9 VAC CH0 MUX B AN3 CH1 IAC ADCBUF3 ADCBUF4 ADCBUF5 VDC AN4 CH2 © 2008 Microchip Technology Inc. Torque Ref. ADCBUF2 ADCBUF6 DS01208A-page 9 AN1208 Hardware Setup CONFIGURING THE dsPICDEM MC1 MOTOR CONTROL DEVELOPMENT BOARD The following steps outline the procedure to set up the the dsPICDEM MC1 Development Board: 1. 2. 3. 4. Remove the following components: • R36 and C33 located on the AN3 line • R39 and C35 located on the AN5 line • R42 and C37 located on the AN4 line Connect analog channel AN3 to analog channel AN6. Connect analog channel AN4 to analog channel AN11. Connect analog channel AN2 to VR1 on the J6 connector. CONFIGURING THE dsPICDEM MC1H HIGH VOLTAGE POWER MODULE The following steps outline the procedure to set up the the board: 1. Solder a high-current jumper wire (AWG 18 minimum) between J5 and J13, as shown in Figure 8. FIGURE 8: ESTABLISH COMMON POWER AND DIGITAL SIGNAL GROUND Because shunt resistors are used to sense current from the motor, power and digital signals must use the same ground. Solder a high-current jumper wire (AWG 18 minimum) between J5 and J13. ACCESSING THE HIGH VOLTAGE POWER MODULE BEFORE Before removing the lid, the following procedure should be rigidly followed: 1. 2. 3. J5 Turn off all power to the system. Wait a minimum of 3 minutes so that the internal discharge circuit has reduced the DC bus voltage to a safe level. The red LED bus voltage indicator visible through the top ventilation holes should not be lit. Verify with a voltmeter that discharge has taken place by checking the potential between the plus (+) and minus (–) DC terminals of the 7-pin output connector before proceeding. The voltage should be less than 10V before proceeding to the next step. J13 AFTER WARNING: If the voltage is more than 10V, repeat steps 2 and 3 until the voltage level is less than 10V. The system is only safe to work on if the voltage is less than 10V. Failure to heed this warning could result in bodily harm. 4. 5. 6. 7. J5 Remove all cables from the system. Remove the screws fixing the lid to the chassis and heat sink on the top and bottom. Slide the lid forward while holding the unit by the heat sink. After the board is out of the housing, modify the power module as described in the next section. J13 Jumper 2. 3. DS01208A-page 10 Connect LK30 to the BUS_SENSE terminal by using a signal wire. Place 5.6 kOhm resistors on links LK20, LK21, and LK31, as shown in Figure 9. © 2008 Microchip Technology Inc. AN1208 FIGURE 9: INSTALL FEEDBACK CURRENT SELECTION RESISTORS To obtain feedback current, the circuit links must be completed. System Execution Procedure Complete the following steps to execute the integrated PFC and Sensorless FOC algorithm that controls the motor: 1. To activate the current feedback for this application, populate links LK20, LK21, and LK31 with 5.6 kΩ resistors. 2. 3. BEFORE 4. 5. Launch the MPLAB software and open the program. Run the algorithm. Apply AC input voltage to the dsPICDEM MC1H High Voltage Power module. Make sure VR2, the Speed Reference POT, is in its minimum position and VR1, the Initial Torque Reference POT, is set between the 0% and 25% position. Start the motor by pressing the S4 switch. The motor starts in Open Loop mode and ramps up the speed until it is equal to 900 rpm, and then makes a transition from Open Loop mode to Closed Loop mode. 6. The DC bus voltage boosts from its initial value based on the amplitude of the applied AC input voltage. LK20, LK21, and LK31 Links AFTER When the motor enters Closed Loop mode and stabilizes, start the PFC calculations by pressing the S7 switch. 7. 8. Change values of the VR2 POT to operate the motor at a different speed. Stop the motor by pressing the S4 switch. 5.6 kΩ Shunt Resistors 4. 5. 6. Remove the LK2 jumper connection and place a link on jumper LK1. Place jumper LK4 in the 1-2 position. Place jumpers on link LK5 through LK12. © 2008 Microchip Technology Inc. DS01208A-page 11 AN1208 IMPLEMENTATION ON A dsPIC33FJ12MC202 DEVICE ADC Configuration Details Figure 10 shows the connections between the various analog inputs and the analog channels of the ADC module. It also shows the resulting buffer location where the digital results are stored. This section describes the following topics: • • • • • • ADC Configuration Details dsPIC33FJ12MC202 Pin Allocation Development Resources Hardware Setup Interconnecting the Hardware System Execution Procedure FIGURE 10: ADC CONFIGURATION ADC Result Buffer AN5-POT Speed Ref. CH0 AN0 CH1 Phase Current 1 ADCBUF0 ADCBUF1 MUX A AN1 Phase Current 2 CH2 AN2 CH3 AN2 VDC CH0 MUX B AN3 CH1 IAC ADCBUF3 ADCBUF4 ADCBUF5 VAC AN4 CH2 DS01208A-page 12 VDC ADCBUF2 ADCBUF6 © 2008 Microchip Technology Inc. AN1208 dsPIC33FJ12MC202 Pin Allocation Development Resources Since the dsPIC33FJ12MC202 device is an I/O remappable device, the functionality for each pin can be defined by the user. Table 1 lists the different pins and the functionality assigned to the pin. To develop and test the PFC application, the following hardware and software development tools are required: TABLE 1: No. PIN FUNCTIONALITY NAME FUNCTIONALITY 1 AN2 VDC 2 AN3 IAC 3 AN4 VAC 4 AN5 Speed Reference (POT) 5 VSS Ground 6 RA2 Primary Oscillator Line 7 RA3 Primary Oscillator Line 8 PGD/EMUD3 Debug Data Line Debug Clock Line 9 PGC/EMUC3 10 VDD Device Supply 11 RB5 Fault Input Signal 12 RB6 Switch 1 - Motor On/Off 13 RB7 Switch 2 - PFC On/Off 14 PWM2H1 PFC MOSFET Fire 15 RB9 Fault Reset/PWM Enable 16 VSS Digital Ground 17 VDDCORE Device Supply 18 PWM1H3 Inverter IGBT3 High Fire 19 PWM1L3 Inverter IGBT3 Low Fire 20 PWM1H2 Inverter IGBT2 High Fire 21 PWM1L2 Inverter IGBT2 Low Fire 22 PWM1H1 Inverter IGBT1 High Fire 23 PWM1L1 Inverter IGBT1 Low Fire 24 AVSS Analog Ground 25 AVDD Device Supply 26 MCLR Reset/Clear 27 AN0 Phase A Current 28 AN1 Phase B Current • Hardware Tools: - dsPICDEM MC1H 3-Phase High Voltage Power Module (P/N: DM300021) - Explorer 16 Development Board (P/N: DM240001) - Motor Control Interface PICtail Plus Daughter Board (P/N: AC164128) - dsPIC33FJ12MC202 Plug-in Module (P/N: MA330014) - 9V DC power supply - Variable AC power supply (0-220V) - PMSM motor - MPLAB ICD 2 Debugger/Programmer • Software Tools: - MPLAB IDE - Version 8.00.04 (or later) - C30 - Version 3.01 (or later) Hardware Setup ACCESSING THE HIGH VOLTAGE POWER MODULE Before removing the lid, the following procedure should be rigidly followed: 1. 2. 3. WARNING: If the voltage is more than 10V, repeat steps 2 and 3 until the voltage level is less than 10V. The system is only safe to work on if the voltage is less than 10V. Failure to heed this warning could result in bodily harm. 4. 5. 6. 7. © 2008 Microchip Technology Inc. Turn off all power to the system. Wait a minimum of 3 minutes so that the internal discharge circuit has reduced the DC bus voltage to a safe level. The red LED bus voltage indicator visible through the top ventilation holes should not be lit. Verify with a voltmeter that discharge has taken place by checking the potential between the plus (+) and minus (–) DC terminals of the 7-pin output connector before proceeding. The voltage should be less than 10V before proceeding to the next step. Remove all cables from the system. Remove the screws fixing the lid to the chassis and heat sink on the top and bottom. Slide the lid forward while holding the unit by the heat sink. After the board is out of the housing, modify the power module as described in the next section. DS01208A-page 13 AN1208 MODIFYING THE dsPICDEM HIGH VOLTAGE POWER MODULE The following steps outline the procedure to set up the the board: 1. 5. FIGURE 12: Solder a high-current jumper wire (AWG 18 minimum) between J5 and J13, as shown in Figure 11. FIGURE 11: Place 5.6 kOhm resistors on links LK20, LK21, and LK31, as shown in Figure 12. INSTALL FEEDBACK CURRENT SELECTION RESISTORS To obtain feedback current, the circuit links must be completed. ESTABLISH COMMON POWER AND DIGITAL SIGNAL GROUND To activate the current feedback for this application, populate links LK20, LK21, and LK31 with 5.6 kΩ resistors. Because shunt resistors are used to sense current from the motor, power and digital signals must use the same ground. BEFORE Solder a high-current jumper wire (AWG 18 minimum) between J5 and J13. BEFORE J5 LK20, LK21, and LK31 Links AFTER J13 AFTER J5 5.6 kΩ Shunt Resistors 6. J13 Jumper 2. 3. 4. 7. 8. Remove the LK2 jumper connection and place a link on jumper LK1. Place jumper LK4 in the 1-2 position. Place jumpers on link LK5 through LK12. Replace resistor R15 with a 390 kOhm resistor. Replace resistor R13 with a 158 kOhm resistor. Connect LK30 to the BUS_SENSE terminal by using a signal wire. DS01208A-page 14 © 2008 Microchip Technology Inc. AN1208 SETTING UP THE EXPLORER 16 BOARD Interconnecting the Hardware The following steps outline the procedure to set up the the board: To set up the system, complete the following steps: 1. 2. 3. Place jumper J7 in the PIC24 position. Switch S2 to the PIM position. Remove the LCD connections. Some LCDs have internal pull-up resistors; therefore, it is recommended to remove the LCD. CONFIGURING AND SETTING THE MOTOR CONTROL INTERFACE PICtail PLUS DAUGHTER BOARD 1. 2. 3. 4. Use these steps to configure and set up the board: Configure the hardware properly. Refer to “Hardware Setup” for more information on hardware modifications. Place the dsPIC33FJ12MC202 PIM on the Explorer 16 Development Board. Connect the Explorer 16 Development Board to the Motor Control Interface PICtail Plus Daughter Board by using the 120-pin connector. Connect the Motor Control Interface PICtail Plus Daughter Board to the dsPICDEM High Voltage Power Module by using the 37-pin connector. Connect the 9V DC power supply to the Explorer 16 Development Board. Connect the variable AC supply to the dsPICDEM MC1 3-Phase High Voltage Power Module. Power on the 9V supply. Power on the input AC supply. On jumper J4, connect Pin 1 to Pin 2. On jumper J10, connect Pin 2 to Pin 3. On jumper J11, connect Pin 2 to Pin 3. Place Jumper J27. 5. CONFIGURING THE dsPIC33FJ12MC202 PLUG-IN MODULE 7. 8. The following steps outline the procedure to set up the the board: System Execution Procedure 1. 2. 3. 4. 1. 2. 3. 4. 5. 6. 7. 8. 9. 6. Connect RP1 to pin 34. Connect RP2 to pin 33. Connect RP3 to pin 20. Connect RP5 to pin 18. Connect RP6 to pin 83. Connect RP7 to pin 92. Connect RP8 to pin 84. Place the following zero ohm resistors: Complete the following steps to execute the algorithm on a dsPIC33F DSC device: R12, R13, R14, R15, R16, R17, R18, R19, R20, R24, and R25. 5. 1. 2. 3. 4. Remove the following zero ohm resistors: R5, R6, R7, R8, R9, R10, R11, R21, R22, R23, R26, R27, R28, R29, R30, R31, R32, and R33. 6. Launch the MPLAB software and open the program. Build All and Flash the device. Make sure the Debug option is selected in MPLAB IDE. Run the algorithm. Apply an AC input voltage to the dsPICDEM MC1 3-Phase High Voltage Power Module. Make sure R6, the Speed Reference POT on the Explorer 16 Development Board, is in its minimum position (CCW). Start the motor by pressing the S3 switch. The motor starts in Open Loop mode and ramps up the speed until it is equal to 900 rpm, and then makes a transition from Open Loop mode to Closed Loop mode. 7. When the motor enters the Closed Loop mode and stabilizes, start the PFC calculations by pressing the S5 switch. 8. The DC bus voltage boosts from its initial value based on the amplitude of the applied AC input voltage. 9. Change values of the R6 POT to operate the motor at a different speed. 10. Stop the motor by pressing the S3 switch. © 2008 Microchip Technology Inc. DS01208A-page 15 AN1208 LABORATORY TEST RESULTS AND WAVEFORMS Figure 13 and Figure 14 show the waveforms for the input current, R phase current, and Y phase current when executing the integrated application. This information aids in validating the PFC and Sensorless FOC implementation on a dsPIC DSC device. FIGURE 13: DS01208A-page 16 INPUT CURRENT AND MOTOR PHASE CURRENT WAVEFORMS © 2008 Microchip Technology Inc. AN1208 FIGURE 14: EXPANDED INPUT AND MOTOR PHASE CURRENT WAVEFORMS © 2008 Microchip Technology Inc. DS01208A-page 17 AN1208 CONCLUSION REFERENCES Considering the consumer demand for increased efficiency and growing desires for environmental standards, designers are always looking out for new algorithms that can be used to develop low-cost, power efficient motor control systems. Several application notes have been published by Microchip Technology, which describe the use of dsPIC DSC devices for motor control applications. The dsPIC DSC device’s high processing power and peripheral-rich platform enable the implementation of complex algorithms on a single chip. The Sensorless FOC process uses three control loops to compensate the current and the speed. The PFC process uses two control loops to compensate the input current and output voltage. All of these compensators use a PI controller to compensate for variations in these parameters, which requires very high processing power and finer control of the system. The dsPIC DSC devices are best suited to handle the above requirements because of the high resolution, good processing speed, availability of advanced analog peripherals, and the variety of instructions that support these functions. Microchip has various resources to assist you in developing this integrated system. Contact your local Microchip sales office if you would like further support. • For ACIM control see: - AN984, An Introduction to AC Induction Motor Control Using the dsPIC30F MCU (DS00984) - AN908, Using the dsPIC30F for Vector Control of an ACIM (DS00908) - GS004, Driving an ACIM with the dsPIC DSC MCPWM Module (DS93004) - AN1162, Sensorless Field Oriented Control (FOC) of an AC Induction Motor (ACIM) (DS01162) - AN1206, Sensorless Field Oriented Control (FOC) of an AC Induction Motor (ACIM) Using Field Weakening (DS01206) • For BLDC motor control see: - AN901, Using the dsPIC30F for Sensorless BLDC Control (DS00901) - AN957, Sensored BLDC Motor Control Using dsPIC30F2010 (DS00957) - AN992, Sensorless BLDC Motor Control Using dsPIC30F2010 (DS00992) - AN1083, Sensorless BLDC Control with Back-EMF Filtering (DS01083) - AN1160, Sensorless BLDC Control with Back-EMF Filtering Using a Majority Function (DS01160) • For PMSM control see: - AN1017, Sinusoidal Control of PMSM Motors with dsPIC30F DSC (DS01017) - AN1078, Sensorless Field Oriented Control of PMSM Motors (DS01078) • For Power Control see: - AN1106, Power Factor Correction in Power Conversion Applications Using the dsPIC DSC (DS01106) • For information on the dsPICDEM MC1 Motor Control Development Board see: - dsPICDEM MC1 Motor Control Development Board User’s Guide (DS70098) - dsPICDEM MC1H 3-Phase High Voltage Power Module User’s Guide (DS70096) - dsPICDEM MC1L 3-Phase Low Voltage Power Module User’s Guide (DS70097) - Explorer 16 Development Board User’s Guide (DS51589) - Motor Control Interface PICtail Plus Daughter Board User’s Guide (DS51674) These documents are available on the Microchip web site (www.microchip.com). DS01208A-page 18 © 2008 Microchip Technology Inc. AN1208 APPENDIX A: SOURCE CODE Software License Agreement The software supplied herewith by Microchip Technology Incorporated (the “Company”) is intended and supplied to you, the Company’s customer, for use solely and exclusively with products manufactured by the Company. The software is owned by the Company and/or its supplier, and is protected under applicable copyright laws. All rights are reserved. Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil liability for the breach of the terms and conditions of this license. THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. All of the software covered in this application note is available as a single WinZip archive file. This archive can be downloaded from the Microchip corporate Web site at: www.microchip.com © 2008 Microchip Technology Inc. DS01208A-page 19 AN1208 NOTES: DS01208A-page 20 © 2008 Microchip Technology Inc. Note the following details of the code protection feature on Microchip devices: • Microchip products meet the specification contained in their particular Microchip Data Sheet. • Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. • There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. • Microchip is willing to work with the customer who is concerned about the integrity of their code. • Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.” Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights. Trademarks The Microchip name and logo, the Microchip logo, Accuron, dsPIC, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, PRO MATE, rfPIC and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, In-Circuit Serial Programming, ICSP, ICEPIC, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mTouch, PICkit, PICDEM, PICDEM.net, PICtail, PIC32 logo, PowerCal, PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB, Select Mode, Total Endurance, UNI/O, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. © 2008, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified. © 2008 Microchip Technology Inc. DS01208A-page 21 Worldwide Sales and Service AMERICAS ASIA/PACIFIC ASIA/PACIFIC EUROPE Corporate Office 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: http://support.microchip.com Web Address: www.microchip.com Asia Pacific Office Suites 3707-14, 37th Floor Tower 6, The Gateway Harbour City, Kowloon Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431 India - Bangalore Tel: 91-80-4182-8400 Fax: 91-80-4182-8422 India - New Delhi Tel: 91-11-4160-8631 Fax: 91-11-4160-8632 Austria - Wels Tel: 43-7242-2244-39 Fax: 43-7242-2244-393 Denmark - Copenhagen Tel: 45-4450-2828 Fax: 45-4485-2829 India - Pune Tel: 91-20-2566-1512 Fax: 91-20-2566-1513 France - Paris Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Japan - Yokohama Tel: 81-45-471- 6166 Fax: 81-45-471-6122 Germany - Munich Tel: 49-89-627-144-0 Fax: 49-89-627-144-44 Atlanta Duluth, GA Tel: 678-957-9614 Fax: 678-957-1455 Boston Westborough, MA Tel: 774-760-0087 Fax: 774-760-0088 Chicago Itasca, IL Tel: 630-285-0071 Fax: 630-285-0075 Dallas Addison, TX Tel: 972-818-7423 Fax: 972-818-2924 Detroit Farmington Hills, MI Tel: 248-538-2250 Fax: 248-538-2260 Kokomo Kokomo, IN Tel: 765-864-8360 Fax: 765-864-8387 Los Angeles Mission Viejo, CA Tel: 949-462-9523 Fax: 949-462-9608 Santa Clara Santa Clara, CA Tel: 408-961-6444 Fax: 408-961-6445 Toronto Mississauga, Ontario, Canada Tel: 905-673-0699 Fax: 905-673-6509 Australia - Sydney Tel: 61-2-9868-6733 Fax: 61-2-9868-6755 China - Beijing Tel: 86-10-8528-2100 Fax: 86-10-8528-2104 China - Chengdu Tel: 86-28-8665-5511 Fax: 86-28-8665-7889 Korea - Daegu Tel: 82-53-744-4301 Fax: 82-53-744-4302 China - Hong Kong SAR Tel: 852-2401-1200 Fax: 852-2401-3431 Korea - Seoul Tel: 82-2-554-7200 Fax: 82-2-558-5932 or 82-2-558-5934 China - Nanjing Tel: 86-25-8473-2460 Fax: 86-25-8473-2470 Malaysia - Kuala Lumpur Tel: 60-3-6201-9857 Fax: 60-3-6201-9859 China - Qingdao Tel: 86-532-8502-7355 Fax: 86-532-8502-7205 Malaysia - Penang Tel: 60-4-227-8870 Fax: 60-4-227-4068 China - Shanghai Tel: 86-21-5407-5533 Fax: 86-21-5407-5066 Philippines - Manila Tel: 63-2-634-9065 Fax: 63-2-634-9069 China - Shenyang Tel: 86-24-2334-2829 Fax: 86-24-2334-2393 Singapore Tel: 65-6334-8870 Fax: 65-6334-8850 China - Shenzhen Tel: 86-755-8203-2660 Fax: 86-755-8203-1760 Taiwan - Hsin Chu Tel: 886-3-572-9526 Fax: 886-3-572-6459 China - Wuhan Tel: 86-27-5980-5300 Fax: 86-27-5980-5118 Taiwan - Kaohsiung Tel: 886-7-536-4818 Fax: 886-7-536-4803 China - Xiamen Tel: 86-592-2388138 Fax: 86-592-2388130 Taiwan - Taipei Tel: 886-2-2500-6610 Fax: 886-2-2508-0102 China - Xian Tel: 86-29-8833-7252 Fax: 86-29-8833-7256 Thailand - Bangkok Tel: 66-2-694-1351 Fax: 66-2-694-1350 Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781 Netherlands - Drunen Tel: 31-416-690399 Fax: 31-416-690340 Spain - Madrid Tel: 34-91-708-08-90 Fax: 34-91-708-08-91 UK - Wokingham Tel: 44-118-921-5869 Fax: 44-118-921-5820 China - Zhuhai Tel: 86-756-3210040 Fax: 86-756-3210049 01/02/08 DS01208A-page 22 © 2008 Microchip Technology Inc.