AN1113 STMICROELECTRONICS | Alldatasheet

Document overview

  • Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
  • PDF pages: 18

Technical content

Brushless DC motors (BLDC) are becoming widely used in the field of control motors. These kind of syn- chronous motors are used as servo drives in applications such as computer peripherals equipment, ro- botics, and as adjustable-speed drives in load-proportional capacity-modulated heat pumps, large fans , compressors and so on. Brushless DC motors are referred to by many aliases as brushless permanent magnet, permanent ma- gnet AC motors, permanent magnet synchronous motors, etc. The confusion arises because a brush- less motor does not directly operate off a dc voltage source. It is generally driven (supplied) from an in- verter which converts a constant voltage to a 3-phase voltage with a frequency corresponding instantaneously to the rotor speed. One of the advantages of BLDC motor is the sparks absence. The brushes of a DC motor have several problems as regards to brushes’ life and dust residues, maximum speed and electrical noise. BLDC mo- tors are potentially cleaner, faster, more efficient, less noisy and more reliable. However, BLDC motors require a more complex electronic control. This application note will show how this complexity can be reduced by using ST52x301 Fuzzy controller. AN OUTLINE OF BRUSHLESS MOTORS The Brushless motor has the physical appearance of a 3-phase permanent magnet synchronous machi- ne. The brushes and commutator have been eliminated and the windings are connected to the control elec- tronics. Electronics replaces the function of the commutator and energizes the proper winding. The ener- gized stator winding leads the rotor magnet and switches just as the rotor aligns with the stator. In synchronous motor drives, the stator is supplied with a set of balanced three-phase currents, whose frequency is f. If p is the number of the poles in the motor, then: f = p 4π ωs (1) where ωs (rad/s) is the flux synchronous speed or, that is the same, the rotor speed. This equation links the rotor speed to the phases switching frequency of the electronic drive. The above currents produce a constant amplitude flux φs in the air gap, which rotates at the synchro- nous speed ωs. Since the flux amplitude is proportional to the current amplitude, it is enough to manage winding current level to control the rotor torque. From Brushless theory [3-4] it is possible to demonstrate that Tem =Kt Φf Iph sin (δ)(2) where kt is a constant, φf is the field-flux, δ is called torque angle. δ represents the angle between the phase linked flux φfph1 and the relative stator current Iph1. AN1113 APPLICATION NOTE Brushless Motor Fuzzy Control by using ST52x301 Authors: G. Grasso, M. Di Guardo

tion between shaft position, hall sensors response and voltage profile to be supplied. se is driven by means of a couple of transistors. Fig.3 shows the basic operating principle of this drive. such as for example T1 and T4. Figure 3. Inverter driver operating principle re-circulates the instantaneous current of the winding until it decreases to zero. voltage and one phase current. Six voltage steps are evident in the look like sine wave. the whole period, avoiding the phase to be "floating" (Six-Steps Continuous Mode Inverter).

Figure 6. Fuzzy algorithm stem will sooner reach the "Speed_Ref" but the overshoot in a step response could lead to instability. The above explanation is similar for the other rules.

Figure 7. Electrical schematic drive and three AND’s are enough to control the BLDC motor.

fact, a high frequency PWM wave produces, in a coil, a voltage whose amplitude value is the mean va- lue of the square wave. The motor data sheet displayed in fig. 2, clearly shows that "U-W" phase must be supplied positive when sensor "H1" is high, "W-V" when sensor "H2" is high and so on. This is true because the triangular connection was preferred in the coils arrangement. AND output is, then, a Pulse train whose duration is the same of the Hall signal. This pulses train is used to drive each leg of the bridge L298. L298 is a monolithic dual full-bridge driver designed to accept standard TTL logic levels and drive induc- tive loads such as relays, solenoids, DC and stepping motors. Enable input signals are available to allow a software protection. Internal circuitry provides the appropriate dead-time in order to avoid a "cross-con- duction" along the leg. ST52x301 provides, by means of an internal peripheral, a PWM wave that can be varied by software. ST52x301 PWM frequency is chosen as compromise between acoustic noise in the motor and losses in the power stages of the bridge. A 19 KHz wave frequency was used in the implemented application. SOFTWARE DESCRIPTION Before to discuss about ST52x301 software configuration, it is important to note some HW connections in the schematic. Bit "0" (pin 9) of the parallel port is used to enable the power stage only after power-on reset, then parallel port must be configured in OUT mode. The analog input AIN0 (pin 43) is used to read the voltage reference. A voltage between 0 + 2.5 V present on this pin, is converted in the range 0 + 255. External INTerrupt pin (27) is used to read one Hall sensor signal period in order to calculate the instan- taneous speed. This digital input will be configured both in negative or positive edge trigger to produce an internal software interrupt. Fig. 8 displays how to configure A/D peripheral with 3 inputs, TRIAC peripheral in PWM mode at 19 KHz, the used global variables. The following figure reports the main program in term of graphical programming. The appendix at the Figure 8 . Peripheral configuration Brushless Motor Fuzzy Control by using ST52x301

Figure 9 . Main view end of this application note contains the whole assembler code generated by the compiler. Let us discuss about the main program. "Int_AD_on" and "init" blocks in fig. 9 are used to initialize global variables and interrupts mask (only AD Int is enabled). The two following blocks start the converter and wait for the results of the conversion. After that, the converter values are stored in the variable called "speed, "torque", "current" and a new Interrupt mask is enabled (only Ext Int). Block "V200_duty" loads the Triac counter with a default value and the block "PWM_start" allows the Tri- ac peripheral to run. At this time it is already possible to see a PWM wave on pin 24 of ST52x301. Since pin 27 reads a time period related to the speed it is necessary to perform a mathematical inver- sion to achieve the frequency. Just to simplify, a complementation of the period byte will be made in- stead of the inversion. In this way, an error will be introduced in the spin frequency calculation. If a more accurate precision is requested, an alternative method to implement the inversion is to use a fuzzy im- plementation of the function 1/T. The block "L298_EN_on" enables the bridge driver. The Block "complemnt" performs the above task. Following the loop, a new value of the speed Ref "torque_ref" and "current" are read. The block "max_research" catches the maximum value of the cur- rent during a turn of the shaft. This loop is performed until the condition "tmp>=2" is false. Variable tmp is used to create a time inertia in the fuzzy control. "Tmp" is incremented each time the Ext-Interrupt routi- ne is executed (each 1/3 turn of the shaft) and this implies a real time control in about one turn of the shaft. Block "calc_err" performs error calculation as "error = speed - ref - speed ", error variable is sent to the fuzzy input, Fuzzy block "fuzzy controller" produces the incremental value "delta_DC". Next figure shows the content of the 5 mathematics blocks. In the second, "delta_DC" is added (or sub- tract, if negative) to the current duty-cycle before to refresh Triac counter. The operators If .. then are in- troduced to avoid overflow or underflow in the counter registers during the control. Key point in the program is the Ext_Int routine (fig. 11). This task performs the period measurement of AN1113 - APPLICATION NOTE

By using ST52x301 Fuzzy Controller it is easy to implement a real time control with few components.The brushless motor control described in this application note represents a good compromise between sy- stem costs and motor performances. The graphical programming environment reduces the development time also for not expert programmers. Fig. 12 displays a phase current and the star voltage Vu-o. PWM square wave is filtered by the oscillo- scope. From this picture it is possible to observe the six steps on the current wave that yields a distortion of the theoretical sine wave. At higher speed rates the distortion becomes lower, although at low speed, motor performance does not degrade. To evaluate acceleration characteristics and control goodness, some trials were made during the softwa- Figure 12 . Phase current re development. Fig. 13 shows free acceleration characteristics starting from a given speed of the shaft to reach a double speed by changing suddenly the speed_Ref. The dynamic performances of this system were compared, in term of speed and load response, with a traditional controller with six steps drive. No substantial differences were issued in the dynamic perfor- mances, but the costs of the traditional system was higher. AN1113 - APPLICATION NOTE

Figure 13. Dynamical performances

APPENDIX: ST52X301 ASSEMBLER CODE Source file: C:\\TEMP\\BLDC_CL.wcl Compile time:Mon Sep 28 11:01:26 1998 Device type: ST52x301 Compiler version: 01.00 (02.06.98) data 0 0 20 147 0 data 0 1 15 127 15 data 0 2 0 107 20 stop irq Timer_Interrupt irq Triac_Interrupt irq AD_Interrupt irq SCI_Interrupt irq External_Interrupt stop @WCLStart@@: ldcf 255 ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf ldcf 228 Start: Int_AD_on: ldcf init: ldrc 128 ldrc 128 ldrc ldrc AN1113 - APPLICATION NOTE

AD_start: ldcf Wait0: waiti Rd_speed: ldri rd_torque: ldri Rd_sense: ldri stopAD: ldcf EXT_on: ldcf restart_ad: ldcf V200_to_duty: mdgi ldrc 200 ldpr megi PWM_start: ldcf ldcf L298_EN_on: mdgi ldrc ldpr megi complemnt: mdgi ldrc 255 sub megi RD_spee: ldri RD_torq: ldri Rd_Isense: ldri Brushless Motor Fuzzy Control by using ST52x301

max_reserch: mdgi ldrr sub megi jps @@00000 @00001: ldrr @00000: @00002: tmp_3: mdgi ldrc sub megi jpz @@00004 jpns @@00003 @00004: jp calc_err jp @@00005 @00003: jp complemnt @00005: calc_err: mdgi ldrc sub megi jps @@00006 @00007: ldrc @00006: @00008: mdgi ldrc 180 sub megi jpz @@00010 jpns @@00009 @00010: ldrc 180 @00009: AN1113 - APPLICATION NOTE

@00011: ldrc mdgi ldrr subo megi controller: ldrr stop ldp ldp fzand con 117 ldp ldp fzand con 127 ldp ldp fzand con 137 out stop ldri Torque_limit: mdgi ldrr sub megi jps @@00012 @00013: ldrc 128 @00012: @00014: ldrc incr_duty: mdgi ldrc 128 add add megi mdgi Brushless Motor Fuzzy Control by using ST52x301

@@00016 jpns @@00015 @00016: ldrc 244 @00015: @00017: mdgi ldrc sub megi jps @@00018 @00019: ldrc @00018: @00020: new_duty: ldpr jp PWM_start External_Interrupt: inv_flag: mdgi ldrc add megi mdgi ldrc sub megi jpz @@00022 jpns @@00021 @00022: ldrc @00021: @00023: mdgi ldrc add megi flag_is1: AN1113 - APPLICATION NOTE

@@00025 jpns @@00024 @00025: jp set_tim jp @@00026 @00024: jp get_rpm @00026: get_rpm: ldri stop_tim: ldcf on_rise: rint ldcf rint IRET0: reti set_tim: mdgi ldrc 255 ldpr megi start_tim: ldcf ldcf on_fall: rint ldcf 129 rint jp IRET0 AD_Interrupt: IRET2: reti SCI_Interrupt: IRET1: reti Timer_Interrupt: Brushless Motor Fuzzy Control by using ST52x301

IRET4: reti Triac_Interrupt: IRET3: reti stop Information furnished is believed to be accurate and reliable. However, STMicroelectronics assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is gran- ted by implication or otherwise under any patent or patent rights of STMicroelectronics. Specification mentioned in this publication are subject to change without notice. This publication supersedes and replaces all information previously supplied. STMicroelectronics products are not authorized for use as critical components in life support devices or systems without express written approval of STMicroelectronics. The ST logo is a registered trademark of STMicroelectronics © 1999 STMicroelectronics – Printed in Italy – All Rights Reserved STMicroelectronics GROUP OF COMPANIES http://www.st.com Australia - Brazil - Canada - China - France - Germany - Italy - Japan - Korea - Malaysia - Malta - Mexico - Morocco - The Netherlands - Singapore - Spain - Sweden - Switzerland - Taiwan - Thailand - United Kingdom - U.S.A. AN1113 - APPLICATION NOTE