AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt...

26
AVR492: Brushless DC Motor Control using AT90PWM3 Features BLDC Motor Basics PSC use Hardware Implementation Code Example Introduction This application note describes how to implement a brushless DC motor control in sensor mode using AT90PWM3 AVR microcontroller. The high performance of AVR core fitted with Power Stage Controller module of AT90PWM3 enable the design of high speed brushless DC motor applications. In this document, we give a short description of brushless DC motor theory of opera- tion, we detail how to control brushless DC motor in sensor mode and also give the hardware description of ATAVRMC100 reference design used in this application note. Software implementation is also discussed with software control loop using PID filter. This application note deals only with BLDC motor control application using Hall effect position sensors to control commutation sequence. AVR Microcontrollers Application Note 7518A–AVR–07/05

Transcript of AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt...

Page 1: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

AVR492: Brushless DC Motor Control using AT90PWM3

Features• BLDC Motor Basics• PSC use• Hardware Implementation• Code Example

IntroductionThis application note describes how to implement a brushless DC motor control insensor mode using AT90PWM3 AVR microcontroller.

The high performance of AVR core fitted with Power Stage Controller module ofAT90PWM3 enable the design of high speed brushless DC motor applications.

In this document, we give a short description of brushless DC motor theory of opera-tion, we detail how to control brushless DC motor in sensor mode and also give thehardware description of ATAVRMC100 reference design used in this application note.

Software implementation is also discussed with software control loop using PID filter.

This application note deals only with BLDC motor control application using Hall effectposition sensors to control commutation sequence.

AVR Microcontrollers

Application Note

7518A–AVR–07/05

Page 2: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

2 AVR 492 Application Note7518A–AVR–07/05

Theory of Operation Brushless DC motors are used in a growing number of motor applications as they havemany advantages:1. They have no brushes so they required little or no maintenance.2. They generate less acoustic and electrical noise than universal brushed DC

motors.3. They can be use in hazardous operation environment (with flammable products).4. They have a good weight/size to power ratio...

Such types of motor have a little rotor inertia, the coils are attached to the stator. Thecommutation is controlled by electronics. Commutation times are provided either byposition sensors or by coils Back Electromotive Force measuring.

In sensor mode, Brushless DC motor usually consists of three main parts. A Stator, aRotor and Hall Sensors.

Stator A basic three phases BLDC motor Stator has three coils. In many motors the number ofcoils is replicated to have a smaller torque ripple.

Figure 1 shows the electrical schematic of the stator. It consists of three coils eachincluding three elements in series, an inductance, a resistance and one back electromo-tive force.

Figure 1. Stator Electrical Configuration (Three phases, three coils)

Rotor The rotor in a BLDC motor consists of an even number of permanent magnets. Thenumber of magnetic poles in the rotor also affects the step size and torque ripple of themotor. More poles give smaller steps and less torque ripple. The permanent magnets gofrom 1 to 5 pairs of poles. In certain cases it can goes up to 8 pairs of poles.(Figure 2).

L

bemf A

bemf B

bemf C

L,R

L,R L,R

Page 3: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

3

AVR 492 Application Note

7518A–AVR–07/05

Figure 2. Three phases, three coil BLDC motor stator and rotor

The coils are stationary while the magnet is rotating. The rotor of the BLDC motor islighter than the rotor of a conventional universal DC motor where the coils are placed onthe rotor.

Hall Sensor For estimating the rotor position, three hall sensors are positioned. These hall sensorsare separated by 120° each. With these sensors, 6 different commutations are possible.Phase commutation depends on hall sensor values.

Power supply to the coils change when hall sensor values change. With right synchro-nized commutations, the torque remain nearly constant and high.

Figure 3. Hall Sensors signals for CW rotation

Phases Commutation To simplify the explanation of how to operate a three phases BLDC motor a typicalBLDC motor with only three coils is considered. As previously shown, phases commuta-tion depends on the hall sensor values. When motor coils are correctly supplied, amagnetic field is created and rotor moves. The most elementary commutation drivingmethod used for BLDC motors is an on-off scheme: a coil is either conducting or notconducting. Only two windings are supplied at the same time the third winding is float-ing. Connecting the coils to the power and neutral bus induces the current flow. This isreferred to as trapezoidal commutation or block commutation.

N S

coils A

coils C

coils B

Rotor

Stator

N

S

coils A

coils C

coils B

Rotor

Stator

N

S

1 pair of poles 2 pairs of poles

t

t

t

Hall_A

Hall_B

Hall_C

t

t

t

Coil_A

Coil_B

Coil_C

Page 4: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

4 AVR 492 Application Note7518A–AVR–07/05

To command brushless DC motors, a power stage made of 3 half bridges is used. Fig-ure 4 below shows 3 half bridges schematic.

Figure 4. Power Stage

Reading hall sensor value, indicate which switch should be closed.

For motors with multiple poles the electrical rotation does not correspond to a mechani-cal rotation. A four pole BLDC motor uses four electrical rotation cycles to have onemechanical rotation.

The strength of the magnetic field determines the force and speed of the motor. By vary-ing the current flow through the coils the speed and torque of the motor can be adjusted.The most common way to control the current flow is to control the average current flowthrough the coils. PWM(Pulse Width Modulation) is used to adjust the average voltageand thereby the average current, including the speed. The speed can be adjusted with ahigh frequency from 20 khz to 60 khz.

For a three phase, three coils BLDC motor, the rotating field is described in Figure 5.

Table 1. Switches commutation for CW rotation

Hall Sensors Value (Hall_CBA) Phase Switches

101 A-B SW1 ; SW4

001 A-C SW1 ; SW6

011 B-C SW3 ; SW6

010 B-A SW3 ; SW2

110 C-A SW5 ; SW2

100 C-B SW1 ; SW4

CmdSW1

CmdSW2

CmdSW3

CmdSW4

CmdSW5

CmdSW6

VDC

-

+

+DC

CBA

0

Page 5: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

5

AVR 492 Application Note

7518A–AVR–07/05

Figure 5. Commutation steps and rotating field

Commutation creates a rotating field. Step1 Phase A is connected to the positive DCbus voltage by SW1 and Phase B is connected to ground by SW4, Phase C is unpow-ered. Two flux vectors are generated by phase A (red arrow) and phase B (blue arrow)the sum of the two vectors give the stator flux vector (green arrow). Then the rotor triesto follow stator flux. As soon as the rotor reach a certain position when the hall sensorsstate changes its value from “010” to “011” a new voltage pattern is selected and appliedto the BLDC motor. Then Phase B is unpowered and Phase C is connected to theground. It results in a new stator flux vector ‘Step2’.

By following the commutation schematic Figure 3 and Table 1, we obtain six differentsstator flux vectors corresponding to the six commutation steps. The six steps provideone rotor revolution.

coil A

coil C

coil B

coil A

coil C

coil B

Step1 Step2

coil A

coil C

coil B

coil A

coil C

coil B

Step3 Step4coil A

coil C

coil B

coil A

coil C

coil B

Step5 Step6

Hall_CBA011

010

110

100

101

001

Page 6: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

6 AVR 492 Application Note7518A–AVR–07/05

Starter KIT ATAVRMC100

After this brief theoretical presentation of Brushless DC Motor Control, the practicalimplementation will be introduced with the help of an example. The next part of thisapplication note will deal with the hardware and the software implementation based onthe starter kit ATAVRMC100 running with a microcontroller AT90PWM3.

Electrical schematics are available Figure 21, Figure 22, Figure 23 and Figure 24 at theend of the document. They describe the reference design for the Starter KitATAVRMC100.

The software includes the control of the speed through a PID corrector. Such a correctoris composed of three main coefficients : KP, KI, and KD.

KP is the proportionnal gain coefficient, KI is the integral gain coefficient and KD is thederivative gain coefficient. The error between the desired speed and the real speed(called error in the Figure 6) is multiplied by each gain. Then, the sum of the three ther-mes give the command to apply to the motor to get the right speed (Figure 6).

Figure 6. PID diagram

The KP coefficient fixes the motor response time, the KI coefficient is used to cancel thestatic error and the KD is used in particular for position regulation(refer to regulation loopin software description for tuning the coefficients).

++

+

commanderror

PID corrector

desired_speed

real_speed

+-

BLDC Motor+

Power StageKI∫

tdd KD

KP

command t( ) KP eror t( ) KI error t( ) t( )d∫+× KDtdd error t( )+=

error t( ) desired_speed t( ) _speed t( )real–=

Page 7: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

7

AVR 492 Application Note

7518A–AVR–07/05

Hardware Description

As shown in Figure 7 the microcontroller contains 3 Power Stage Controller (PSC).Each PSC can be seen as a Pulse Width Modulator with two output signals. To avoidcross conduction a Dead Time control is integrated (see AT90PWM3 datasheet formore information about PSC or Figure 9 below).

A fault input (Over_Current) is linked to PSCIN. This fault input enables the microcon-troller to disable all PSC outputs.

Figure 7. Hardware implementation

It’s possible to measure the current with two differential amplified channels with pro-grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to theamplifier conversion range.

The Over_Current signal results from an external comparator. The comparator’s refer-ence can be adjusted by the internal DAC.

The phase commutation has to be done according to hall sensors value. HallA, HallBand HallC are connected to external interrupt sources or to the three internal compara-tors. The comparators generate the same type of interrupts as the external interrupts.Figure 8 shows how the microcontroller I/O ports are used in the starter kit.

AT90PWM3

MotorPower Bridge

PSC

OU

T

PSCINAMP1+;AMP1-

ACMP0

Over_CurrentCurrent

PSC00PSC10PSC20

PSC01PSC11PSC21

PH_A

PH_B

PH_C

HallAHallBHallC

ACMP1ACMP2

+Shunt resistor

PSCij : Power Stage Controller i (i = 0,1,2) output j (j = 0,1)ACMPi : Analog Comparator Positive input (i = 0,1,2)AMPi+/- : Analog Differential Amplified channel Positive/Negative inputs (i = 0,1,2)

Page 8: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

8 AVR 492 Application Note7518A–AVR–07/05

Figure 8. Microcontroller I/O Ports use (SO32 package)

VMOT and VMOT_Half are implemented but not used. They can be used to get thevalue of the motor supply.

The outputs H_x and L_x are used to control the power bridge. As previously seen, theydepend on the Power Stage Control (PSC) which generate PWM signals. For suchapplication the recommended mode is the Center Aligned Mode (see Figure 9), the reg-ister OCR0RA is used to adjust ADC synchronization for current measurement.

Figure 9. PSCn0 & PSCn1 Basic Waveforms in Center Aligned Mode

O p e ra t in g M o d e

P O R T B P IN P o r t F u n c t io n S E N S O RP B 0 /M IS O /P S C O U T 2 0 1 2 H _ C H _ CP B 1 /M O S I /P S C O U T 2 1 1 3 L _ C L _ CP B 2 /A D C 5 / IN T 1 2 0 V M O T V M O TP B 3 /A M P 0 - 2 7 E X T 1P B 4 /A M P 0 + 2 8 E X T 2P B 5 /A D C 6 / IN T 2 3 0 E X T 5P B 6 /A D C 7 /P S C O U T 1 1 / IC P 1 B 3 1 L _ B L _ BP B 7 /A D C 4 /P S C O U T 0 1 /S C K 3 2 L _ A L _ A

P O R T CP C 0 / IN T 3 /P S C O U T 1 0 2 H _ B H _ BP C 1 /P S C IN 1 /O C 1 B 7 E X T 3P C 2 /T 0 /P S C O U T 2 2 1 0 E X T 4P C 3 /T 1 /P S C O U T 2 3 1 1 L IN _ N S L PP C 4 /A D C 8 /A M P 1 - 2 1 V _ S h u n t - V _ S h u n t -P C 5 /A D C 9 /A M P 1 + 2 2 V _ S h u n t+ V _ S h u n t +P C 6 /A D C 1 0 /A C M P 1 2 6 H a l lB / B E M F _ B H a l lBP C 7 /D 2 A 2 9 D A C _ O U T D A C _ O U T

P O R T DP D 0 /P S C O U T 0 0 /X C K /S S _ A 1 H _ A H _ AP D 1 /P S C IN 0 /C L K O 4 O v e r _ C u r r e n t O v e r _ C u r r e n tP D 2 /P S C IN 2 /O C 1 A /M IS O _ A 5 M IS O / E X T 1 0P D 3 /T X D /D A L I /O C 0 A /S S /M O S I_ A 6 M O S I / L IN T x D / T x D

/ E X T 7P D 4 /A D C 1 /R X D /D A L I / IC P 1 A /S CK _ A 1 6 S C K / L IN R x D / R x D

/ P O T / E X T 8P D 5 /A D C 2 /A C M P 2 1 7 H a l lC / B E M F _ C H a l lCP D 6 A D C 3 /A C M P M /IN T 0 1 8 V M O T _ H a l f V M O T _ H a l fP D 7 /A C M P 0 1 9 H a l lA / B E M F _ A H a l lA

P O R T EP E 0 /R E S E T /O C D 3 N R E S / E X T 9P E 1 /O C 0 B /X T A L 1 1 4 E X T 6P E 2 /A D C 0 /X T A L 2 1 5 L E D

D e p e n d o n t h e c o m m u n ic a t io n m o d e

D e p e n d o n t h e c o m m u n ic a t io n m o d e

D e p e n d o n t h e c o m m u n ic a t io n m o d e

D e p e n d o n t h e c o m m u n ic a t io n m o d e

OCRnRBOCRnSBOCRnSA

0

PSCn0

PSCn1

PSC Cycle

On Time 0

On Time 1 On Time 1

Page 9: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

9

AVR 492 Application Note

7518A–AVR–07/05

• On Time 0 = 2 * OCRnSA * 1/Fclkpsc• On Time 1 = 2* (OCRnRB - OCRnSB + 1) * 1/Fclkpsc• PSC Cycle = 2 * (OCRnRB + 1) * 1/Fclkpsc

The dead time value between PSCn0 and PSCn1 is :• |OCRnSB - OCRnSA| * 1/Fclkpsc

The input clock of PSC is given by CLKPSC. Clock input from I/O clock or from PLL.

Two strategies can be employed for the PWM signals applied on the power stage. Thefirst consists in applying the PWM signals on the high side AND the low side of thepower bridge and the second in applying the PWM signals only on the high side of thepower bridge.

Page 10: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

10 AVR 492 Application Note7518A–AVR–07/05

Software Description Atmel provides libraries to control Brushless DC motors. The first step is to configureand initialize the microcontroller.

Microcontroller Configuration and Initialization

The function to be used is named mc_init_motor(). It calls hardware and software initial-ization functions and initialize all motor parameters (motor direction, motor speed andstop the motor).

Software Implentation Diagram After microcontroller configuration and initialization, the motor can be started. Only fewfunctions are needed to control the motor. All user functions are define in mc_lib.h:

void mc_motor_run(void)

• Used to start the motor. The regulation loop function is launched to set the duty cycle. Then the first phases commutation is executed.

Bool mc_motor_is_running(void)

• Get the motor state. If ‘TRUE’ the motor is running. Else if ‘FALSE’ the motor is stopped.

void mc_motor_stop(void)

• Used to stop the motor.

void mc_set_motor_speed(U8 speed)

• Set the user requested speed.

U8 mc_get_motor_speed(void)

• Return the current user requested speed.

void mc_set_motor_direction(U8 direction)

• Set the motor direction, ‘CW’ or ‘CCW’.

U8 mc_get_motor_direction(void)

• Return the current direction of rotation of the motor.

U8 mc_set_motor_measured_speed(U8 measured_speed)

• Save the measured speed in the measured_speed variable.

U8 mc_get_motor_measured_speed(void)

• Get the measured speed.

void mc_set_Close_Loop(void)

void mc_set_Open_Loop(void)

• Set type of regulation Open Loop or Close Loop. See Figure 13 for more information.

Page 11: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

11

AVR 492 Application Note

7518A–AVR–07/05

Figure 10. AT90PWM3 Configuration

mc_init_motor()

mc_init_HW() mc_init_SW()

mc_init_port()

mc_init_pwm()

mc_init_IT()

mc_config-estimation_speed()

mc_config_sampling_time()

Enable_Interrupt()

PSC2_Init()

PSC1_Init()

PSC0_Init()

+ motor direction initialization+ motor speed initialization+ Stop the motor

Timer1 configuration

Timer0 configuration

mc_init_comparator0()mc_init_comparator1()mc_init_comparator2()

mc_init_DAC()mc_init_ADC()

mc_init_current_measure()mc_set_Over_Current()

Page 12: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

12 AVR 492 Application Note7518A–AVR–07/05

Figure 11. Software Implentation Diagram.

mc_

switc

h_co

mm

utat

ion(

)m

c_du

ty_c

ycle

()

Set_

QxQ

y()

mc_

hall_

a()

mc_

hall_

b()

mc_

hall_

c()

H_A L_A

H_B L_B

H_C L_C

Hal

lA

Hal

lB

Hal

lC

mai

n()

Softw

are

Har

dwar

eH

ardw

are

mc_set_motor_direction()

mc_motor_stop()

mc_motor_run()

Hal

lAH

allB

Hal

lC

mc_

regu

latio

n_lo

op()

mc_set_motor_speed()

mc_set_Close_Loop()

mc_set_Open_Loop()

mc_

laun

ch_s

ampl

ing_

perio

d()

mc_

estim

atio

n_sp

eed(

)

ovfl_

timer

()Ti

mer

0

Tim

er1

TIM

ER0_

OVF

_vec

t

TIM

ER1_

CO

MPA

_vec

t

all 2

50us

g_tic

t_tim

er =

8us

TCNT0

ovf_timer

mc_

mea

sure

d_sp

eed

mc_

dire

ctio

nm

c_cm

d_sp

eed

mc_

run_

stop

duty

_cyc

le

mc_get_motor_direction()

mc_motor_is_runing()

mc_get_motor_direction()

mc_get_motor_speed()

mc_

get_

mot

or_s

peed

()

mc_

get_

duty

_cyc

le()

mc_set_motor_measured_speed()

mc_get_motor_measured_speed()

Page 13: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

13

AVR 492 Application Note

7518A–AVR–07/05

Figure 11 shows four variables mc_run_stop, mc_direction, mc_cmd_speed andmc_measured_speed. They are the main software variables which can be accessed byuser functions previously described.

The software can be seen as a black box named Motor Control (Figure 12) with inputs (mc_run_stop, mc_direction, mc_cmd_speed, mc_measured_speed) and output (Allpower bridge signals).

Figure 12. Main Software Variables.

Most of the functions are available in mc_drv.h. Only a few depends on the motor type.Functions can be distributed in four main class :• Hardware initialization

void mc_init_HW(void);

• All hardware initialization are made in this function. We can found ports initialization, interrupts initialization, timers and PSCs.

void mc_init_SW(void);

• Used to initialized software. Enable all interrupts.

void mc_init_port(void);

• Microcontroller I/O ports initialization with DDRx register initialization to choose if the pin acts as an Output or an Input and PORTx to activate or not the pull-up on Input.

void mc_init_pwm(void);

• This function start the PLL and sets all PSC registers with their initial values.

void mc_init_IT(void);

• Modifie this function to enable or disable types of interrupts.

mc_run_stop

mc_direction

mc_cmd_speed

Power Bridge Signals

mc_measured_speed

Motor Control H_A<=> L_AH_B<=> L_BH_C<=> L_C

Page 14: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

14 AVR 492 Application Note7518A–AVR–07/05

void PSC0_Init ( unsigned int dt0,

unsigned int ot0,

unsigned int dt1,

unsigned int ot1);

void PSC1_Init ( unsigned int dt0,

unsigned int ot0,

unsigned int dt1,

unsigned int ot1);

void PSC2_Init (unsigned int dt0,

unsigned int ot0,

unsigned int dt1,

unsigned int ot1);

• PSCx_Init allows the user to select the configuration of the Power Stage Control (PSC) of the microcontroller.

• Phases commutation functions

U8 mc_get_hall(void);

• Get the Hall sensors value corresponding to the six commutations steps (HS_001, HS_010, HS_011, HS_100, HS_101, HS_110).

_interrupt void mc_hall_a(void);

_interrupt void mc_hall_b(void);

_interrupt void mc_hall_c(void);

• These functions are executed when an external interrupt is detected (Hall sensor edge). They allow phases commutation and speed calculation.

void mc_duty_cycle(U8 level);

• This function set the PSC duty cycle according to PSC configuration.

void mc_switch_commutation(U8 position);

• The phases commutation is done according to hall sensors value and only if the user start the motor.

• Sampling time configuration

void mc_config_sampling_period(void);

• Initialize the timer1 to generate an interrupt all 250 us.

_interrupt void launch_sampling_period(void);

• When the 250us interrupt is activated, a flag is set. It can be use for sampling time control.

Page 15: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

15

AVR 492 Application Note

7518A–AVR–07/05

• Estimation speed

void mc_config_time_estimation_speed(void);

• Configuration of the timer0 to be use for the speed calculation.

void mc_estimation_speed(void);

• This function calculate the motor speed with the hall sensor periode measure principle.

_interrupt void ovfl_timer(void);

• When an overflow occurs on the timer0 a 8bits variable is increased to obtain a 16bits timer with a 8bits timer.

• Current measure

_interrupt void ADC_EOC(void);

• As soon as the amplifier conversion is finished, the ADC_EOC function is executed to set a flag usable for the user.

void mc_init_current_measure(void);

• This function initializes the amplifier 1 for the current measure.

U8 mc_get_current(void);

• Get the current value if the conversion is finished.

Bool mc_conversion_is_finished(void);

• Indicate if the conversion is finished.

void mc_ack_EOC(void);

• Reset the End Of Conversion flag.

• Over Current detection

void mc_set_Over_Current(U8 Level);

• Set the level of detection of an over current. The level is output by the DAC on external comparator.

Page 16: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

16 AVR 492 Application Note7518A–AVR–07/05

Regulation Loop Two functions select the regulation loop. Open loop or close loop. Figure 13 shows theregu la t ion loop imp lemen ted in the so f tware .The two func t ions a remc_set_Close_Loop() and mc_set_Open_Loop().

Figure 13. Regulation Loop

The close loop consists in a speed regulation loop with the PID corrector.

We will further explain how to adjust the coefficients KP and KI. The KD coefficient ispresent in the regulation loop but not used.

As previously shown, the KP coefficient is used to regulate the motor response time. Ina first time set KI and KD to ‘0’.Try different value of KP to get a right motor responsetime.• If the response time is too slow increase KP gain.• If the response time is quick but unstable decrease KP gain.

Figure 14. Kp tuning

+-

mc_cmd_speed

mc_measured_speed

duty_cycle

PIDMotor

1 : mc_set_Close_Loop() 1 : mc_set_Close_Loop()2 : mc_set_Open_Loop() 2 : mc_set_Open_Loop()

error

2

11

2

0

20

40

60

80

100

120

140

160

0

0,32

0,64

0,96

1,28 1,6

1,92

2,24

2,56

2,88 3,2

time (s)

Spee

d M

easu

red Kp = 1

Kp = 2Kp = 3Kp = 6Speed ConsignRequested Speed

Page 17: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

17

AVR 492 Application Note

7518A–AVR–07/05

KI parameter is used to cancel the static error. Leave the KP coefficient unchanged andset the KI parameter.• If the error is still different from zero increase KI gain.• If the error is cancelled but after oscillations decrease KI gain.

Figure 15. Ki tuning

In the Figure 14 and Figure 15 example, the right parameters are KP = 1, KI = 0.5 andKD = 0.

To adjust KD parameter :• If the reponse is still low increase KD gain.• If the reponse is still unstable decrease KD gain.

One another significant point is the sampling time. It has to be chosen according to theresponse time of the system. The sampling time must be at least twice smaller than theresponse time of the system (according to the Shannon-Nyquist criterie).

Two functions are available for the sampling time configuration (explained previously).They result in a global variable called g_tick which is set all 250us. With this variable it’spossible to configure the sampling time.

CPU & Memory usage All measurements has been realized with Fosc = 8MHz. It also depends on the motortype too (numbers of pair of poles). With a motor of 5 pair of poles, hall sensor frequencyis five times slower than motor rotation.

All results in Figure 16 are obtained with a three phases BLDC motor with five pairs ofpoles and a maximum speed of 14000 rpm.

0

50

100

150

200

250

0 0,4 0,8 1,2 1,6 2 2,4 2,8 3,2 3,6 4

time (s)

Spee

d M

easu

red

Ki=1 ; Kp=1Ki=2 ; Kp=1Ki=0,5 ; Kp=1Speed ConsignRequested Speed

Page 18: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

18 AVR 492 Application Note7518A–AVR–07/05

Figure 16. Microcontroller utilization rate

In the worst case, the microcontroller utilization ratio is about 18% with a sampling timeof 80ms at 14000 rpm.

A first estimation can be made for a faster motor and with a current regulation added.Activation time for mc_regulation_loop() grows up from 45us to 55us (we have to takeinto account the conversion time of the ADC about 7us). For this estimation, a BLDCmotor with a current response time about 2-3ms, five pairs of poles and a maximumspeed of 50000 rpm is chosen.

The maximum speed of the motor is about 50000 rpm, with a rotor of 5 pairs of poles weobtain a Hall sensors frequency of (50000rpm/60)*5 = 4167 Hz. The functionmc_estimation_speed() is launched at each rising edge of hall sensor A, so every 240uswith an activation time of 31us.

For mc_switch_commutation() the three hall sensors have to be considered. The func-tion is executed at each edges of the three hall sensors (rising edge and falling edge)we have six interrupts in one Hall sensor period. It results in an activation period of240/6us = 40us.

Finally, the sampling time of the regulation loop must to be at least twice smaller thanthe current reponse time of the motor (about 1ms).

All results are summarized Figure 17.

Figure 17. Microcontroller utilization rate estimated

In such case the utilization ratio of the microcontroller is about 61%.

All ratio measurement have been made with the same software. No communicationmode are used (no UART, no LIN...).

In these conditions, the microcontroller memory usage is :• 3175 bytes of CODE memory (Flash occupation = 38.7% ).• 285 bytes of DATA memory (SRAM occupation = 55.7%).

Function Parameters activation time activation period Ratio uc %ovfl_timer() all case 2us 2,05ms 0,1

Speed = 14000 rpm 857,14 us 3,62Speed = 2800 rpm 4,29 ms 0,72Speed = 14000 rpm 142,86 us 11,89Speed = 2800 rpm 714 us 2,38

Open Loop 4,5 us 80 ms 0,0056Close Loop 45 us 80 ms 0,056

mc_regulation_loop()

mc_estimation_speed() 31 us

mc_switch_commutation() 17 us

Function Parameters activation time activation period Ratio uc %ovfl_timer() all case 2us 2,05 ms 0,1

1 ms

40 us

240 us

5,5

12,91

42,5

mc_regulation_loop()

mc_estimation_speed() 31 us

mc_switch_commutation() 17 us

Speed = 50000 rpm

Speed = 50000 rpm

Close Loop 55 us

Page 19: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

19

AVR 492 Application Note

7518A–AVR–07/05

ATAVRMC100 Configuration and Use

Figure 18 shows us the complet schematics of the various operating mode of the starterkit ATAVRMC100.

Figure 18. Microcontroller I/O Ports use and communication modes

Operating mode Two differents operating modes are available, set jumpers JP1, JP2 and JP3 accordingto Figure 19 to select between both modes. In this application, only Sensor mode isused. Refer to the ATAVRMC100 User Guide for complete description of hardware.

Operating Mode

PORTB PIN Port Function SENSOR LIN PC Link Switchs/LEDs Debug Wire ISPPB0/MISO/PSCOUT20 12 H_C H_C H_C H_C H_C H_C H_CPB1/MOSI/PSCOUT21 13 L_C L_C L_C L_C L_C L_C L_CPB2/ADC5/INT1 20 VMOT VMOT VMOT VMOT VMOT VMOT VMOTPB3/AMP0- 27 EXT1 EXT1 EXT1 EXT1 EXT1 EXT1PB4/AMP0+ 28 EXT2 EXT2 EXT2 EXT2 EXT2 EXT2PB5/ADC6/INT2 30 EXT5 EXT5 EXT5 EXT5 EXT5 EXT5PB6/ADC7/PSCOUT11/ICP1B 31 L_B L_B L_B L_B L_B L_B L_BPB7/ADC4/PSCOUT01/SCK 32 L_A L_A L_A L_A L_A L_A L_A

PORTCPC0/INT3/PSCOUT10 2 H_B H_B H_B H_B H_B H_B H_BPC1/PSCIN1/OC1B 7 EXT3 EXT3 EXT3 EXT3 EXT3 EXT3PC2/T0/PSCOUT22 10 EXT4 EXT4 EXT4 EXT4 EXT4 EXT4PC3/T1/PSCOUT23 11 LIN_NSLP LIN_NSLP LIN_NSLP LIN_NSLP LIN_NSLP LIN_NSLPPC4/ADC8/AMP1- 21 V_Shunt- V_Shunt- V_Shunt- V_Shunt- V_Shunt- V_Shunt- V_Shunt-PC5/ADC9/AMP1+ 22 V_Shunt+ V_Shunt+ V_Shunt+ V_Shunt+ V_Shunt+ V_Shunt+ V_Shunt+PC6/ADC10/ACMP1 26 HallB / BEMF_B HallBPC7/D2A 29 DAC_OUT DAC_OUT DAC_OUT DAC_OUT DAC_OUT DAC_OUT DAC_OUT

PORTDPD0/PSCOUT00/XCK/SS_A 1 H_A H_A H_A H_A H_A H_A H_APD1/PSCIN0/CLKO 4 Over_Current Over_Current Over_Current Over_Current Over_Current Over_Current Over_CurrentPD2/PSCIN2/OC1A/MISO_A 5 MISO / EXT10 EXT10 EXT10 EXT10 EXT10 MISOPD3/TXD/DALI/OC0A/SS/MOSI_A 6 MOSI / LIN TxD / TxD

/ EXT7 LIN TxD TxD POT EXT7 MOSI

PD4/ADC1/RXD/DALI/ICP1A/SCK_A 16 SCK / LIN RxD / RxD

/ POT / EXT8 LIN RxD RxD EXT8 EXT8 SCK

PD5/ADC2/ACMP2 17 HallC / BEMF_C HallCPD6ADC3/ACMPM/INT0 18 VMOT_Half VMOT_Half VMOT_Half VMOT_Half VMOT_Half VMOT_Half VMOT_HalfPD7/ACMP0 19 HallA / BEMF_A HallA

PORTEPE0/RESET/OCD 3 NRES / EXT9 EXT9 EXT9 EXT9 NRES NRESPE1/OC0B/XTAL1 14 EXT6 EXT6 EXT6 EXT6 EXT6 EXT6PE2/ADC0/XTAL2 15 LED LED LED LED LED LED

Depend on the communication mode

Depend on the communication mode

Depend on the communication mode

Depend on the communication mode

Depend on the operating mode

Depend on the operating mode

Depend on the operating mode

Communication Mode

STK500 JTAGICE mkII

Page 20: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

20 AVR 492 Application Note7518A–AVR–07/05

Figure 19. Sensor mode selection

Figure 19 shows the default jumpers setting to use the software associated with thisapplication note.

The software delivered with the ATAVRMC100 board allows two operating modes :– No external component, the motor start with a speed of 100%.– One external potentiometer use to adjust the speed of the motor.

Figure 20. Potentiometer connection.

642

531

79 10

8

10K

10KP

R

J4: IO-COM

GND

VCC5V

ADC5

Page 21: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

21

AVR 492 Application Note

7518A–AVR–07/05

Conclusion This application note provides a software and hardware solution for sensor brushlessDC motors applications. All source code is available on the Atmel web site.

The software library provides functions to start and control the speed of any sensorthree phases brushless DC motors.

The hardware is based on the minimal design with minimal external componentsrequired for control sensor brushless DC motors.

The AT90PWM3 CPU and memory usage allow a developer to expand his horizons withnew functionalities.

Page 22: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

22 AVR 492 Application Note7518A–AVR–07/05

Figure 21. Schematic page 1/45 5

4 4

3 3

2 2

1 1

DD

CC

BB

AA

PH

_CB

EM

F_C

PH

_BB

EM

F_B

BE

MF

_AP

H_A

PH

_A

PH

_B

PH

_C

BE

MF

_C

BE

MF

_B

BE

MF

_A

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

AT

AV

RM

C1

(ZC

D D

etec

tio

n)

44

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

AT

AV

RM

C1

(ZC

D D

etec

tio

n)

44

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

AT

AV

RM

C1

(ZC

D D

etec

tio

n)

44

A4

Drawn By: G ALLAIN

11 April 2005

R37

15K

R37

15K

C31 47

0pF

(N

ot M

ount

ed)

C31 47

0pF

(N

ot M

ount

ed)

R44

22K

R44

22K

C28

100p

F

C28

100p

F

R33

15K

R33

15K

R39

22K

R39

22K

C30

100p

F

C30

100p

F

R35

22K

R35

22K

R38

100K

R38

100K

TP

13B

EM

F_A

TP

13B

EM

F_A

R34

100K

R34

100K

R40

22K

R40

22K

C29

470p

f (N

ot M

ount

ed)

C29

470p

f (N

ot M

ount

ed)

C33 47

0pF

(N

ot M

ount

ed)

C33 47

0pF

(N

ot M

ount

ed)

R42

15K

R42

15K

R36

22K

R36

22K

R41

22K

R41

22K

C32

100p

F

C32

100p

F

TP

12B

EM

F_B

TP

12B

EM

F_B

TP

11B

EM

F_C

TP

11B

EM

F_C

R43

100K

R43

100K

Page 23: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

23

AVR 492 Application Note

7518A–AVR–07/05

Figure 22. Schematic page 2/45 5

4 4

3 3

2 2

1 1

DD

CC

BB

AA

VM

OT

LIN

EX

T8/

SC

K/L

IN_R

xD/R

xD/P

OT

LIN

_NS

LP

EX

T7/

MO

SI/L

IN_T

xD/T

xD

LIN

_NW

AK

E

VM

OT

_Hal

f

VB

US

VB

US

_D

VB

US

_D

VC

C5V

VB

US

VB

US

_D

VB

US

_D

VM

OT

VM

OT

_Hal

f

EX

T8/

SC

K/L

IN_R

xD/R

xD/P

OT

LIN

_NS

LP

LIN

_NW

AK

E

EX

T7/

MO

SI/L

IN_T

xD/T

xD

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

AT

AV

RM

C1

(PO

WE

R +

LIN

)

34

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

AT

AV

RM

C1

(PO

WE

R +

LIN

)

34

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

AT

AV

RM

C1

(PO

WE

R +

LIN

)

34

POWER

LIN

V measurement

A4

Drawn By: G ALLAIN

11 April 2005

C21

10nF

C21

10nF

C23

10uFC23

10uF

TP

10

GN

D

TP

10

GN

D

R29

10K

R29

10K

R28

100K

R28

100K

1 2 3

J1

LIN

Con

nect

or

J1

LIN

Con

nect

or

VIN

1

GND 3

VO

UT

2

U6

MC

78M

05C

DT

U6

MC

78M

05C

DT

D5

LL40

01

D5

LL40

01C

20

100n

F

C20

100n

F

C24

2.2n

FC

242.

2nF

C18

100n

F

C18

100n

F

R30

33R30

33

R32

22K

R32

22K

R27

15K

R27

15K

D6

LED

_Gre

enD

6LE

D_G

reen

R26

4.7K

R26

4.7K

INH

8

NW

AK

E3

RxD

1

GN

D5

TxD

4

LIN

6

BA

T7

NS

LP2

U7

AT

A66

61

U7

AT

A66

61C

2510

0nF

C25

100n

F

C27

100n

FC

2710

0nF

C19

47uF

C19

47uF

R31

22K

R31

22K

C22

100n

F

C22

100n

F

C26

220p

FC

2622

0pF

R25

10R

2510

Page 24: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

24 AVR 492 Application Note7518A–AVR–07/05

Figure 23. Schematic page 3/4

5 5

4 4

3 3

2 2

1 1

DD

CC

BB

AA

H_A

NR

ES

/EX

T9

Ove

r_C

urre

nt

MIS

O/E

XT

10

EX

T7/

MO

SI/L

IN_T

xD/T

xD

EX

T3

EX

T4

LIN

_NS

LP

H_C

L_C

EX

T8/

SC

K/L

IN_R

xD/R

xD/P

OT

L_A

L_B

DA

C_O

UT

EX

T2

EX

T1

AG

ND

V_S

hunt

+

V_S

hunt

-

EX

T6

Hal

lC

MIS

O/E

XT

10E

XT

8/S

CK

/LIN

_RxD

/RxD

/PO

TE

XT

7/M

OS

I/LIN

_TxD

/TxD

EX

T2

EX

T2

EX

T6

EX

T3

EX

T5

EX

T7/

MO

SI/L

IN_T

xD/T

xD

BE

MF

_C

Hal

lA

BE

MF

_AV

MO

T_H

alf

VM

OT

EX

T5

EX

T8/

SC

K/L

IN_R

xD/R

xD/P

OT

NR

ES

/EX

T9

EX

T1

Hal

lB

BE

MF

_B

H_A

H_B

H_C

V_S

hunt

+V

MO

T_H

alf

L_A

L_B

L_C

V_S

hunt

-O

ver_

Cur

rent

H_B

VC

C5V

VC

C5V

VC

C5V

VC

C5V

VC

C5V

VC

C5V

H_C

H_A

H_B

NR

ES

/EX

T9

Ove

r_C

urre

nt

MIS

O/E

XT

10

EX

T7/

MO

SI/L

IN_T

xD/T

xD

EX

T3

EX

T4

LIN

_NS

LP

L_C

EX

T6

EX

T8/

SC

K/L

IN_R

xD/R

xD/P

OT

MIS

O/E

XT

10E

XT

8/S

CK

/LIN

_RxD

/RxD

/PO

TN

RE

S/E

XT

9E

XT

7/M

OS

I/LIN

_TxD

/TxD

EX

T3

EX

T4

EX

T7/

MO

SI/L

IN_T

xD/T

xD

EX

T2

EX

T4

EX

T6

EX

T8/

SC

K/L

IN_R

xD/R

xD/P

OT

VM

OT

_Hal

f

VM

OT

V_S

hunt

-

V_S

hunt

+

EX

T1

EX

T2

DA

C_O

UT

L_B

L_A

Hal

lC

BE

MF

_C

Hal

lA

BE

MF

_A

Hal

lB

BE

MF

_B

EX

T1

EX

T5

H_A

H_B

H_C

V_S

hunt

+V

MO

T_H

alf

L_A

L_C

L_B

V_S

hunt

-O

ver_

Cur

rent

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

AT

AV

RM

C1

(Mic

roC

on

tro

ller)

14

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

AT

AV

RM

C1

(Mic

roC

on

tro

ller)

14

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

AT

AV

RM

C1

(Mic

roC

on

tro

ller)

14

A4

Drawn By: G ALLAIN

11 April 2005

PD

0/P

SC

OU

T00

/XC

K/S

S_A

1

PC

0/IN

T3/

PS

CO

UT

102

PE

0/R

ES

ET

/OC

D3

PD

1/P

SC

IN0/

CLK

O4

PD

2/P

SC

IN2/

OC

1A/M

ISO

_A5

PD

3/T

XD

/DA

LI/O

C0/

SS

/MIS

O_A

6

PC

1/P

SC

IN1/

OC

1B7

VC

C8

GN

D9

PC

2/T

0/P

SC

OU

T22

10

PC

3/T

1/P

SC

OU

T23

11

PB

0/M

ISO

/PS

CO

UT

2012

PB

1/M

OS

I/PS

CO

UT

2113

PE

1/O

CB

0/X

TA

L114

PE

2/A

DC

0/X

TA

L215

PD

4/A

DC

1/R

XD

/DA

LI/IC

P1A

/SC

K_A

16P

D5/

AD

C2/

AC

MP

217

PD

6/A

DC

3/A

CM

PM

/INT

018

PD

7/A

CM

P0

19

PB

2/A

DC

5/IN

T1

20

PC

4/A

DC

8/A

MP

1M21

PC

5/A

DC

9/A

MP

1P22

AV

CC

23

AG

ND

24

AR

EF

25

PC

6/A

DC

10/A

CM

P1

26

PB

3/A

MP

0M27

PB

4/A

MP

0P28

PC

7/D

2A29

PB

5/A

DC

6/IN

T2

30

PB

6/A

DC

7/P

SC

OU

T11

/ICP

1B31

PB

7/A

DC

4/P

SC

OU

T01

/SC

K32

U1

AT

90P

WM

3

U1

AT

90P

WM

3

R1

10R1

10

MIS

O1

VC

C2

SC

K3

MO

SI

4

RS

T5

GN

D6

J2

JTA

G IS

P

J2

JTA

G IS

P

C1

100n

F

C1

100n

F

R45

1KR

451K

R46

1KR

461K

R47

1KR

471K

D1

LED

_Gre

en

D1

LED

_Gre

en

R48 10R48 10

R2

4.7K

R2

4.7K

C4

1uF

C4

1uF

R3

100K

R3

100K

C2

100n

F

C2

100n

F C3

100n

FC

310

0nF

EX

T1

1E

XT

22

EX

T3

3E

XT

44

EX

T5

5E

XT

66

EX

T7

7

GN

D9

EX

T8

8

VC

C10

J4

CO

N 2

x5P

OR

T_C

OM

J4

CO

N 2

x5P

OR

T_C

OM

1 2 3

JP1

Sel

_Sen

sor_

Sen

sorle

ss_AJP

1

Sel

_Sen

sor_

Sen

sorle

ss_A

1 2 3

JP3

Sel

_Sen

sor_

Sen

sorle

ss_CJP

3

Sel

_Sen

sor_

Sen

sorle

ss_C

1 2 3

JP2

Sel

_Sen

sor_

Sen

sorle

ss_BJP

2

Sel

_Sen

sor_

Sen

sorle

ss_B

H_A

1L_

A2

H_B

3L_

B4

H_C

5L_

C6

V+

7

Vm

ot9

V-

8

OC

ur10

J3

ST

K50

0_C

ON

J3

ST

K50

0_C

ON

Page 25: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

25

AVR 492 Application Note

7518A–AVR–07/05

Figure 24. Schematic page 4/45 5

4 4

3 3

2 2

1 1

DD

CC

BB

AA

V_S

hunt

-

HS

_CH

S_B

HS

_A

Hal

lCH

allB

Hal

lA

PH

_CP

H_B

PH

_A

V_S

hunt

+

L_C

H_B

L_B

H_A

L_A

H_C

Ove

r_C

urre

nt

VB

US

_D

VB

US

_D

VB

US

_D

VB

US

_D

VC

C5V

VC

C5V

VC

C5V

VB

US

_DV

IR21

01V

IR21

01

VIR

2101

VIR

2101

H_C

L_C

H_B

L_B

H_A

L_A

PH

_CP

H_B

PH

_A

V_S

hunt

+

V_S

hunt

-

Hal

lCH

allB

Hal

lA

PH

_A

PH

_B

PH

_C

Ove

r_C

urre

ntD

AC

_OU

T

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

24

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

24

Titl

e

Siz

eD

ocum

ent N

umbe

rR

ev

Dat

e:S

heet

of

1.6

24

AT

AV

RM

C1

(PO

WE

R B

RID

GE

)A4

Drawn By: G ALLAIN

11 April 2005

TP

1P

H_C

TP

1P

H_C

R12

100

R12

100

C17 10

0nF

C17 10

0nF

Q4

SU

D35

N05

-26L

Q4

SU

D35

N05

-26L

D2

BA

S21

D2

BA

S21

R13

100

R13

100

R21

10K

R21

10K

12345678

J5

BLD

C C

on

J5

BLD

C C

on

R4

10K

R4

10K

R19 22R19 22

C7 10

0nF

C7 10

0nF

D3

BA

S21

D3

BA

S21

C6

100n

F

C6

100n

F

C5

100n

F

C5

100n

F

TP

3 HallB

TP

3 HallB

R22

10K

R22

10K

C12 10

0nF

C12 10

0nF

C13

1nF

C13

1nF

TP

7V

_Shu

nt-

TP

7V

_Shu

nt-

R18

R_S

hunt

R18

R_S

hunt

R9

10K

R9

10K

D7

SM

BJ1

8(no

t mou

nted

)D

7S

MB

J18(

not m

ount

ed)

TP

6V

_Shu

nt+

TP

6V

_Shu

nt+

TP

9P

H_A

TP

9P

H_A

R5 22R5 22

R84.7K R84.7K

R17

4.7K

R17

4.7K

Q1

SU

D35

N05

-26L

Q1

SU

D35

N05

-26L

Q5

SU

D35

N05

-26L

Q5

SU

D35

N05

-26L

TP

14 Cur

_Dtc

TP

14 Cur

_DtcC111nF C111nF

TP

2 HallC

TP

2 HallC

R74.7K R74.7K

VC

C1

HIN

2

LIN

3

CO

M4

LO5

VS

6H

O7

VB

8

U2

IR21

01S

U2

IR21

01S

VC

C1

HIN

2

LIN

3

CO

M4

LO5

VS

6H

O7

VB

8

U4

IR21

01S

U4

IR21

01S

Q2

SU

D35

N05

-26L

Q2

SU

D35

N05

-26L

C101nF C101nF

R20

15K

R20

15K

TP

8

Ove

r_C

ur

TP

8

Ove

r_C

ur

R16

10K

R16

10K

TP

5P

H_B

TP

5P

H_B

R64.7K R64.7K

C14

100n

F

C14

100n

F

Q3

SU

D35

N05

-26L

Q3

SU

D35

N05

-26L

C91nF C91nF

R23 22R23 22

Q6

SU

D35

N05

-26L

Q6

SU

D35

N05

-26L

VC

C1

HIN

2

LIN

3

CO

M4

LO5

VS

6H

O7

VB

8

U3

IR21

01S

U3

IR21

01S

C15

100n

F

C15

100n

F

R14

10K

R14

10K

C16

10nF

C16

10nF

431

5 2

+ -

U5

LMV

7219

M5

+ -

U5

LMV

7219

M5

C8

100n

F

C8

100n

F

TP

4 HallA

TP

4 HallA

R10 22R10 22 R24 22R24 22

R49 0

R49 0

R11

100

R11

100

D4

BA

S21

D4

BA

S21R

15 22R15 22

Page 26: AT40KEL-DK Design Kit - Quick Start Guide · grammable 5, 10, 20 and 40 gain stage. The Shunt resistor has to be adjusted to the amplifier conversion range. The Over_Current signal

Printed on recycled paper.

Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise,to anyintellectu-alproperty right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL’S TERMS AND CONDI-TIONS OFSALE LOCATED ON ATMEL’S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORYWAR-RANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICU-LARPURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIALOR INCIDEN-TAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMA-TION) ARISING OUTOF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAM-AGES. Atmel makes norepresentationsor warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to makechanges to specificationsand product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein.Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel’s products are not intended,authorized, or warranted for useas components in applications intended to support or sustainlife.

© Atmel Corporation 2005. All rights reserved. Atmel®, logo and combinations thereof, are registered trademarks, and Everywhere You AreSM

are the trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others.

Atmel Corporation Atmel Operations2325 Orchard ParkwaySan Jose, CA 95131, USATel: 1(408) 441-0311Fax: 1(408) 487-2600

Regional HeadquartersEurope

Atmel SarlRoute des Arsenaux 41Case Postale 80CH-1705 FribourgSwitzerlandTel: (41) 26-426-5555Fax: (41) 26-426-5500

AsiaRoom 1219Chinachem Golden Plaza77 Mody Road TsimshatsuiEast KowloonHong KongTel: (852) 2721-9778Fax: (852) 2722-1369

Japan9F, Tonetsu Shinkawa Bldg.1-24-8 ShinkawaChuo-ku, Tokyo 104-0033JapanTel: (81) 3-3523-3551Fax: (81) 3-3523-7581

Memory2325 Orchard ParkwaySan Jose, CA 95131, USATel: 1(408) 441-0311Fax: 1(408) 436-4314

Microcontrollers2325 Orchard ParkwaySan Jose, CA 95131, USATel: 1(408) 441-0311Fax: 1(408) 436-4314

La ChantrerieBP 7060244306 Nantes Cedex 3, FranceTel: (33) 2-40-18-18-18Fax: (33) 2-40-18-19-60

ASIC/ASSP/Smart CardsZone Industrielle13106 Rousset Cedex, FranceTel: (33) 4-42-53-60-00Fax: (33) 4-42-53-60-01

1150 East Cheyenne Mtn. Blvd.Colorado Springs, CO 80906, USATel: 1(719) 576-3300Fax: 1(719) 540-1759

Scottish Enterprise Technology ParkMaxwell BuildingEast Kilbride G75 0QR, Scotland Tel: (44) 1355-803-000Fax: (44) 1355-242-743

RF/AutomotiveTheresienstrasse 2Postfach 353574025 Heilbronn, GermanyTel: (49) 71-31-67-0Fax: (49) 71-31-67-2340

1150 East Cheyenne Mtn. Blvd.Colorado Springs, CO 80906, USATel: 1(719) 576-3300Fax: 1(719) 540-1759

Biometrics/Imaging/Hi-Rel MPU/High Speed Converters/RF Datacom

Avenue de RochepleineBP 12338521 Saint-Egreve Cedex, FranceTel: (33) 4-76-58-30-00Fax: (33) 4-76-58-34-80

Literature Requestswww.atmel.com/literature

7518A–AVR–07/05