| |
Datasheet Home \ Datasheet Details
Download
PDF Abstract Text:
Order this document by AN2149 / D
AN2149
Order this document by AN2149 / D
Semiconductor Products Sector Application Note
AN2149
Compressor Induction Motor Stall and Rotation Detection using Microcontrollers
by William Mackay Motorola Microcontroller Division East Kilbride, Scotland.
1 Introduction
Application Note
2 AC Line Zero Cross Detection Hardware
Implementing an efficient motor start procedure can be achieved using a Triac and relay control technique. This involves firstly applying power to the run winding of the motor using the Relay. The Triac is connected in series with the start winding and is fired close to the zero crossing points of the line voltage for a specific period of time to start the motor. After this period the Triac is turned off and the motor continues to run. The start winding provides the initial starting torque and, after the motor has started, it has no further duty until the motor is powered down and re-started. A schematic diagram of the hardware required follows.
AN2149 2 AC Line Zero Cross Detection Hardware Motorola
Application Note Detection Schematic
2.1 Detection Schematic
RELA Y To Micro R4 220k R5 220k
R7 10k Q2 To Micro Input Capture
Motor
Triac Drive Circuitr y R3 110ohm R1 1k From Mic ro Q1
Run Winding
Run Winding Zero Cross Detection
R6 10k
Start Winding
Vss Vdd
MT2 Q2 R8 220k
MT1 R9 220k
R11 10k Q3 To Micro Input Capture
R2 10k
Sta rt Winding Zero Cross Detection
1 R10 10k
When running, the continuous rotational motion of the motor and magnetic field induces a voltage in the now redundant start winding. During normal running conditions there is a measurable phase difference between the start and run windings. This is illustrated in the following diagrams.
AN2149 Motorola AC Line Zero Cross Detection Hardware 3
Application Note
2.1.1 Run and Start Winding Before Rotation
Run Winding
Start Winding
In the above stalled condition the windings are in phase. 2.1.2 Phase Difference During Run Condition
Run Winding
Start Winding
Normal run conditions yields a phase difference between the run and start windings.
AN2149 4 AC Line Zero Cross Detection Hardware Motorola
Application Note Phase Difference Measurement Process
2.2 Phase Difference Measurement Process
The phase difference between the start and run windings is approximately 1mS. The presence of this difference is an indication of motor rotation. When the motor is not rotating, there is no difference in phase between the start and run windings. This change in behavior provides the measurement source for the Microcontroller. The following diagram illustrates the measurement process.
Run Winding
Run Zero Cross Start Zero Cross
Start Winding Phase Shift Phase Min Phase Max
2.3 AC Line Signal Conditioning
The zero cross detect circuit conditions the above waveforms into usable digital signals which result as a series of pulses switched between 0V and Vdd at half the period of the AC line frequency, in this case 10mS. The digital signals derived from the zero crossing points of the run and
AN2149 Motorola AC Line Zero Cross Detection Hardware 5
Application Note
start windings are input to the Microcontroller input capture pins. A sample of the digital waveforms applied to the input capture pins follows. 2.3.1 Input to Microcontroller Before Rotation
Run Winding
Start Winding
2.3.2 Input to Microcontroller During Run Condition
Run Winding
Start Winding
This is the digital representation of the phase difference between the run and start windings during normal running conditions.
AN2149 6 AC Line Zero Cross Detection Hardware Motorola
Application Note Detection Algorithm
2.4 Detection Algorithm
The algorithm will monitor the continuous presence of pulses on the input capture pins derived from the run and start windings. If the pulses are not detected in the appropriate sequence and time frame, the motor can be considered as being in a stalled condition and appropriate action can be taken, for example, by removing power from the motor and raising an audible alarm. Alternatively, one input capture pin can be used to monitor the run winding and the start winding can be monitored using an input port. This would require additional code to poll the port pin in a timely sense. The method described here takes advantage of both input captures.
2.5 Consecutive Detection
AN2149 Motorola AC Line Zero Cross Detection Hardware 7
Application Note 3 Flowcharts
The following flowcharts demonstrate an algorithm which implements stall / rotation detection of an induction motor refrigeration compressor. The algorithm is implemented from a main routine that controls the detection through two interrupt service routines, and also controls the power to the motor. It includes the facility to raise an audible alarm when the motor rotation is not in the expected state.
AN2149 8 Flowcharts Motorola
Application Note Consecutive Detection
Stall Detect Main Routine
Initialise device & application parameters
No stall detect requested Yes stall detect disable
stall detect enable
No motor stalled
AN2149 Motorola Flowcharts 9
Application Note
call from main
power-up motor
return
AN2149 10 Flowcharts Motorola
Application Note Consecutive Detection
Enable Stall Detect Routine
call from main
enable stall detect input capture
return
Disable Stall Detect Routine
call from main
disable stall detect input capture
return
AN2149 Motorola Flowcharts 11
Application Note
call from main
power-down motor
return
call from main
alarm on
return
AN2149 12 Flowcharts Motorola
Application Note Consecutive Detection
icap interrupt
AC Line Zero Cross Detect Input Capture Interrupt Routine
Yes start phase expired No
fire triac
read zero cross detect time
disable zero cross detect
reset start phase
reset input capture flag
return
AN2149 Motorola Flowcharts 13
Application Note
Start Winding Zero Cross Detect Interrupt Routine
motor stall detect interrupt
read start zero cross time from timer
increment start zero cross count
increment consecutive error count
calculate phase shift
Yes is phase shift valid No
return
AN2149 14 Flowcharts Motorola
Application Note Consecutive Detection
4 Summary
There are many situations where it is convenient and sometimes necessary to have confirmation that the motor is in fact rotating when power is applied to the compressor. In the conventional arrangement the motor was protected from thermal damage by a bi-metallic contact. The Microcontroller can now manage this situation, decisions can be taken in the software based on the zero cross detection events of the run and start windings. In this way the motor can be protected from taking excessive power when in a stalled condition, therefore excessive winding temperature situations can be prevented from power-on. Additional thermal protection can also be included by connecting a sensor to the analogue to digital converter to continuously monitor motor temperature. In applications that demand increased operational safety, knowing that the motor is rotating can be used as a comparative reference parameter for closed loop system integrity, safety measurements, or logic state confirmation checks. For example, in a pressurised system, if motor rotation is confirmed it can be expected that some time later the system should have achieved a specific pressure value. This can be measured using a pressure sensor and one of the analogue to digital converter inputs of the Microcontroller. Flow measurement can be achieved using a simple in-line switch connected to the device input / output ports. In these situations the Microcontroller can confirm motor rotation and compare with the feedback parameters measured within the software control loop. Single-phase induction motors are widely used in ratings of 1hp and less, rarely greater than 10 hp. This power range of motors can meet the low through higher starting torque demands which are required for many household and industrial appliances, such as fans, which have a low starting torque and the higher starting torque demands of pumps, air conditioning units, and refrigeration compressors. As well as being a cost-effective solution, the adaptability and programmability of the Microcontroller can make a significant impact in the control, safety and efficiency of these and appliances.
AN2149 Motorola Summary 15
Application Note 5 Code
During the initial start-up phase, the probability of a stall condition is higher. This typically can be caused by mechanical failure where the motor is unable to start due to an obstruction, or an electrical failure when the motor is unable to start due to internal winding damage or component failure. However, it may be convenient in some systems to extend this feature to monitor the rotation of the motor at any time during the normal operational cycle of the application. The following code has been structured such that functions can be included in the application and called at any time from power-on in a convenient way. A main routine is used to demonstrate the implementation of the code as described in the preceding flowcharts.
AN2149 16 Code Motorola
Application Note Main Routine
#include "hc08kx8.h" #include "stall.h"
/ generic hc08kx8 header file / / application header file /
5.1 Main Routine
/ Copyright (c) Motorola 2000 Function Name Engineer Location Date Created Current Revision Note : : : : : : main() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 0.0 Main routine applies power to the motor, enables or disables stall detection and powers the motor down based on the condition of a flag which is controlled in the stall detect ISR.
/ port pin high / / enable stall detect input capture / / after start phase expired / / remove power from motor / / audible alarm /
AN2149 Motorola Code 17
Application Note 5.2 Initialisation Routine
/ Copyright (c) Motorola 2000 Function Name Engineer Location Date Created Current Revision Note : : : : : : init() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 0.0 Function configures oscillator, device modules and initialises application parameters
sets configuration register / sets oscillator frequency / configure input / output ports / initialise timer / configure input capture pin / initialises application parameters /
5.3 Configuration Routine
/ Copyright (c) Motorola 2000 Function Name Engineer Location Date Created Current Revision Note : : : : : : config() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 0.0 Function configures device configuration register
/ disables lvi and cop /
AN2149 18 Code Motorola
Application Note Oscillator Initialisation Routine
5.4 Oscillator Initialisation Routine
AN2149 Motorola Code 19
Application Note 5.5 Initialise Input Output Ports Routine
relay / buzzer / door / enable pull-up /
AN2149 20 Code Motorola
Application Note Timer Initialisation Routine
5.6 Timer Initialisation Routine
/ internal bus clock divide by 1 /
AN2149 Motorola Code 21
Application Note 5.7 Input Capture Initialisation Routine
AN2149 22 Code Motorola
Application Note Initialise Application Routine
5.8 Initialise Application Routine
red led / motor relay de-energised / green led / triac off / yellow led / start motor at next zero cross / enable stall detect input capture / enable interrupts /
/ motor relay energised /
AN2149 Motorola Code 23
Application Note 5.10 Stall Detect Enable Routine
/ initial motor start phase complete /
/ motor relay de-energised / / disable icap interrupt / / motor led /
AN2149 24 Code Motorola
5.13 Stall Detect Disable Routine
AN2149 Motorola Code 25
Application Note 5.14 Delay Routine
/ Copyright (c) Motorola 2000 Function Name Engineer Location Date Created Current Revision Note : : : : : : delay() William Mackay Motorola Microcontroller Division, East Kilbride March 2000 0.0 This delay for triac pulse period
AN2149 26 Code Motorola
Application Note Input Capture Routine
5.15 Input Capture Routine
/ start phase valid / / apply pulse to triac /
/ start phase is a count of the / / line voltage zero cross points / / / / / / / start time has expired / read high byte of counter / read low byte of counter / disable timer ch 0 icap interrupt / enable timer ch1 icap interrupt / reset start phase /
/ reads TIM status and control regr / / resets CH0F flag /
AN2149 Motorola Code 27
Application Note 5.16 Stall Detection Routine
AN2149 28 Code Motorola
Application Note HC08KX8 Generic Header File
5.17 HC08KX8 Generic Header File
/ Copyright (c) Motorola 1999 File Name Org Author Location Date Created Current Revision Notes : : : : : : HC08KX8.h William Mackay Motorola Microcontroller Division, East Kilbride December 1999 0.0 This file maps the 68HC908KX8 register set as defined in the General Release Specification.
bit0 bit1 bit2 bit3 bit4 bit5 bit6 bit7
AN2149 Motorola Code 29
Application Note
REGISTER(0x00) BIT(0x00, 0) BIT(0x00, 1) BIT(0x00, 2) BIT(0x00, 3) BIT(0x00, 4)
REGISTER(0x01) BIT(0x01, 0) BIT(0x01, 1) BIT(0x01, 2) BIT(0x01, 3) BIT(0x01, 4) BIT(0x01, 5) BIT(0x01, 6) BIT(0x01, 7)
AN2149 30 Code Motorola
Application Note HC08KX8 Generic Header File
/ / / Configuration Write-Once Registers / / / #define #define CONFIG2 CONFIG1 REGISTER(0x1e) REGISTER(0x1F)
AN2149 Motorola Code 31
Application Note
/ Timer Channel 1 Register / #define TCH1H REGISTER(0x29) #define TCH1L REGISTER(0x2a)
REGISTER(0x36) BIT(0x36, 0) BIT(0x36, 1) BIT(0x36, 2) BIT(0x36, 3) BIT(0x36, 4) BIT(0x36, 5) BIT(0x36, 6) BIT(0x36, 7)
REGISTER(0x38) BIT(0x38, 0) BIT(0x38, 1) BIT(0x38, 2) BIT(0x38, 3) BIT(0x38, 4) BIT(0x38, 5) BIT(0x38, 6) BIT(0x38, 7)
/ / / Analogue To Digital Converter Registers / / / / A / D Status and Control Register /
AN2149 32 Code Motorola
Application Note HC08KX8 Generic Header File
#define #define #define #define #define #define #define #define #define
REGISTER(0x3c) BIT(0x3c, 0) BIT(0x3c, 1) BIT(0x3c, 2) BIT(0x3c, 3) BIT(0x3c, 4) BIT(0x3c, 5) BIT(0x3c, 6) BIT(0x3c, 7)
REGISTER(0x3d) / REGISTER(0x3e) BIT(0x3e, 4) BIT(0x3e, 5) BIT(0x3e, 6) BIT(0x3e, 7)
REGISTER(0xFE0C) BIT(0xFE0C, 7)
AN2149 Motorola Code 33
Application Note 5.18 Application Header File
/ Copyright (c) Motorola 2000 File Name Engineer Location Date Created Current Revision Notes : : : : : : StallDetect.h William Mackay Motorola Microcontroller Division, East Kilbride March 2000 0.0 This file contains application definitions
AN2149 34 Code Motorola
Application Note Application Header File
AN2149 Motorola Code 35
How to reach us: USA / EUROPE: Motorola Literature Distribution P.O. Box 5405, Denver, Colorado 80217. 1-303-675-2140 HOME PAGE: http://motorola.com / sps / JAPAN: Motorola Japan Ltd. SPS, Technial Information Center, 3-20-1, Minami-Azabu, Minato-ku, Tokyo 106-8573 Japan. 81-3-3440-3569 ASIA / PACIFIC: Motorola Semiconductors H.K. Ltd. Silicon Harbour Centre, 2 Dai King Street, Tai Po Industrial Estate, Tai Po, N.T., Hong Kong. 852-266668334 CUSTOMER FOCUS CENTER: 1-800-521-6274
AN2149 / D
|