You are on page 1of 62

Low Cost Brushless DC Motor Controller

By

Anish Varsani

Department of Computer Science and Electrical Engineering Supervised by Dr. Geoffrey Walker

Submitted for the degree of Bachelor of Engineering In the division of Computer Systems Engineering 29th November 2003

October 29, 2003

Professor Simon Kaplan, Head of School of Information Technology and Electrical Engineering University of Queensland St. Lucia, QLD, 4072 Dear Sir, In accordance with the requirements of the degree of Bachelor of Engineering in the division of Electrical Engineering, I present the following thesis, entitled

Low Cost Brushless DC Motor Controller.

This work was performed under the supervision of Dr. Geoffrey Walker. I declare that the work submitted in this thesis is my own, except as acknowledged in the text, and has not been previously submitted for a degree at the University of Queensland, or any other institution. Yours Sincerely,

Anish Varsani

Abstract
With advances in 42-volt automotive systems, more mechanical loads are being driven from the DC power bus. Such loads include power steering pumps and air conditioning compressors. A brushless DC (BLDC) motor has been chosen to drive the compressor in the Ultra Commuter because of its superior output characteristics over induction and brushed DC motors. The cooling requirements demand 1kW peak power output. The air conditioning system also requires pressure switches to protect the compressor from low-pressure operation. Since space is precious, the controller needs to be as small as possible. As such, large heat sinks are not an option, hence heat dissipation must be minimal. The drive circuit must also be rugged to provide a long trouble free life. The purpose of this thesis is to design, construct and evaluate the hardware and software for a motor controller to meet the above requirements. These goals have been met by careful component selection, rugged hardware design, space saving layout techniques and reliable firmware.

Acknowledgements
I would like to thank the following people: Dr Geoffrey Walker, my thesis supervisor for guidance and technical help throughout the project. Mr. Peer Allen, my lab supervisor for maintaining the thesis laboratory and providing an excellent working environment. Mr. Keith Bell and the rest of the EWS team for producing all of my PCBs. Mr. Thommas Williams (Mechanical Engineer) for providing me with a test rig on which to test my hardware. Mr. David Finn (PHD student) for providing me with information on brushless DC motors. Mr. Paul Jones for his assistance in firmware development. The thesis students of Axon 504 (Nino Johannson, Luke Billingham, Andrew Parker, Brent Singer, Christopher Lister) for brightening up an otherwise dull work environment.

Contents
Chapter 1 Introduction...............................................6
1.1 42-volt Brushless DC Motor Controller ..............................................................6 1.2 Achieved Solution................................................................................................6 1.3 Document Overview ............................................................................................7

Chapter 2 Background Information and Product Review .............................................................................9


2.1 Brushless DC Motor Characteristics....................................................................9 2.2 Brushless DC Motor Construction.....................................................................10 2.3 Brushless DC motor Control..............................................................................12 2.4 Transistors..........................................................................................................14 2.5 Drive Topologies ...............................................................................................15 2.6 Existing Product Review...................................................................................16

Chapter 3 Derivation of Specifications ...................19


3.1 Air Conditioner Requirements...........................................................................19 3.2 Motor Requirements ..........................................................................................20 3.3 Controller Specifications ...................................................................................20

Chapter 4 Hardware Implementation ....................22


4.1 Hardware design and component selection.......................................................22 4.2 MOSFET Bridge................................................................................................22 IRF3803 Specs [12] .............................................................................................24 4.3 Gate Drive.........................................................................................................26 IR2101s Specs [13] ..............................................................................................27 4.4 Power Supply .....................................................................................................28 4.5 Current Sense Amplifiers...................................................................................30 4.6 Hall Effect Sensor Interface...............................................................................32 4.7 Pressure Switch Interface...................................................................................34 4.9 Temperature Sensor ...........................................................................................38

Chapter 5 Firmware Implementation.....................39 Chapter 6 Product Evaluation and Results ............43


6.1 Motor Truth table...............................................................................................43 6.2 Hardware............................................................................................................44 6.3 Efficiency and Performance...............................................................................45 6.4 Budget ................................................................................................................46

Chapter 7 Future Developments..............................49 Chapter 8 Conclusion ...............................................50 References.....................................................................51

Appendix ...............................................................53
Appendix 1...............................................................................................................54 Appendix 2...............................................................................................................55 Appendix 3...............................................................................................................56

Chapter 1 Introduction
1.1 42-volt Brushless DC Motor Controller Brushless DC (BLDC) motors find use in many applications ranging from printer head motors to large conveyor belt drivers. With the upcoming 42-volt automotive electrical system, more mechanical loads will be electrically driven. The electric motors driving these loads may be brushed DC motors or brushless DC motors. Brushless DC motors will find use in applications that are constantly running. Examples of such applications include water pumps, oil pumps, fuel pumps, gearbox hydraulic pumps, air compressors, variable valve actuators, power steering pumps, air conditioning compressor and many more. As the name suggests, Brushless DC motors dont have any brushes, as do their brushed counter parts. As such, they require additional electronics to perform motor commutation. The additional electronics is referred to as the motor drive or motor controller. The aim of this thesis project is to design and evaluate a low cost BLDC motor controller. The motor controller is intended to drive the air conditioning compressor of the Ultracommuter. It is expected that this thesis provide a solution suitable for the requirements of the Ultracommuter.

1.2 Achieved Solution The solution achieved as a result of this thesis project is a low cost micro controller implementation. Smart component selection has been used to meet many of the requirements set out by the project description. Though a prototype was available for testing, more work is required to meet size constraints. This motor controller though fulfils the project requirements, is not a universal design. It is application specific. With further research and some hardware changes, a universal solution may evolve from the current design.

1.3 Document Overview The following pages document relevant background information, design processes, product evaluation and results relating to the BLDC motor controller. Chapter 2 Background information This chapter contains background information on brushless DC motors, why they are used, current applications, future applications, drive requirements, driver topologies, and control methods. Chapter 3 Derivation of motor controller specifications This chapter examines the project descriptions and sets down a set of requirements that the motor controller must fulfil. Specifications will be derived by breaking down the motor controller into its subsystems and listing the requirements of each subsystem. The process by which the subsystems were derived will also be included. Chapter 4 Hardware Implementation This chapter details component selection for the different subsystems that make up the motor controller. Chapter 5 Firmware Implementation The chapter outlines the requirements of the motor controller firmware as set down in the controller specification. It also describes how the firmware was implemented. Chapter 6 Product Evaluation and Results This chapter details the performance of the motor controller. It also compares the actual product to the specifications of Chapter 3. Also discussed are the procedures used to perform tests and how closely the results match theoretical calculations. A table summarises the results.

Chapter 7 Future Developments This chapter describes the improvements that could be made. Discussed are aspects that would be implemented the same way and aspects that would be implemented differently. Chapter 8 Conclusion This chapter provides a brief overview of the entire project. Is outlines the intended goals and the achieved goals. A summary of performance is also included. References Appendices The aim of this report is to provide a detailed and accurate summary of BLDC motor drivers along with the relevant theory. It is hoped that the reader gains a firm understanding of the BLDC motor controller and its capabilities.

Chapter 2 Background Information and Product Review


This chapter provides the relevant background information required to understand the hardware requirements, control strategies and software requirement of a BLDC motor controller. 2.1 Brushless DC Motor Characteristics Brushless DC motors first came about soon after the development of transistors and other semiconductor switching devices. The principle reason for their existence was to provide electronic commutation between phase windings. This gave rise to speed control of motors where previously motors would have been designed specifically for the desired operating speed. They also offer better efficiency over induction and synchronous motors due to the lack of machine air gap loses. [Luo, F. L., Yeo, H. G. (2000)] Also, brushless DC motors dont produce the levels of electromagnetic radiation common to universal motors. [Bentouati, S.; Zhu, Z.Q.; Howe, D. (1999)] A brushless DC motors characteristic is what makes them such a versatile drive solution. BLDC motors have identical speed and torque characteristics to brushed DC motors. The torque produce by BLDC motors is given by:

T = D ( 2 r 2 LBgKrms ) = Krms I
From the equation, it is clear that the motor torque is directly proportional to motor

current, I. The speed, , of a BLDC motor is given by:

= V Kspeed
where Kspeed is the motor speed constant in radians per volt. It is clear that the motor speed is directly proportional to the applied voltage, V.

Figure 1 summarises the torque characteristics of a BLDC motor. The actual torque drops slightly due to core saturation at higher currents. It should also be noted that BLDC motors produce maximum torque from standstill. This is one of the main reasons they are preferred over induction motors. Induction motors draw up to twice their rated current on starting but product only typically 30 percent of their operating torque from standstill. Synchronous motors product zero starting torque, as a result they are usually started and brought to synchronous speed using a DC motor. BLDC Motor Torque Current Curve
120 100 80 60 40 20 0 0 20 40 60 80 100 Current (%)
Figure 1 BLDC motor torque speed curve

2.2 Brushless DC Motor Construction A brushless DC motors internal construction is what gives it its characteristics. Brushless DC motors are a variant of permanent magnet DC motors (PMDCM). PM DC motors are simply synchronous motors in which the rotor field is driven with a constant current. By driving the rotor winding with a constant current, a fix magnetic flux is established within the motor. This can also be achieved by replacing the rotor winding with a permanent magnet. Such motors are called brushless DC motors. Brushless DC motors dont require slip rings so motor maintenance is reduced and reliability is increased. Slip rings create dust as they wear. The dust needs to be 10

Torque (%)

periodically cleaned from the motor housing. When slip rings wear past a certain length, they need to be replaced.

Figure 2 3 phase synchronous motor internal diagram

Figure 3 3 phase brushless DC motor internal diagram

The stator windings of BLDC motors contain a multi-phase winding. Small cooling fans are usually 2-phase, while medium and large power motors are 3-phase. Some washing machine motors have 4 or 5 phase windings to reduce torque ripple. The windings may be either wye connected or delta connected. Most motors have ungrounded wye connections. Brushless DC motors require that the motor controller perform the commutation function. Commutation is a function of rotor position. The appropriate stator windings of the motor need to be energised when the rotor pole lines up with winding. It is possible to drive a BLDC motor by simply forcing the commutation intervals to a

11

preset value. The problem with this type of control is that the applied phase voltage may not be proportional to the speed forced by the controllers commutation sequence. The generated stator flux interacts with the rotor flux, which is generated by a rotor magnet, defines the torque and thus speed of the motor. The voltage strokes must be properly applied to the two phases of the three-phase winding system so that the angle between the stator flux and the rotor flux is kept close to 90 to get the maximum generated torque. Due to this fact, the motor requires electronic control for proper operation. Most BLDC motors have internal sensors to provide position information. The most common type of sensor is the Hall Effect sensors. When the rotor pole lines up with a particular phase, the sensors output goes high and when the rotor has passed, the output goes low. 3-phase motors typically have three hall sensors. The sensors are placed in the centre of each phase winding. They may be spaced at 60 or 120 electrical degree intervals. 120-degree spacing common. Encoders may also be used. They are used on servomotors. The encoders are usually mounted on the end of a gearbox. It is also possible to drive a BLDC motor without sensors.

2.3 Brushless DC motor Control The purpose of a BLDC motor controller is to provide speed and/or torque control to the motor. Usually a controller will provide one of the two, either torque or speed control. Speed control is achieved by monitoring motor speed and adjusting the applied phase voltage to maintain the desired speed. Torque control is achieved by monitoring motor current. The motor current can be controlled to hold a constant value thus providing constant torque on the motor shaft. It is possible to incorporate speed and torque control. Typically, speed may be controlled but a hard current limit will also be enforced to stop the motor drawing more than its rated current. Alternatively, current may be controlled with speed limiting to prevent the motor from running faster than its rated speed. This is

12

particularly important when brushless DC motors are run from power supplies that have a higher output voltage that what the motor is rated for. An example where constant torque control is used is in grinding mills. Constant speed operation is typically usually used for conveyor belt drives in process control plants. In addition to providing speed and torque control, motor controller must also generate the required motor commutation sequences. Motor commutation is usually related to Hall Effect sensor outputs.

Figure 4 Hall sensor outputs and stator phase voltage relationship [9]

Figure 4 shows the relationship between Hall Effect sensor outputs and phase back EMF waveforms. This is usually referred to as a motors truth table as it determines which phases need to be energised for each particular Hall Effect sensor transition. The simplest BLDC motor controllers operate by providing a trapezoidal current waveform to the motor. More complex controllers can generate sinusoidal currents.

13

Sinusoidal drive waveforms result is quieter motor operation and smoother torque output. In order to product sinusoidal drive waveforms, current sensing is needed on each phase. Trapezoidal current driver only required one current sensor, usually placed on the power leads into or out of the motor controller.

2.4 Transistors The output stage of motor controllers is made up of transistors. The transistor of choice are metal oxide field effect transistors (MOSFETs). The theory of MOSFET operation wont be discussed here. However, the relevant formula for calculating losses will. MOSFETs have a characteristic drain to source resistance, Rds. This is the resistance when the transistor is turned to its on state, that is, there is current flowing through the device. As with any resistor, if there is a current flowing through it, there will power dissipated in the device. The heat dissipated by a MOSFET due to its resistance is referred to as conduction loss. Conduction loss, Pon, is given by:

Pon =

ton 2 Ion Rds Ts

where Ion is the current flowing through the transistor when it is fully switch on. Since switching from off to on state does not occur instantaneously, there is also power dissipation due to the finite switching time. This is referred to as switching loss, Psw and is given by:

1 Psw = VdIofs (tcon + Tcoff ) 2


MOSFETs with higher current capability typically have lower drain-source resistance, resulting is low power dissipation. They do however have a large gate-source capacitance that results in higher conduction losses and reduced switching frequency.

14

2.5 Drive Topologies Two main drive topologies exist to drive BLDC motors, the full bridge and the half bridge. The half bridge circuit shown in figure 5 consists of three transistors. The drain of each transistor is connected to a motor phase winding. The advantage of the half bridge is the lower part count. In the event that MOSFETs are used, the resulting switching losses are also lower. For a given power output, P:

Id =

P Vd
2

so the conduction loss is:

ton ton P Pon = Ion 2 Rds = Rds Ts Ts Vd


and switching loss is given by:

1 1 P Psw = VdIofs (tcon + Tcoff ) = Vd fs (tcon + Tcoff ) 2 2 Vd


These power losses are on a per transistor basis.

Figure 5 Half bridge motor drive

The disadvantage of a half bridge driver is that current can only flow in one direction through a motor phase. Also, the motor must be a wye-connected motor with the star point brought out for external connection. Torque delivered by a half bridge drive and motor is given by:

T = D ( 2 r 2 LBgKrms ) = Krms I =

1 Kpeak I 3
15

A more flexible driver is the full bridge using six switches. Current in a full bridge can be driven through a motor phase winding in both directions. A full bridge and the associated motor connection is shown in figure 6.

Figure 6 Full bridge motor drive

Because of the way a motor is connected to a full bridge, current is driven in two phase windings at any one time. This means that torque is produce by two phases at any one time as opposed to the half bridge, where torque is only produced by one phase at a time. The effective copper utilisation is doubled. The torque of a full bridge driver and motor is given by:

T = D ( 2 r 2 LBgKrms ) = Krms I =

2 Kpeak I 3

Since two phases are excited together, the current density in the motor is higher. As a result the torque produce by such a set up is also higher. The full bridge is able to deliver 1.41 times the torque of a half bridge connected to the same motor.

2.6 Existing Product Review There are several existing products that are available for 3-phase brushless DC motor control. A list of controller chips is summarised in table 1.

16

Manufacturer Part number external external external internal internal external external internal internal internal 24 W 15 W cont 26 W Digital signal processor 8-bit micro controller 22 17 17 9

Operating Voltage Price

Output stage

Power output

Allegro IC

A3932

50

50

20

Features Built in high and low side gate driver Built in high and low side gate driver Designed for P-channel high side switches

52

52

130 W cont 3 Phase MOSFET output stage 130 W cont 3 Phase MOSFET output stage

3.3 5

Comments requires additional components for closed loop control requires additional components for closed loop control requires additional components for closed loop control Not enough power for air conditioning but more than enough for cooling fans or pumps Not enough power for air conditioning but more than enough for cooling fans or pumps Libraries and app. notes available for brushless DC motor control

20

Allegro IC A3932 On Semiconductor MC33033 ST Micro Electronics L6234 ST Micro Electronics L6235 Texas Instruments TMS320F2406 Atmel ST Micro Electronics L6287 ST Micro Electronics L7203 ST Micro Electronics L7250 3 Phase MOSFET output stage 3 phase sinusoidal voltage output Digital controller, 3 wire serial interface to uP

12

12

Specifically designed for VCR tape drive application Very versatile controller. Only required one Hall effect sensor input Spindle motor controller. Typical applications include computer hard disk and CD-ROM drives

Fairchild 18 internal Semiconductor KA3011BD Table 1 Summary of available motor controllers 20W

3 Phase MOSFET output stage, 3.3 or 5 volt interface for DSP connection

Spindle motor controller. Typical applications include computer hard disk and CD-ROM drives

17

Most of these control ICs have integrated output transistors. They are intended to be single chip solution for low power applications. The L6235 from ST Microelectronics show incredible potential for automotive use. Its capable of delivering 130 Watts continuous to a 3-phase motor. This chip would be particularly useful for driving cooling fan motors, water, oil and fuel pump motors. Such pumps would have the drive circuit integrated into the pump package to form a sealed unit with only two wires coming out for power. Another particular useful controller is the A3932 from Allegro IC. Its specifically designed for automotive use. It features both high and low side gate drivers for Nchannel MOSFETs, over current protection, PWM input and tachometer output. The PWM input allows the connection of an external micro controller or DSP to perform the speed control loop. Another feature of this controller is the cost, only $9.00. The MC33033 from On Semiconductor is an older controller. Its designed to run Pchannel high side switches. Also, it required additional hardware to provide closed loop motor control. This controller can be used to drive N-channel transistors, however, the parts could is greatly increased as a result. The main reason is that signal inverters are required on the high side transistor outputs. A commercially available motor controller is the Tritium Gold Controller.

18

Chapter 3 Derivation of Specifications


The expected outcome of this thesis project is to produce a motor controller capable of driving a BLDC motor, which in turn will drive an air conditioning compressor. In order to fulfil the project requirements, a list of the requirements for the air conditioning system must be made. From this, a set of specifications can be drawn up and then the project can be broken down into separate subsystems.

3.1 Air Conditioner Requirements The Ultracommuter air conditioner system has the following requirements: " " " " " Electrically driven 42 Volt operation 1kW input power Temperature control Low internal gas pressure protection

The air conditioning compressor must be electrically driven to increase the overall efficiency of the Ultracommuter vehicle. Since the Ultracommuter features a 42-volt electrical system, the air conditioning system must operate from the 42-volt supply. The cooling requirements of the Ultracommuter define that the input power to the compressor must be 1kW peak and 500 to 700 watts continuous. Temperature control is required to avoid running the air conditioner at full power. Full power operation would result in uncomfortably low cabin temperatures. Once the cabin temperature reaches a preset level, the air conditioner needs only to maintain this temperature. The air conditioning system must be prevented from operating in the event that refrigerant leaks out of the system. This is required to protect the compressor.

19

3.2 Motor Requirements The motor that will drive the air conditioning compressor has the following specifications: " " " " " 3 phase delta or ungrounded Wye connected brushless DC 3000 rpm at 110 Volts 3kW output at 110 volts 27 amp winding rating Built in open collector Hall Effect sensors

3.3 Controller Specifications From the list of motor requirements and air conditioner requirements, the following list of controller specifications has been made: 8 bit micro controller 3 Phase full bridge output capable of 1kW Motor current limiter Cabin temperature sensor 12-volt to 5-volt Hall Effect sensor interface Pressure switch interface Greater than 95% efficiency An 8 bit micro controller has been chosen to reduce cost. A digital signal processor increases the cost of the controller dramatically. Since the motor will have either an ungrounded Wye or a delta internal phase connection, a 3-phase full bridge output is required to drive the motor. Motor current limiting is required to ensure that no more than 27 amps flows through the motors stator windings. A cabin temperature sensor is needed to provide information on when to reduce motor speed.

20

A 12-volt to 5-volt Hall Effect sensor interface is needed to drop down the sensor signal level to 5V, which is compatible with 5-volt logic of the micro controller. The pressure switch interface needs to perform the same task as the Hall Effect interface. A target efficiency of 95% has been set to keep heat-sinking requirements to a minimum. As a direct result, the size of final design will be reduced.

21

Chapter 4 Hardware Implementation


4.1 Hardware design and component selection The overall hardware design was broken down into the following subsystems: MOSFET bridge Gate drive circuit Power supply Current sense amplifier Hall Effect sensor interface Pressure switch interface Micro controller circuit Temperature sensor

A detailed description of the different subsystems is provided.

4.2 MOSFET Bridge A 3-phase full bridge arrangement was chosen for the power interface between the motor and controller. The full bridge was chosen for it higher torque output capability over a half bridge arrangement. The purpose of the bridge circuit is to enable each of the three motor phases to be switched on as required by the motor truth table. Due to the large currents each MOSFET has flowing through it, the potential exists to have a very large power dissipation through the device. Figure 7 shows the connection of the three-phase transistor bridge along with the series gate current limiting resistors and current sense resistor.

22

Figure 7 MOSFET Bridge Schematic [2]

To provide stator current feed back to the motor controller, a series 0.005-ohm sense resistor, Rsense1 was included in the circuit. At full load (Imax=23.8A), the voltage across the sense resistor reaches 0.125 volts. The expected power dissipated across the resistor was Imax2xRsense1 = 2.83 watts. The particular resistor value was chosen purely to minimise the power dissipated in the device. To provide reliable operation, the transistors in the three-phase bridge had to meet certain specifications. The new 42V automotive standard dictated that MOSFETs be capable of 75-volt operation. They also had to have low drain-source resistance to minimise conduction losses. Additionally, N-channel transistors were required to reduce the number of different part numbers in the design. To achieve these requirements, a new 42-volt automotive MOSFET from International Rectifier, the IRF3808 was chosen.

23

IRF3803 Specs [12] N channel 75 volt 140 amps 0.007-ohm drain source resistance $3.70 each Expected conduction losses were calculated using the following formula:

Pon =

ton 2 Ion Rds Ts

where Rds is the drain source resistance of the MOSFET, Ion the full load current, ton is the time for which the switch is on and Ts is the switching period. Worst case conduction losses occur when the converter is running at 100% duty cycle, that is under full load. Under this condition, each transistor is switch on for 33% of each electrical cycle. The power dissipated across the drain-source junction is 1.32 Watts per transistor. Expected switching losses were calculated using the following formula:

1 Psw = VdIofs (tcon + Tcoff ) 2 where Vd is the supply voltage, Io is the current flowing through the device prior to turn off, fs is the switching frequency, tcon is the turn on time of the MOSFET and tcoff is the turn off time of the MOSFET. Using tcon and tcoff times obtained from the IRF3808 datasheet, the worst case switching losses worked out to be 2.03 Watts per transistor. This occurred under full load conditions. Overall expected efficiency: Pswtotal = 6 x 2.03 = 12.2 Watts Pontotal = 6 x 1.32 = 7.9 Watts
24

Ploss total = 20.1 Watts this occurs when the motor controller is running at full power output (1kW). 1000 Pout = = = 98.2% 1000 + 20.1 Pout + Ploss _ total

Therefore expected efficiency, =

25

4.3 Gate Drive

The gate drive circuit forms the interface between the micro controller and the power MOSFETs. The gate drive circuit has two purposes. Firstly, it buffers the gate signals generated by the micro controller. The micro controller can only source a maximum of 20mA from each pin. The peak charging current required to turn MOSFETs may be as high as 2 amps. This is due to the high switching frequency used along with the inherent gate capacitance of the MOSFET. The second purpose of the gate drive circuit is to generate the gate voltages required to activate the topside transistor. To turn on an N-channel FET, the gate source voltage must be greater than the inherent threshold voltage i.e. Vgs>Vth. This implies that in order to turn on transistors Q1 of figure2, the gate voltage would need to be VphaseA+Vth. If the voltage across phase A is 42 volts, and 12 volts were required to turn the transistor on, a gate voltage of 54 volts would be needed. Since the supply voltage is only 42 volts, high side gate drivers incorporate bootstrapping techniques to generate the required voltages. The effective high side gate voltage generated by the gate driver is given by:

Vg=VphaseA + 12V - Vd4


where Vd4 is the forward voltage of diode, d4.

Figure 8 Gate Drive Schematic [2]

The gate driver chosen for the design was an International Rectifier IR2101. It has in a single 8-pin package both a high and low side gate driver. As such, one IR2101 is

26

capable of driving one MOSFET pair. Since the motor controller is intended for a three-phase motor, there are three identical gate driver circuits. From figure 8, U4 is the IR2101 gate driver; diode D4 and capacitor C8 form the bootstrapping arrangement for the high side gate driver. MOSFET Q1 is the topside transistor and Q2 is the low side transistor. Resistors RG1 and RG2 are 15 ohm series current limiting resistors. There sole purpose is to limit the initial gate inrush current to protect the gate drivers. Pulse width modulation (PWM) is applied to the low side transistors while the high side switches are simply on or off.
IR2101s Specs [13] Logic level inputs Reverse voltage immune Bootstrap operational up to +600 volts 10 to 20 volt supply SOIC8 package Up to 400 kHz switching frequency (thermal limitation) $5.08 each

27

4.4 Power Supply

A power supply circuit was needed to provide power to logic level components as well as other components that were unable to operate from the 42-volt supply rail. The gate drive circuitry, signal amplifier, and Hall Effect sensors required 12 volts to operate while all of the digital hardware needed 5V. It was decided to create a +12 volt rail from which the 5volt supply would be derived. Linear regulators were out of the question for stepping 42 volts down to 12 volts. The main reason was the large amount of power that would have been dissipated across the linear regulator. Also, commonly and cheaply available regulators only supported input voltages up to 36 volts. An estimated 300 mA was required from the +12-volt rail. From a linear regulator the power dissipation Preg would be:

Preg= ( Vcc-Vout ) Iout= ( 42-12 ) 0.3 = 9watts


for a power output of 3.6 watts. A switch mode regulator was the logical solution for the 12-volt supply. The inexpensive LM2574HVN-adj buck regulator was chosen. The efficiency of this regulator was 84%.
LM2547HVN-adj Specs +60 volt input Adjustable output 52kHz switching frequency 500 mA output DIP-8 package

28

Figure 9 Power Supply Schematic [2]

From figure 9, diode D7 (1N4148), inductor L1 (330uH) and capacitor C4 (220uF) form the output filter for the buck converter. Variable resistor R6 (500k) provides feedback to the regulator and enables the output voltage to be precisely set. Capacitor C5 (0.1uF) is a bypass capacitor for high frequency noise. The 5-volt supply was derived using a linear regulator running off the 12-volt rail. An LM7805 regulator was used.

29

4.5 Current Sense Amplifiers

The current sense amplifiers were required to provide motor current information to the micro controller. Current was sensed in both directions. Under normal operation, the current flows from the +42 volt rail, through the motor and to ground through the current sense resistor. When the motor under goes braking, current flows from ground, through the motor and onto the +42 volt rail. The current needs to be limited to 23.8 amps in both directions to prevent damage to the motors stator winding. Taking direct current measurements from the sense resistor does not utilise the full dynamic range of the analogue to digital converter (ADC) inside the micro controller. Therefore, the current signal needs to be amplified. At full operating current the voltage across Rsense is 0.119 volts. A gain of 39 provides the micro controller with 4.64 volts when the current limit is reached. The resistor values required to achieve this gain are standard values. It also insures that if the current limit is exceeded, the micro controller has enough headroom left to be able to detect the over current condition.

Figure 10 Current Sense Amplifier Schematic [2]

30

A single supply, rail-to-rail opamp, the LMV324 was chosen. The opamp is supplied from the +5V rail, ensuring that the micro controllers ADC doesnt see more than 5V on its inputs. The current signal is amplified differentially to avoid any DC offset due to opamp bias currents. The gain of the opamp circuits is determined by the following formula: G= R14 R16 = R15 R17

R15=R17=1k and R14=R16=39k were used.

31

4.6 Hall Effect Sensor Interface

Most brushless DC motors have incorporated in the stator several Hall Effect sensors. These sensors provide rotor position information to the motor controller. Hall effect sensors are open collector devices as shown in figure 6.

Figure 11 Open Collector Hall Effect Sensor [2]

These devices require a pull up resistor from the collector to a positive supply voltage. In this case the sensor is pulled up to +12volts. The micro controller can only support input voltages up to +5V. To clamp the output voltage, 5.1-volt zenner diodes are connect in reverse bias between the output and ground. To minimise power dissipation in the Hall Effect sensors by limiting current, 10k pull up resistors are used.

32

Figure 12 Hall Effect Sensor Interface Schematic [2]

33

4.7 Pressure Switch Interface

The pressure switch interface allows the connection of pressure switches to the micro controller. Pressure switches are normally closed devices. When the pressure applied to the switch falls below a certain level, the switch becomes open.

Figure 13 Pressure Switch Interface Schematic [2]

When the pressure switches are connected and the systems pressure is above the minimum level, they are required to produce 0 volts at nodes Hpressure and Lpressure. When the system pressure drops below a safe level the switches need to create +5 volts. Using resistor values: R12=R13= 10k and R4=R5=100 When one or both switches are closed (system pressure OK), the output voltage is:

100 Vout = 5 = 0.5volts 10000 This will be read by the micro controller pin as logic low. When one or both switches are open (system pressure low), the output voltage is:
Vout = 5volts

34

since there is no current path. Diodes D8 and D9 are 5.1 volt zenner diodes which clamp the voltage on the micro controller pins to +5.1 volts.

35

4.8 Micro Controller

An Atmel Mega8L, 8 Mhz micro controller was chosen for the task of performing the logic operations required to commutate and control the motor. A micro controller was chosen over a digital signal processor (DSP) to reduce cost and lower the complexity of the associated hardware. Also, development tools and support were readily available for the AVR processors.

Figure 14 Micro Controller Schematic [2]

From figure 14, switches, S1, S2 and S3 are input switches. They allow user control of certain motor controller functions such as direction, mode, start/stop. Headers J5 and J6 are connection points for high side and low side pressure switches. Light emitting diodes (LEDs) LED1, LED2 and LED3 serve as indicators to signal certain conditions inside the motor controller.

36

Component, Y1 is an 8 MHz crystal. Capacitors C6 and C7 are crystal stabilizing capacitors. Resistor, R7 is a pull up resistor for the micro controller reset pin. The micro controllers ADC has a +5-volt reference. Pulse width modulation (PWM) is provided from PORTB1, PORTB2 and PORTB3.
Atmel AVR Mega8L Specs [10] 8 MIPS at 8 MHz clock 3.3 to 5V operation 3 8-bit PWM channels 5 10-bit ADC channels 3 internal timer units DIP-8 package $7.38

37

4.9 Temperature Sensor

Temperature sensor information is used to control motor speed. When the desired temperature has been reached, the motor can be run at lower speed. A national instruments LM35 was chosen for the application since no further external components are required. The temperature sensor is connected to PORTC3.

Figure 15 Temperature Sensor Schematic [2]

LM35 Specs 1mV per degree celcius TO92 package $

38

Chapter 5 Firmware Implementation


Reliable firmware was critical to reliable motor operation. The micro controller is required to manipulate three PWM channels and three IO channels appropriately to commutate the motor and provide speed control. The firmware was written in the C programming language using Codevision AVR 1.23.8c [11]. Ideally, the firmware was going to perform the task of a finite state machine. However, the changes in Hall Effect transition was not seen by the controller quick enough, resulting is skipped states and commutation error. The firmware had to be purely combinatorial. The following body of code outlines commutation generation and speed control:
//Commutation code. Motor running with PWM if((S1==0) && (S2==1) /*&& (pressure==1) && (Imax==0)*/) { if((H1==1)&&(H2==0)&&(H3==0)) { if (!startedTiming && throughEnd) { ++loops; /*if (loops >= CHECK_LOOPS) { // Retrieve and reset the timer // (0xFF-TCNT0)*(1/7813) = Time For Revolution in seconds // 60/Rev Time = Revolutions/Second motorSpeed = (CHECK_LOOPS*7813*60/(timerTicks + (0xFF-TCNT0))); if (motorSpeed > MOTOR_RPM && PWM > 0) { int diff; diff = motorSpeed-MOTOR_RPM; PWM -= (diff/CHANGE_DIVISOR) + 1; if (PWM < MIN_PWM) PWM = MIN_PWM; } else if (motorSpeed < MOTOR_RPM && PWM < 0xFF) { int diff; diff = MOTOR_RPM-motorSpeed; PWM += (diff/CHANGE_DIVISOR) + 1; if (PWM > MAX_PWM) PWM = MAX_PWM; } TCNT0 = 0xFF; timerTicks = 0; loops = 0; }*/ startedTiming = 1; throughEnd = 0; }

39

PORTB=t1; OCR1A=PWM; OCR1B=0x00; OCR2=0x00; } if((H1==1)&&(H2==1)&&(H3==0)) { PORTB=t2; OCR1A=PWM; OCR1B=0x00; OCR2=0x00; } if((H1==0)&&(H2==1)&&(H3==0)) { PORTB=t3; OCR2=PWM; OCR1A=0x00; OCR1B=0x00; } if((H1==0)&&(H2==1)&&(H3==1)) { PORTB=t4; OCR2=PWM; OCR1A=0x00; OCR1B=0x00; } if((H1==0)&&(H2==0)&&(H3==1)) { PORTB=t5; OCR1B=PWM; OCR2=0x00; OCR1A=0x00; } if((H1==1)&&(H2==0)&&(H3==1)) { throughEnd = 1; startedTiming = 0; PORTB=t6; OCR1B=PWM; OCR2=0x00; OCR1A=0x00; } //remove this and try if((S1==1)&&(S2==1)) { OCR1B=0x00; OCR1A=0x00; OCR2=0x00; PORTB=0x00; } }

Speed control is achieved by clearing a timer in the first state and then reading it in the last state. The time taken for one electrical cycle is simply the timer value multiplied by the appropriate scaling factor. The timer values are averaged to reduce error. Averaging does however slow down the motor controllers response to load or supply voltage changes. If the motor speed is less than the desired speed, the pulse width modulator (PWM) duty cycle is increases. If speed is higher than desired, duty cycle is decreased. When a low-pressure condition occurs, the motor must be shut down. Monitoring the status of the pressure switches does this
//Motor free wheel on pressure if (pressure ==0) {

40

PORTB=0x00; OCR1B=0x00; OCR1A=0x00; OCR2=0x00; PORTB=0x00; } //pressure switch code if((PIND.6==1)&&(PIND.7==1)) { pressure=1; } if((PIND.6==1)&&(PIND.7==0)) { pressure=0; } if((PIND.6==0)&&(PIND.7==1)) { pressure=0; } if((PIND.6==0)&&(PIND.7==0)) { pressure=0; }

When a low-pressure condition is detected, the motor is free wheeled to a stop by turning off all gate signal outputs. Temperature control is provided by the following code:
//temperature sensor code if(temperature>20) { MOTOR_RPM=1300; PORTD.3=1; PORTD.4=0; } if(temperature<=20) { MOTOR_RPM=1000; PORTD.3=0; PORTD.4=1; }

Once the cabin temperature reaches a preset temperature, the motor desired speed is reduced. Current limiting is implemented as follows:
//current limit code limit to 25 amps if(current>250) { Imax=1; PORTD.5 = 1; } else

41

{ Imax=0; PORTD.5 = 0; }

If the motor current exceed 25 amps, a flag is set. This flags results in all outputs being turned off. A variable was not used for the current limit as the limit is a hard limit and should not be changed. A copy of the micro controller code is available in appendix 3.

42

Chapter 6 Product Evaluation and Results


6.1 Motor Truth table

To drive the motor using Hall Effect sensor information, it was necessary to extract the truth table from the motor. This was accomplished as follows: Connect all three Hall sensor outputs to an oscilloscope. Arbitrarily label the stator phase connections, phase A, phase B and phase C. Connect the oscilloscope such as to measure phase voltage Vac. Turn the rotor by hand, observe and record the state of each hall effect sensor at the peak of the sinusoidal back EMF waveform. 5. Repeat steps 3 and 4 but change the phase voltage being measured. The 1. 2. 3. 4. process is complete when all six states are known.

Clockwise Phase Hall 1 Hall 2 Hall 3 Switch Vac 1 0 0 1,6 Vbc 1 1 0 3,6 Vba 0 1 0 3,2 Vca 0 1 1 5,2 Vcb 0 0 1 5,4 Vab 1 0 1 1,4 Counter clockwise

Vca 0 Vcb 0 Vab 1 Vac 1 Vbc 1 Vba 0 Table 2 Motor truth table

1 0 0 0 1 1

1 1 1 0 0 0

5,2 5,4 1,4 1,6 3,6 3,2

Table 2 summarises the motor truth table. Also included is the transistor pair that must be switched to energise the required phases. Both the forward and reverse truth table has been included in the event that the motor is geared or if the load is coupled to the flywheel as opposed to the shaft.

43

6.2 Hardware

A prototype circuit was built and results were obtained.

Figure 16 Motor controller circuit board

Figure 1 shows the motor controller circuit board. A ground plane was placed under the lower power part of the circuit to reduce noise effects and increase the heat spreading area. Reducing noise effect is particularly important to avoid false gate triggering. False gate triggering would lead to cross conduction, which in turn would lead to large amounts of dissipated power. MOSFET failure may or may not occur depending of the temperature of the devices. State machine coding was not possible due to limitation of the micro controller. The changes in Hall Effect sensor states were not detected fast enough for the state machine to be effective. As a result, at high motor speeds, some states were skipped. This defeated the purpose of having a state machine. The state machine code was written in such a manner that if an invalid state was detected, the motor controller would cease to operate until reset. This resulted in proper operation at low speeds up to 400 rpm but resulted in a fault condition for higher speeds.

44

An alternate approach would have been to use a micro controller with three input capture units, or a digital signal processor (DSP). The interrupt associated with the input capture units would have served as the trigger for a change of state. A field programmable gate array (FPGA) may also have been used to produce an application specific IC (ASIC), however, cost would also have been increased.
6.3 Efficiency and Performance

Efficiency measurements were taken with surprising results. The efficiency was measured by measuring the power supply line current and voltage. The measured power was compared with motor current and motor supply voltage. The motor current was measured by measuring the voltage across the current sense resistor. The exact resistance of the sense resistor was determined by driving a constant current (1 amp) through the resistor and measuring the resulting voltage across it. The exact resistance was calculated to be 0.0053 ohms. The motor supply voltage was used as the input voltage since during efficiency testing the motor was run with a pulse width of 100%. This meant the motor would be energised with the full supply voltage of 42 volts. The mechanical power was not measured at the motor shaft. It was not required as the project specification defined outputting 1kW from the controller, not the motor.

Motor Phase Measurements


Phase Current 20.9 20.9 21.2 19.4

MOSFET Measurements

Power Supply Measurements


Vin 24 30 36 42 Pin 513.6 651 784.8 827.4 Efficiency 97.14 95.88 96.89 98.16

Duty Motor Pcond Total Conduction Switching Cycle Power Vds(on) per FET loss loss Line 100 501.6 0.165 1.15 6.90 5.103 21.4 100 627 0.161 1.12 6.73 17.2702 21.7 100 763.2 0.191 1.35 8.10 13.5016 21.8 100 814.8 0.14 0.91 5.43 7.168 19.7 Table 3 Summary of efficiency [1]

Switching loss was deduced by subtracting all of the measurable losses and output power from the input power. A maximum theoretical efficiency of 98.2% was calculated. An efficiency of 98.16% was recorded for an 827-watt output. The motor controller couldnt be tested at 1kW output due to the lack of power supplies from

45

which to run the circuit. The 42-volt test was conducted by running the motor from 30 volts to cool down the test room. This reduced the load on the compressor slightly. Then 42 volts was applied. Conduction losses were determined by measuring the drain to source voltage and multiplying it by the motor current. The losses were calculated on a per FET basis then multiplied to get a total power dissipation. Time didnt permit attaching heat sinks to the transistors. The circuit board was placed in the cold air stream of the air conditioner for cooling. Due to the small surface area of the TO-220 transistor packages, the MOSFETs did get hot. The heat was transferred through the transistor legs to the printed circuit board (PCB) tracks. After 30 minutes of operation, the copper tracks were discoloured. Some tracks had begun to lift off the board. Appropriate heat sinking would have avoided this problem. In trying to keep the controller compact, tracks could not be made as wide as required. Instead, copper braid was soldered onto high current tracks. The tracks where then flooded with solder.
6.4 Budget

One of the purposes of this project was to produce a low cost solution. This part of specification was comfortably met. Table 4 lists all parts used in the evaluation board. The total bill of materials was $92.90. The printed circuit board measured 150mm x 100mm. At $2.20 per square inch, the total board cost was $52.80. The board was a large part of the overall cost. This was unavoidable since a plated through board was required due to the number of surface mount components. The overall cost of the hardware was $145.70.

Part Type

Designator C1 C10 C11 C12 C14 C2

Footprint rb.3/.6 Rad-0.2 Rad-0.1 Rad-0.1 Rad-0.1 rb.3/.6

Description Capacitor Capacitor Capacitor Capacitor Capacitor Capacitor

Value 1000uF 0.47uF 0.1uF 0.1uF 0.1uF 1000uF

Supplier Order Code Price Farnell 345-1343 2.92 Farnell 218-522 0.82 Farnell 303-896 0.34 Farnell 303-896 0.34 Farnell 303-896 0.34 Farnell 345-1343 2.92

46

1N4148

1N4148 1N4148 1N4148 1N4148

Fuse Halls Hi Lo

IRF3710 IRF3710 IRF3710 IRF3710 IRF3710 IRF3710

C3 C4 C5 C6 C7 C8 C9 D1 D10 D11 D2 D3 D4 D5 D6 D7 D8 D9 F1 J1 J5 J6 L1 LED1 LED2 LED3 Q1 Q2 Q3 Q4 Q5 Q6 R1 R12 R13 R14 R15 R16 R17 R2 R3 R4 R5 R6 R7 R8 RG1 RG2 RG3 RG4 RG5

rb-.2/.4 rb-.2/.4 Rad-0.2 805 805 Rad-0.2 Rad-0.2 axial-0.3 axial-0.3 axial-0.3 axial-0.3 axial-0.3 axial-0.3 axial-0.3 axial-0.3 axial-0.4 axial-0.4 axial-0.4 pctb2n sip-5 pctb2n pctb2n inductor LED led led to220a to220a to220a to220a to220a to220a 805 805 805 805 805 805 805 805 805 805 805 vr-5 805 805 1206 1206 1206 1206 1206

Capacitor Capacitor Capacitor Capacitor Capacitor Capacitor Capacitor Zener Diode Zener Diode Schottky Diode Zener Diode Zener Diode Schottky Diode Schottky Diode Schottky Diode Schottky Diode Zener Diode Zener Diode Fuse connector Hall Connector Switch Connector Switch Connector 0.5 A inductor

220uF 220uF 0.1uF 22pF 22pF 0.47uF 0.47uF 5.1V 5.1V 5.1V 5.1V

5.1V 5.1V

330uH

N-Channel MOSFET N-Channel MOSFET N-Channel MOSFET N-Channel MOSFET N-Channel MOSFET N-Channel MOSFET 10k 10k 10k 39k 1k 39k 1k 10k 10k 100 100 500k 1k 100 15 15 15 15 15

Potentiometer

Gate resistor Gate resistor Gate resistor Gate resistor Gate resistor

Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell EWS EWS EWS EWS Farnell EWS EWS EWS Polykom Polykom Polykom Polykom Polykom Polykom Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell Farnell

580-480 580-480 303-896 301-9184 301-9184 218-522 218-522 316-2412 316-2412 368-106 316-2412 316-2412 368-106 368-106 368-106 368-106 316-2412 316-2412

322-7340

911-975 911-975 911-975 912-049 911-859 912-049 911-859 911-975 911-975 911-732 911-732 349-318 911-859 911-732 308-7566 308-7566 308-7566 308-7566 308-7566

0.69 0.69 0.34 0.13 0.13 0.82 0.82 0.08 0.08 0.03 0.08 0.08 0.03 0.03 0.03 0.03 0.08 0.08 1 0 1 1 1.61 0.3 0.3 0.3 3.7 3.7 3.7 3.7 3.7 3.7 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 3.15 0.08 0.08 0.05 0.05 0.05 0.05 0.05

47

0.005 Ohm

LM7805 LM2574HVN ATMEGA8 IR2101 IR2101 IR2101 LM358 LM35

RG6 Rnet1 Rsense1 S1 S2 S3 U1 U2 U3 U4 U5 U6 U7 U8 Y1

1206 sip-5 Cshunt sip-2 sip-2 sip-2 to220a DIP8 dip28s dip-8 dip-8 dip-8 dip-8 TO92/E xtal-1

Farnell Farnell Farnell EWS EWS EWS Linear regulator 5V Farnell Switching regulator adjustable Farnell Micro controller Farnell Gate driver Farnell Gate driver Farnell Gate driver Farnell Op amp Farnell Temp. sensor NSC Crystal 8 Mhz Farnell

Gate resistor Connector Sense resistor

15 10k 0.005

308-7566 911-975 327-4780

701-853 412-5708 391-7940 360-7010 360-7010 360-7010 301-2748 samples 103-914 Total

0.05 0.08 2.45 0 0 0 1.09 7.39 14.33 6.3 6.3 6.3 0.55 0 3.98 92.9

Table 4 Bill of materials

The IR2101 gate drivers were one of the most expensive components since three parts were required. The IRF3808 transistors were extremely well priced. They were the only 75-volt automotive rated transistors available at design time. They also meet all of the required specifications for drain-source resistance.

48

Chapter 7 Future Developments

Future improvements to the motor controller design may be made to make the controller more flexible. For its intended application, the current design is satisfactory. However, to run motors at higher speeds, a faster controller would be an option. The best way to make a universal controller would be using a field programmable gate array (FPGA) to produce an application specific controller. Though the MOSFET bridge, gate driver, power supplies and sensor interfaces worked as required, a redesign of the digital controller would provide a significant improvement to the overall motor controller. A digital signal processor would be the logical choice. Alternatively, a dedicated, off the shelf controller IC could be used along with a small micro controller to perform the control loop calculations. This would alleviate the need for external gate drivers, reducing the cost of the solution along with the problem of slow controllers. A possible solution would be using the Allegro A3932 coupled to an 8 bit micro controller. A further size reduction may be possible by using a MOSFET pack rather than discrete transistors. However, finding a FET pack with the required characteristics may prove difficult while the 42 volt automotive standard is still in its early days. Currently available transistor packs would reduce the overall efficiency of motor controller due to there higher drain to source resistance. A suitable enclosure for the motor controller would add to its appeal and practicality. Integrating the heat sinks into the package would reduce the size of the overall solution. Aluminium would ideally be used.

49

Chapter 8 Conclusion
Though this project resulted in a successful prototype, the potential exist for improvement to certain parts of the design. Most parts of the design functioned perfectly, while others could have been improved. The power interface, made up of the MOSFET bridge, gate driver and current sensing amplifier performed well. The digital part of the motor controller, though performed well for low speed, could have been improved. A redesign of the digital hardware would have been required. The results obtained outlined the success of the prototype circuit for its intended application. The measured efficiencies were very close to the calculated efficiency. At 42-volt operation, an efficiency of 98.16 was measured. The calculated maximum efficiency was 98.2%. Design factors, heat sinking in particular needed more attention. The effects of heat sinking didnt become evident until the controller was tested under full load. Also made evident was the need to modify the printed circuit board to carry the required currents without resulting in board stress and damage.

50

References

[1] Advanced PM brushless DC motor control and system for electric vehicles Fang Lin Luo; Hock Guan Yeo; Industry Applications Conference, 2000. Conference Record of the 2000 IEEE , Volume: 2 , 2000 Page(s): 1336 -1343 vol.2 [2] Permanent magnet brushless DC motors for consumer products Bentouati, S.; Zhu, Z.Q.; Howe, D.; Electrical Machines and Drives, 1999. Ninth International Conference on (Conf. Publ. No. 468) , 1999 Page(s): 118 122 [3] Electric drives for pump, fan, and compressor loads in automotive applications McCleer, P.J.; Industrial Electronics, 1995. ISIE '95., Proceedings of the IEEE International Symposium on , Volume: 1 , 10-14 Jul1995 Page(s): 80 -85 vol.1 [4] Automotive electrically driven air conditioner system Oldenkamp, J.L.; Erdman, D.M.; Automotive Power Electronics, 1989 , 28-29 Aug 1989 Page(s): 71 72 [5] Design of an integrated motor/controller drive for an automotive water pump application Harris, N.C.; Jahns, T.M.; Surong Huang; Industry Applications Conference, 2002. 37th IAS Annual Meeting. Conference Record of the , Volume: 3 , 2002 Page(s): 2028 -2035 vol.3

51

[6] A novel based-based sensorless brushless DC (BLDC) motor drive for automotive fuel pumps Jianwen Shao; Nolan, D.; Teissier, M.; Swanson, D.; Industry Applications Conference, 2002. 37th IAS Annual Meeting. Conference Record of the , Volume: 4 , 2002 Page(s): 2386 -2392 vol.4 [7] Texas Instruments Appl Note SPRU469 [8] Electrical Machines for Drives Slemon, G. R.; Power Electronics and Variable Frequency Drives, 1996, p62 65. IEEE Press [9] MC33035, NCV33035 Datasheet, On Semiconductor, 2003 [10] Atmel AVR Atmega8 Datasheet, Atmel Corporation, 2003 [11] HP InfoTech. Codevision AVR. 2003 (v1.23.8c) Available: http://www.hpinfotech.ro/html/cvavr.htm [12] IRF3808 Datasheet, International Rectifier, 2003 [13] IR2101 Datahseet, International Recifier, 2003

52

Appendix

53

Appendix 1

Motor Phase Measurements


Vin 24 30 36 42 Pin 513.6 651 784.8 827.4 Efficiency 97.14 95.88 96.89 98.16

MOSFET Measurements

Power Supply Measurements

Phase A Current 20.9 20.9 21.2 19.4

Duty Cycle 100 100 100 100

Motor Power 501.6 627 763.2 814.8

Pcond Total Conduction Switching Vds(on) per FET loss loss Line 0.165 1.15 6.90 5.103 21.4 0.161 1.12 6.73 17.2702 21.7 0.191 1.35 8.10 13.5016 21.8 0.14 0.91 5.43 7.168 19.7

54

Appendix 2
3 6 U1 IN C3 2 Sig GND On/Off PWR GND D11 Vin 5 Vfb D D7 C4 NC 6 + Output 3 4 7 2 L1 GND +12V 1 LM7805 OUT 3 Vfb FB NC 1 8 +12V +5V U2 4 5

+12V +12V +12V

J1

R1

R2

+12v

R3

R6 C5

5 4 3 2 1

H1

H2

D1

H3

Halls J2 F1 4 3 2 1 FUSE2 + C1 + C2 +12V U4 C8 PhaseA RG1 Q1 IRF3710 Q3 IRF3710 Vcc Hin Lin COM D5 +12V U5 C9 PhaseB PhaseA +12V U6 C10 PhaseC Vcc Hin Lin COM Vboot HO Vs LO 8 7 6 5 D6 PhaseB RG3 RG5 Vboot HO Vs LO 8 7 6 5 D4 PWR Hin1 1 2 3 4

D2

D3

+5V

R7

Q5 IRF3710

U3

C6

Hin2

RST PD0 PD1 PD2 PD3 PD4 +5V 1 2 3 4 Vcc Hin Lin COM Vboot HO Vs LO 8 7 6 5

PhaseA PhaseC

Output PhaseB PhaseC

Y1 MOSI

C7

1 2 3 4 5 6 J3

1 2 3 4 5 6 7 8 9 10 11 PD5 12 Hpressure 13 Lpressure 14 Hin3 PC5 PC4 PC3 PC2 PC1 PC0 GND ARef AVcc PB5 PB4 PB3 PB2 PB1 Hin3 1 2 3 4

PC6 PD0 PD1 PD2 PD3 PD4 Vcc Gnd PB6 (XTAL) PB7 (XTAL) PD5 PD6 PD7 PB0

28 Vsense2 27 Vsense1 26 TEMP 25 H3 24 H2 23 H1 22 21 +5V 20 +5V 19 Hin2 SCK 18 MISO Hin1 17 16 15

ATMEGA8

RG4 Q2 IRF3710 RG2 VCC 1 VCC Rsense1 0.005 Ohm Rsense GND U8 LM35 TEMP 2 Vout Q4 IRF3710

RG6 Q6 IRF3710

Rnet1

PD2 PD1 PD0

B 3

5 4 3 2 1

S3 S2 S1

+5V +5V +5V

+5V D10 R8

Vsense1

LED1 PD3 PD4 R14 LED3 +12V PD5 C12 R15 Rsense R17 LED2

R12

R4

J5

D8

2 1 U7

+5V

Hpressure

Hi 1 2 3 4

Out1 In1In1+ -Vcc LM358

+Vcc Out2 In2In2+

8 7 6 5 R16 C11

R13 C14 Title Size B Date: File: 3 4 5 29-Oct-2003 E:\Protel\mega8.ddb Sheet of Drawn By: 6 Number Revision A

J6

2 1

R5

D9

Lpressure

Lo

55

Appendix 3

#include <mega8.h> #include <math.h> #define H1 PINC.0 #define H2 PINC.1 #define H3 PINC.2 #define S1 PIND.0 #define S2 PIND.1 #define S3 PIND.2 #define t1 0x12 #define t2 0x22 #define t3 0x28 #define t4 0x09 #define t5 0x05 #define t6 0x14 int PWM=150; int temperature=0; int current=0; //char pressure=1; char Imax=0; volatile long timerTicks = 0; int startedTiming = 0; int throughEnd = 1; long motorSpeed; int loops = 0; int MOTOR_RPM=900;

#define CHECK_LOOPS 5 //#define MOTOR_RPM 1500 #define CHANGE_DIVISOR50 #define FIRST_ADC_INPUT 3 #define LAST_ADC_INPUT 5 unsigned char adc_data[LAST_ADC_INPUT-FIRST_ADC_INPUT+1]; #define ADC_VREF_TYPE 0x20 // ADC interrupt service routine // with auto input scanning 56

#pragma savereginterrupt [ADC_INT] void adc_isr(void) { #asm push r26 push r27 push r30 push r31 in r30,sreg push r30 #endasm register static unsigned char input_index=0; // Read the 8 most significant bits // of the AD conversion result adc_data[input_index]=ADCH; // Select next ADC input if (++input_index > (LAST_ADC_INPUT-FIRST_ADC_INPUT)) input_index=0; ADMUX=(FIRST_ADC_INPUT|ADC_VREF_TYPE)+input_index; // Start the AD conversion ADCSRA|=0x40; #asm pop r30 out sreg,r30 pop r31 pop r30 pop r27 pop r26 #endasm temperature=(char) ((int) adc_data[0]*100)/256; current=adc_data[1]; } #pragma savereg+

// Timer 0 overflow interrupt service routine interrupt [TIM0_OVF] void timer0_ovf_isr(void) { timerTicks += 0xFF; } void main(void) { PORTB=0x00; DDRB=0x3F; PORTC=0x00; DDRC=0x00; PORTD=0x00; DDRD=0x38;

57

// Timer/Counter 0 initialization // Clock source: System Clock // Clock value: 7.813 kHz TCCR0=0x05; TCNT0=0x00; // Timer/Counter 1 initialization // Clock source: System Clock // Clock value: 8000.000 kHz // Mode: Ph. correct PWM top=00FFh // OC1A output: Non-Inv. // OC1B output: Non-Inv. // Noise Canceler: Off // Input Capture on Falling Edge TCCR1A=0xA1; TCCR1B=0x01; TCNT1H=0x00; TCNT1L=0x00; OCR1AH=0x00; OCR1AL=0x00; OCR1BH=0x00; OCR1BL=0x00; TCCR2=0x61; ASSR=0x00; TCNT2=0x00; OCR2=0x00; TCNT0=0xff;

// Timer/Counter 2 initialization // Clock source: System Clock // Clock value: 8000.000 kHz // Mode: Phase correct PWM top=FFh // OC2 output: Non-Inverted PWM ASSR=0x00; TCCR2=0x61; TCNT2=0x00; OCR2=0x00; // External Interrupt(s) initialization // INT0: Off // INT1: Off GICR|=0x00; MCUCR=0x00; // Timer(s)/Counter(s) Interrupt(s) initialization TIMSK=0x00 | 0x01;

58

// Analog Comparator initialization // Analog Comparator: Off // Analog Comparator Input Capture by Timer/Counter 1: Off // Analog Comparator Output: Off ACSR=0x80; SFIOR=0x00; // ADC initialization // ADC Clock frequency: 62.500 kHz // ADC Voltage Reference: AREF pin // ADC High Speed Mode: Off // ADC Auto Trigger Source: None // Only the 8 most significant bits of // the AD conversion result are used ADMUX=FIRST_ADC_INPUT|ADC_VREF_TYPE; ADCSRA=0xCF; SFIOR&=0xEF; #asm("sei") while (1) { //Commutation code. Motor running with PWM if((S1==0) && (S2==1)) { if((H1==1)&&(H2==0)&&(H3==0)) { if (!startedTiming && throughEnd) { ++loops; if (loops >= CHECK_LOOPS) { // Retrieve and reset the timer // (0xFF-TCNT0)*(1/7813) = Time For Revolution in seconds // 60/Rev Time = Revolutions/Second motorSpeed = (CHECK_LOOPS*7813*60/(timerTicks + (0xFF-TCNT0))); if (motorSpeed > MOTOR_RPM && PWM > 0) { int diff; diff = motorSpeed-MOTOR_RPM; PWM -= (diff/CHANGE_DIVISOR) + 1; if (PWM < MIN_PWM) PWM = MIN_PWM; } else if (motorSpeed < MOTOR_RPM && PWM < 0xFF)

59

{ int diff; diff = MOTOR_RPM-motorSpeed; PWM += (diff/CHANGE_DIVISOR) + 1; if (PWM > MAX_PWM) PWM = MAX_PWM; } TCNT0 = 0xFF; timerTicks = 0; loops = 0; } startedTiming = 1; throughEnd = 0; } PORTB=t1; OCR1A=PWM; OCR1B=0x00; OCR2=0x00; } if((H1==1)&&(H2==1)&&(H3==0)) { PORTB=t2; OCR1A=PWM; OCR1B=0x00; OCR2=0x00; } if((H1==0)&&(H2==1)&&(H3==0)) { PORTB=t3; OCR2=PWM; OCR1A=0x00; OCR1B=0x00; } if((H1==0)&&(H2==1)&&(H3==1)) { PORTB=t4; OCR2=PWM; OCR1A=0x00; OCR1B=0x00; } if((H1==0)&&(H2==0)&&(H3==1)) { PORTB=t5; OCR1B=PWM; OCR2=0x00; OCR1A=0x00;

60

} if((H1==1)&&(H2==0)&&(H3==1)) { throughEnd = 1; startedTiming = 0; PORTB=t6; OCR1B=PWM; OCR2=0x00; OCR1A=0x00; } /* //remove this and try if((S1==1)&&(S2==1)) { OCR1B=0x00; OCR1A=0x00; OCR2=0x00; PORTB=0x00; } */ } /* //free wheel the motor code //Motor free wheel on pressure and current else { PORTB=0x00; OCR1B=0x00; OCR1A=0x00; OCR2=0x00; PORTB=0x00; } */ //pressure switch code /*if((PIND.6==1)&&(PIND.7==1)) { pressure=1; } if((PIND.6==1)&&(PIND.7==0)) { pressure=0; } if((PIND.6==0)&&(PIND.7==1)) { pressure=0; } if((PIND.6==0)&&(PIND.7==0)) { pressure=0;

61

}*/ //temperature sensor code /*if(temperature>20) { MOTOR_RPM=1300; PORTD.3=1; PORTD.4=0; } if(temperature<=20) { MOTOR_RPM=1000; PORTD.3=0; PORTD.4=1; }*/ //current limit code limit to 19.5 amps /*if(current>250) { Imax=1; PORTD.5 = 1; } else { Imax=0; PORTD.5 = 0; }*/ }; }

62

You might also like