design and implementation of a servo system by sensor field …765879/fulltext01.pdf ·...

46
UPTEC F 14051 Examensarbete 30 hp November 2014 Design and implementation of a servo system by Sensor Field Oriented Control of a BLDC motor Per Eriksson

Upload: others

Post on 13-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

UPTEC F 14051

Examensarbete 30 hpNovember 2014

Design and implementation of a servo system by Sensor Field Oriented Control of a BLDC motor

Per Eriksson

Page 2: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Teknisk- naturvetenskaplig fakultet UTH-enheten Besöksadress: Ångströmlaboratoriet Lägerhyddsvägen 1 Hus 4, Plan 0 Postadress: Box 536 751 21 Uppsala Telefon: 018 – 471 30 03 Telefax: 018 – 471 30 00 Hemsida: http://www.teknat.uu.se/student

Abstract

Design and implementation of a servo system bySensor Field Oriented Control of a BLDC motor

Per Eriksson

A servo system intended to steer antennas on board ships is designed, built andtested. It uses a Brushless Direct Current (BLDC) motor with an encoder to keeptrack of its position, and Field Oriented Control (FOC) implemented on Toshibasmicroprocessor TMPM373 in order to control the current flowing to the motor. Theservo system will be connected in cascade to another already existing servo systemand controlled with two input signals. The first signal determines if the antenna axisshould rotate clockwise or counter clockwise. The second signal is a stream of pulses,where each pulse means that the motor should move one encoder point.

A printed circuit board is designed and built to complete these tasks. A proportional-integral regulator is used to control the position of the motor, using the positionerror as the controller input. The servo system is tested. The performance of theresulting servo system is sufficient to satisfy the required position error limit of 0.5degrees. In order to reduce the periodic disturbances presented in the system inexperiments, Iterative Learning Control (ILC) is implemented. It is shown that usingILC further decreases the position error.

ISSN: 1401-5757, UPTEC F14 051Examinator: Tomas NybergÄmnesgranskare: Ping WuHandledare: Sven-Åke Eriksson

Page 3: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Sammanfattning

Ett servosystem tänkt att användas för att rikta antenner ombord på båtar är designat, byggt och testat.

Det använder en borstlös likströmsmotor (BLDC) med en encoder som håller reda på dess position, och

Field Oriented Control (FOC) implementerad på Toshibas mikroprocessor TMPM373 för att kontrollera

strömmen som går in i motorn. Servosystemet kaskadkopplas tillsammans med ett annat redan existe-

rande servosystem och styrs med hjälp av två signaler. Den första signalen bestämmer om antennaxeln

ska svänga medsol eller motsol. Den andra signalen är en ström av pulser, där varje puls betyder att

motor ska ytta sig ett encodersteg.

Ett kretskort med all nödvändig hårdvara för detta är designat och byggt. För att styra positionen av

motorn används en proportionell-integrerande regulator där styrsignalen är positionsfelet. Servosystemet

testas och resultatet är ett servosystem vars positionsfel nästan alltid håller sig under kravet på 0.5 graders

fel. För att minska de periodiska störningarna i positionsfelet som visat sig i systemet under experimenten

så implementeras algoritmen Iterative Learning Control, som visar sig minska positionsfelet ytterligare.

1

Page 4: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Contents

1 Introduction 4

1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.2 Purposes and goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.3 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.4 Thesis outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 Working principles and theories 7

2.1 Servo systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2 Brushless Direct Current Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3 Field Oriented Control (FOC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.4 Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.5 Space Vector Pulse Width Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.5.1 The three-phase inverter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.5.2 Space Vector Pulse Width Modulation . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.6 Current Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

2.7 Torque ripples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.8 Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.8.1 PI controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2.8.2 Iterative learning control (ILC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3 Implementation 18

3.1 Project Specications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.2 Motor Specications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.3 Pulse-width modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.4 Computer Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.5 Current Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.6 First design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.7 Second design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.8 Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.8.1 Main method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.8.2 Vector Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

3.8.3 Key press detection loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

3.8.4 Field Oriented Control loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4 Experiments 29

4.1 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

4.2 Testing the rst design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

4.3 Testing the second design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

4.3.1 Determination of current PI controller settings . . . . . . . . . . . . . . . . . . . . 31

4.3.2 Determination of speed PI controller settings . . . . . . . . . . . . . . . . . . . . . 32

4.3.3 Iterative Learning Control in order to reduce periodic disturbances . . . . . . . . . 33

2

Page 5: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

5 Results and Discussion 36

5.1 Dead-time aecting the performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

6 Conclusions and suggestions for future work 38

6.1 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

6.2 Suggestions for future work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

3

Page 6: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Chapter 1

Introduction

1.1 Background

Research Electronics is a company that delivers electronics tailored to customer requirements. These

include control and regulation devices that require high speed and precision, or measuring equipment

used in extreme environments. The company has developed a two-way satellite communication system

in order to provide broadband for ships out in the sea. The motion of the ships' decks makes this quite

a dicult task, and most existing antenna system solutions are driven from the center of rotation of the

antenna dish. The solution presented by Research Electronics is not following this norm, and the servo

motors are instead placed as far as possible from the center of rotation. This improves the pointing

accuracy but requires the servo system to be able to achieve a very low positioning error. There are

solutions available today on the market, that are able to meet the requirements. Unfortunately they are

quite expensive and often comes with extra features not needed for this purpose, such as various lter

types used to modify the behaivour of the system and analog inputs to control the speed and torque. As

an example, the hardware required for KVHs 4 Mbps maritime broadband solution TracPhone V11 costs

75000 USD. Therefore, Research Electronics has decided to build this system itself. This could reduce

the cost of the servo system by 90% or more by using cheap but ecient components and creating the

control systems.

The servo system that the present thesis project is concerned with is schematically shown in Figure 1.1.

The system consists of two servo systems connected in cascade in a closed feedback loop. Both systems

have a similar setup, with encoders that keep track of positions. The inner encoder is connected directly

to the motor while the outer encoder is connected to the antenna axis. For a satellite dish control system,

each cascaded servo system needs to be connected to an antenna axis.

A basic component in any servo system is a variable speed drive, which consists of a motor and a

controller. Vector control of AC motors was rst developed by K. Hasse and F. Blaschke in the early

1970s. Vector control is a variable speed drive control system where the stator currents of three-phase AC

motors are identied as two orthogonal components which can be visualized as a vector. Two dierent

branches of vector control emerged during the 1980s, Field-Oriented Control (FOC) and Direct Torque

Control (DTC). In DTC the speed is controlled by estimating the magnetic ux and torque of the motor

based on the measured voltage and current. The drawbacks of DTC are that it is dicult to use at low

speeds, and produces high torque and current ripples [1]. You also need a very good current sensor if

DTC is to be used in a high performance application, which increases the cost of the required hardware.

FOC can be used in many dierent ways. It is possible to implement FOC using either synchronous

(brushless) or induction (brushed) motors. In both of these cases, you can also make the choice of using

sensors or not. Sensorless control requires derivation of rotor speed by measured stator voltage and

currents. In this project a brushless DC motor and sensor FOC are used.

4

Page 7: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 1.1: The complete servo system, in which the inner servo system for controlling the motor (inside

the dashed rectangle) is the focus of this project.

1.2 Purposes and goals

The purpose of this project is to develop a servo system, which is the inner part of the bigger system

shown in Figure 1.1. The maximum position error of the servo system in this project needs to be at

most 0.5 degrees, and the system operates at up to ve revolutions per second. The goal of this thesis

project is to develop a prototype of such a servo system, which can be further developed into a nal

system that can be used in the above mentioned communication system to control the antenna rotation

with the requirements fullled.

1.3 Methodology

The components used in this project were carefully chosen based on the requirements. The microprocessor

TMPM373 from Toshiba was chosen because it has specic on-chip hardware designed for the purpose

of Field Oriented Control. A BLDC motor was chosen because of it's high power to weigth and torque

to current ratios. Sensor FOC was chosen above sensorless FOC because of the unreliability of sensorless

FOC at low speeds if you do not use expensive and heavy current measurement components.

The goal when designing the printed circuit board was to reduce electromagnetic interference and

current uctuations as much as possible. This was done by creating return paths for the currents used in

the motor in a satisfactory way, by linking the upper and lower layers of the board with multiple holes.

Several capacitors were also placed on the board with the sole reason of acting as buers for the spiky

current consumption of integrated circuits. Finally, separate channels provided current to the CPU, the

integrated circuits and the motor current so that any disturbances in one part would not disturb the

other parts.

The servo system is built upon a brushless direct current motor with an encoder that keeps track of

the rotor position with a resolution of 8192 points per revolution. The motor current is controlled by an

algorithm called Field Oriented Control, which is implemented on Toshibas TMPM373 microprocessor

that has specic on-chip hardware designed for the purpose of Field Oriented Control.

All tests and experiments were conducted using the components that will be used in the complete

servo system, so the results are relevant to a real world application.

1.4 Thesis outline

This thesis is divided into six chapters. Chapter one gives a brief introduction and overview of the

project. Chapter two provides the necessary theoretical background to understand how the servo system

works. Chapter three describes how the project is implemented both physically and digitally. Chapter

5

Page 8: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

four describes the experiments conducted on the servo system and how the dierent controlled settings

were obtained. Chapter ve presents the results and the discussion. Chapter six summarizes the main

conclusions and presents some ideas for future work.

6

Page 9: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Chapter 2

Working principles and theories

2.1 Servo systems

A servo system is a system made for the automatic control of motion by means of feedback. A servo loop

generally refers to the feedback control of a single variable, often position, speed or acceleration. The

purpose of a servo system is generally one or more of the following objectives: (1) precise control of motion

without any human interaction; (2) precise control of motion even with mechanical load variations, power

supply uctuations or changes in the environment; (3) be able to control a high power load from a low

power reference signal.

An example of a general motion control system can be described as in Figure 2.1. The application

software (or some other input device) sends a reference position to the motion controller, which utilizes

this signal and the feedback position to create an input voltage to the amplier. The amplier transforms

this voltage into a current for the actuator. The position of the output motion can then be measured and

sent back to the motion controller via a feedback device of some sort. This is a simple servo loop. More

complex servo systems may have several servo loops connected in cascade or in some other connection.

Let's look at the dierent components in a little bit more detail. A motion controller is commonly

implemented using digital computers, but can also be implemented using only analog components. It is

the unit which receives the feedback from the feedback device and calculates the input to the amplier.

A motion controller can be everything from a simple PI-regulator to an advanced digital device with

movement prediction, synchronisation with other parts of the system or other high level features.

A ampliers job is to translate the low energy reference signal from the controller into a high energy

power signal for the motor. Generally this is a device with some kind of pulse-width modulation circuit

which is controlled by the reference signal. The ampliers nowadays often have protective circuits such

as thermal shutdown circuits, undervoltage and overvoltage protection circuits.

An actuator is a type of motor responsible for moving or controlling a system. They can be single,

two or three phase motors. The motor can be an induction motor or permanent magnet motor, with

DC or AC. There are many dierent types of electrical motors out there and most of them can be used

in a motion control system. The term servomotor is dened as a motor that provides the power for a

servomechanism.

The mechanical connection can be something like a shaft, a chain, a gearbox, cogwheels or some other

connection between the motor and the target.

The feedback device is used to ensure that the target reaches the commanded position or velocity.

This will typically be an position encoder and/or a current measurement sensor like a hall sensor.

7

Page 10: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 2.1: A general motion control system.

2.2 Brushless Direct Current Motor

Brushless direct current (BLDC) motors are a type of permanent magnet synchronous motor (PMSM).

The rotor in a BLDC motor consists of a permanent magnet with a varying amounts of pole pairs. These

poles are alternating south and north evenly across the rotor, which is usually circular. Furthermore, a

BLDC motor also consists of windings which are evenly spread around the stator as shown in gure 2.2.

In a BLDC motor a magnetic eld is created when current is owing through the windings in the stator.

If these currents are manipulated in a correct way this magnetic eld will rotate. The static magnetic

eld of the rotor will rotate at the same speed as the magnetic eld of the stator, causing the rotor to

move. An example of how the magnetic eld in the windings can change is shown in gure 2.3. BLDC

motors do not experience the slip commonly seen in induction motors when the load on the rotor is

increased. Instead, the rotor in a BLDC will either rotate in perfect synchronisation with the magnetic

eld or not at all.

Figure 2.2: The interior of a BLDC motor. A,B and C mark the three windings.

The brushless synchronous motor has been very popular over the past years due to some big ad-

vantages compared to brushed DC motors, for instance, high torque to current ratio, higher eciency,

noiseless operation, better robustness and large power to weight ratios[2].

The motor equations can be viewed from the phase reference frame with individual currents and

voltages for each phase. Another way to look at it is to look at the motor equations from the rotor

reference frame. In this reference frame, two perpendicular axes called the direct (d-axis) and quadrature

(q-axis) exists, as illustrated in Figure 2.4. The motor model in the rotor reference (d − q) frame is

8

Page 11: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 2.3: An inverter or a three-phase power supply provides a rotating magnetic eld inside a motor.

expressed in the following manner [3][4],

Figure 2.4: A vector representation of (a) the three phase currents(iA,iB and iC), their vector sum is as

well as (b) the direct and quadrature axis.

(Vd(t)

Vq(t)

)=

(Ra + pLd ωeLq−ωeLd Ra + pLq

)(id(t)

iq(t)

)+

(0

Keωe(t)

)(2.1)

Te(t) =3

2P (ψF iq(t) + (Ld − Lq)id(t)iq(t)) (2.2)

Te(t) =J

Ppωe(t) +

BmPωe + TL (2.3)

where

Vd(t), Vq(t) d-axis and q-axis stator voltages;

id(t), iq(t) d-axis and q-axis stator currents;

9

Page 12: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Ld, Lq d-axis and q-axis stator inductances;

La phase inductance;

Ra stator winding resistance;

J moment of inertia;

p dierential operator ( ddt );

P number of poles in the motor;

ωe electric speed;

ψF rotor permanent magnetic ux linkage;

Ke back EMF constant;

Te(t) generated electromagnetic torque;

TL load torque;

Bm Damping coecient (assumed to be zero from now on);

By ignoring the mutual inductance between the phase windings and assuming symmetry in the

inductances, Lq = Ld = La[5]. By assuming that control is good enough to keep id = 0 Equation (2.1),

(2.2) and (2.3) can be simplied to,

Vq(t) = Ladiq(t)

dt+Raiq(t) +Keωe(t) (2.4)

Ktiq(t)− TL =J

P

dωe(t)

dt(2.5)

whereKt is the torque constant dened as 32PψF . To facilitate the analysis, let TL be zero. Performing

Laplace transforms on Equation (2.4) and (2.5) leads to the transfer function from Vq(s) to iq(s),

Gm(s) =iq(s)

Vq(s)=

s/Las2 + (Ra/La)s+KtPKe/(JLa)

(2.6)

To control the speed of the motor another transfer function from Vq to ωe can be found from the

same equations and given as follows:

Gω(s) =ωe(s)

Vq(s)=

Kt

s2L JP +R J

P s+KeKt

(2.7)

This leads to a control system with two control loops, an inner loop and an outer loop, which is

shown in Figure 2.5. The boxes labelled PI are PI controllers, which are explained in Section 2.8.1. In

order to create good stability the inner loop has to be much faster than the outer loop, ideally reaching

a steady state before each new input from the outer loop.

2.3 Field Oriented Control (FOC)

The current owing in each of the windings creates a magnetic eld. The magnitude and direction of this

magnetic eld can theoretically be perfectly controlled by the currents in the windings. In Figure 2.4 (a)

a vector representation of the three phases, their respective current and the resulting sum of currents iscan be seen. Torque in the motor is produced by the attraction and repulsion between the magnetic eld

of the rotor and the magnetic eld the current is produces. This means that if the vector is is placed

in the same direction as the magnetic eld of the rotor, no torque is produced. The elds still interact

to produce a force, but the force is in line with the axis of rotation of the motor, pushing towards the

motor bearings. If is is aligned orthogonal to the magnetic eld of the rotor, all of the force produced in

the interaction between the two magnetic elds can be utilized as torque, producing a maximum torque

for that current[6].

The purpose of Field Oriented Control (FOC) is to control this current vector is to produce the wanted

speed and torque and minimize current consumption. In order to do this easily, the current vector isis transformed from its original three-phase speed and time dependant system into a two-coordinate

10

Page 13: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 2.5: A block diagram for the control loops.

Figure 2.6: A block diagram for eld oriented control of an AC-motor.

(direct and quadrature) time invariant system with use of the Clarke and Park transformations[7]. This

two-coordinate (d and q) system is xed to the rotating rotor as seen in Figure 2.4 (b).

A owchart of the FOC process is shown in Figure 2.6. The process starts by measuring the currents

owing in each of the phases in the AC motor. In order to nd the direct and quadrature currents idand iq the Clarke and Park transformations are used. The Clarke transformation converts the ia, ib and

ic into the ctional iα and iβ by Equation (2.8),iα = iaiβ = 1√

3(ib − ic)

(2.8)

and by utilizing the Park transformation id and iq are found according to Equation (2.9), where θ is

the electrical position of the rotor, id = iα cos(θ) + iβ sin(θ)

iq = iβ cos(θ)− iα sin(θ)(2.9)

The next step is to compare id and iq to the reference values dened by the user to generate the error

signals for the PI controller. Generally for a BLDC motor, id,ref is set to zero. For permanent magnet

synchronous motors a negative id,ref is sometimes used in a process called Field Weakening in order to

achieve higher than rated rotation speeds [8]. The output from the PI controller are the two voltages

11

Page 14: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Vd and Vq. After being transformed by the inverse Park transformation Vα and Vβ are found. These

voltages are used in the Space Vector Pulse Width Modulation process to produce the proper duty cycles

for the three-phase inverter. For more information about this particular step, read Section 2.5. It should

be noted that knowledge of the rotor position is vital to FOC. Numerous research has been done on the

subject of sensor-less FOC where the rotor position is estimated from the back-EMF from the motor,

for example JR Meveys very extensive master thesis report [9]. In this project however, an incremental

rotary encoder is used to keep track of the rotor position.

2.4 Encoder

An encoder is an electrical and mechanical device which converts the angular position of an axis or

similar objects to an digital or analogue code. There are two main types of rotary encoders, incremental

or absolute. An absolute rotary encoder keeps track of its position even when there is no power connected

to the system. An incremental encoder records changes in position but doesn't know where it is directly

on power-up. In this project an incremental encoder was used.

In Figure 2.7 the output from an incremental encoder can be seen when the motor is rotating clockwise

as well as counter-clockwise. An incremental encoder has three outputs; A,B and Z. The direction of

rotation can be found from detecting which of the A or B pulses arrives rst, or in other words the

phase dierence between the A and B pulse. The Z pin pulse occurs when the encoder reaches a specic

angular position. This can be used to nd the absolute position of an incremental encoder.

Figure 2.7: Output from an incremental encoder when the motor is rotating in dierent directions

2.5 Space Vector Pulse Width Modulation

2.5.1 The three-phase inverter

The purpose of a power inverter is to change direct current into alternating current and a typical three-

phase power inverter is shown in Figure 2.8. In this gure VDC is the continuous inverter input voltage

and A,B & C are the three phases of the motor. Number 1-6 represents six switches which are controlled

by the inverter. In order to avoid a short circuit situation, the upper and lower switches of the same

inverter leg (for example switch 1 and 2) should never be on at the same time. However, at least one

switch in each leg should always be on[10].

Since a three-phase inverter has three legs, this creates a situation where the output from the inverter

can be one of eight dierent states at any given time. These states can be seen in Figure 2.9 and are

12

Page 15: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 2.8: A three-phase inverter, motor, and a DC link shunt resistor.

represented by the space vectors V0 to V7.[10]

In order to create a smooth sinusoidal curve inside the motor, fast switching between these eight states

are required. At the same time, it is necessary to arrange the switching sequence in such a way that

the switching from one state to the next is done by switching only one inverter leg in order to minimize

harmonics. The Space Vector pulse width modulation technique is a good choice for this task[11].

Figure 2.9: A table of the dierent space vectors used in SVPWM.

2.5.2 Space Vector Pulse Width Modulation

Space Vector Pulse Width Modulation (SVM) is one of many dierent methods to generate pulse width

modulation (PWM) outputs. Compared to the commonly used sinusoidal pulse width modulation, SVM

generates lower current harmonics and a higher maximal modulation index[11][12].

The role of SVM is to control the rapid switching between the eight dierent states, shown in Fig-

ure 2.9. When a switching state for a given inverter leg is 1, that means that the upper switch in that

leg is on and the lower switch is o. When a switching state is 0, that means that the upper switch is

o and the lower switch is on. In Figure 2.8 the inverter is currently in state 101 with switches 1,4 and

5 on, which corresponds to space vector V6. The space vectors V7 and V0 are zero-current vectors, which

means that no current enters the motor through the power inverter when the switches are in these states.

Let's for example assume that some Vα and Vβ are given from the inverse Park transformation. A

voltage Vref is then obtained by Equation (2.10) [2],

Vref =√V 2α + V 2

β (2.10)

θ = arctanVαVβ

(2.11)

13

Page 16: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

An image representation of the space-vectors as well as Vref can be seen in Figure 2.10. By projecting

Vref onto the two space vectors V1 and V2, the times T1, T2 can be found. These times represent the

amount of time during the next PWM period Ts of which the inverter should be in the switching state

corresponding to space vector V1 and V2 respectively. This can be written as[2],∫ Ts

0

Vref =

∫ T1

0

V1dt+

∫ T1+T2

T1

V2dt+

∫ Ts

T1+T2

V0dt (2.12)

Ts = T0 + (T1 + T2) (2.13)

The method to nd the exact times depends on where the vector Vref is pointing, and won't be

covered in this report. During the remaining time T0 = Ts − (T1 + T2) of the PWM period both of

the zero vectors V0 and V7 have to be used. In this example when Vref is between V1 and V2, the

corresponding inverter output can be seen in Figure 2.11. Note that for the rst and last period marked

as T0

4 , the inverter is in state V0, but in the middle two periods marked T0

4 , the inverter is in state V7.

Figure 2.10: A representation of the space vectors V1 to V6, and a voltage vector Vref .

Figure 2.11: The voltages of the three phase and the corresponding space vectors for a PWM period Ts.

14

Page 17: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

2.6 Current Measurement

In order to control the motor currents in a satisfactory way, good measurements of the phase currents is

vital. There are several dierent methods available in order to measure the current, for example current

sensors such as Hall sensors or current transducers. These methods works well but brings disadvantages

such as drive cost and non-linearity. For low-cost drive systems, some other techniques exists. The most

common is probably to measure the DC-link current using a single shunt resistor. Another common

solution is to place a shunt resistor in series with each emitter of the low-side switches [13]. Since the

purpose of this project is to design a low-cost solution, the two latter techniques are covered in this

report. For the rst system design, the single-shunt method is used and for the second system design

the three-shunt method is used.

The single shunt circuit can be seen in Figure 2.8. The shunt is placed as a DC-link between the

switches and the ground. In this case, precise knowledge of the PWM switching pattern is required

in order to sample the voltage drop over the shunt at precisely the correct time. Depending on which

switching state the inverter currently is in, a single current can be measured. For example, let's assume

that the inverter is currently in state [101] as in Figure 2.8. In this state the current owing into the

motor is ia + ic. Since ia + ib + ic = 0 this means that the current we measure is ia + ic = −ib. A table

of which current can be measured in which space vector can be seen in Figure 2.12.

Figure 2.12: A table of the current owing through the DC-link shunt for dierent space vectors.

As explained in Section 2.5.2, the inverter will almost always switch rapidly between the zero vectors

and two active vectors. This means that during a single PWM period, up to two dierent currents can be

measured depending on the direction of Vref . Note that measuring two currents is enough since the third

current can be reconstructed by calculations. The only time when only one current can be measured is

if Vref is too close to one of the space vectors. In this case only the current corresponding to that space

vector can be sampled. The reason for this is that sampling a current takes a small time, but if Vref is

too close to a space vector, the time spent in the adjacent space vector will be too small for a reliable

measurement.

In order to produce a satisfactory sample the timing of the sampling is usually set in the middle

of the active vectors. In Figure 2.11 an typical PWM period can be seen where two currents could be

measured. For space vector V1 the measurement should happen after a time T0

4 + T1

2 /2 and for V2 after

a time T0

4 + T1

2 + T2

2 /2, resulting in measurements of currents ia and −ic.The second technique covered in this report is the three-shunt current measurement method. By

placing a shunt resistor at the emitter of each low-side switch as seen in Figure 2.13, all three currents

can be measured at the same time instead of one at a time. In that case, the timing of the measurements

is not in the middle of an active space vector but instead in the middle of the zero vector V0, when all

lower side switches are turned on. This creates a dierent limitation, namely that the time T0 has to

be big enough. The limitations for the two techniques can be seen in Figure 2.14. The blue areas are

areas where current measurements are limited or impossible altogether if Vref is in that area. Dierent

15

Page 18: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

methods may be used to circumvent these problems but the easiest one is probably to ignore all the

measurements in these regions. [14]

Figure 2.13: The placement of the resistors in the three-shunt current measurement method and the

switching state during measurements.

Figure 2.14: If Vref is inside the blue regions, current measurement is dicult or impossible. The gure

to the left is for three shunt current detection and the right one is for single shunt current detection

2.7 Torque ripples

One of the main disadvantages of permanent magnet synchronous motors (PMSM) are the parasitic

torque pulsations which occurs at periodic rotor positions. These torque pulsations are especially no-

ticeable at low-speed operations, and is naturally ltered down at higher rotor speeds [15]. These are

various sources of the torque pulsations, such as deviations from a sinusoidal ux density distribution in

the air gap, errors in current measurements, phase unbalancing and cogging. Torque ripple minimization

techniques can be classied into two dierent broad categories. The rst category consists of techniques

aimed at the motor design so that the characteristics of the PMSM approaches the ideal case. This would

make the torque production more smooth, but would complicate the production process and increase the

cost of the motors. The second class of techniques consists of algorithms used for an additional control

eort to correct for these non ideal characteristics of the machine [16]. Lots of research has been done

16

Page 19: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

on the second class of techniques, and a technique named Iterative Learning Control [15] was tested and

evaluated in this project.

2.8 Controllers

Two dierent kind of controllers are used in this project, the PI controller and ILC.

2.8.1 PI controller

The PI controller is a standard proportional, integrative and derivative (PID) controller where the

derivative part is set to zero. The PID controller algorithm is:

u(t) = Kpe(t) +Ki

∫ t

0

e(τ)dτ +Kdd

dte(t) (2.14)

where e(t) is the error signal (reference signal minus the current signal value) at the time t, and u(t)

is the controller output at time t. The PID controller works just as well in discrete time as it does in

continuous time, but the equation looks slightly dierent.

2.8.2 Iterative learning control (ILC)

ILC is a control algorithm created to reduce the error of periodic disturbances. The control law used in

this project has the following equation:

ui+1(n) = (1− α)ui(n) + Φei(n) + Γei+1(n) (2.15)

where n is the position, ei is the error during the ith repetition, ui is the input to the system during

the ith repetition, α is a forgetting factor to reduce the eect of temporary disturbances, Φ and Γ are

ILC tuning variables. In ILC, the error and controller output for each position are saved in a memory

and updated each repetition in order to reduce the eect of the periodic error. When using ILC in a

PMSM the following condition must hold in order for the algorithm to converge[15], where Kt is the

torque constant and J is the combined inertia of the rotor and the load .

‖1− Kt

JΦ‖ < 1 (2.16)

17

Page 20: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Chapter 3

Implementation

3.1 Project Specications

The present project is concerned with the inner servo system shown in Figure 2.1. The system is intended

to control the position of the motor via two inputs. The rst input species the motor rotation direction.

For a zero on the input the motor will spin in a counter-clockwise direction, and for a one the motor

will spin in a clockwise direction. The second input was a stream of pulses. For each received pulse the

motor should rotate one encoder step. An important characteristic of the rst input is that the unit

sending the stream of pulses (the outer servo system) changes the pulse rate every 50 milliseconds, and

during these 50 ms the pulse rate is constant.

The limit of the nal movement of the outer servo system was about 35 degrees per second. The

gear ratio will be somewhere between 1:40 to 1:50 which means that the maximum rotation speed of the

motor needed for this project will be about ve revolutions per second, or 300 rpm. This is quite a slow

rotation speed, but on the other hand the error in position had to be very low. In the nal position, the

error had to be max 2 encoder points out of 65536 for that encoder. The encoder in the inner system

has a resolution of 8192 points per revolution. This converts to an acceptable encoder error of about2∗8192∗50

65536 = 12.5 points for this project with a gear ratio 50:1, which is about 0.5 degrees.

3.2 Motor Specications

The motor used is this project is a 4-pole FL57BLS03 DC Brushless Motor. The specications for this

motor are given in Table 3.1. The motor is also equipped with a HKT 56 incremental rotary encoder

from Hedss. This encoder has 2048 counts of phase A and B per revolution, but if you count both

anks for both the A and B channel the precision is 8192 points per revolution which corresponds to a

mechanical resolution of ≈ 0.044 degrees.

The electrical position of the rotor in the FOC loop is controlled by the variable θ. This is a 16-bit

variable which means that the precision is 65536 points per electrical revolution. The motor has 2 pole-

pairs, which means that for each mechanical revolution there are two electrical revolutions. So if the

motor moves one encoder point, the variable θ changes 65536 ∗ 2/8192 = 16 points.

3.3 Pulse-width modulation

The pulse width modulation circuit of the TMPM373 gives you two options for waveform; sawtooth or

triangular. In this project a triangular waveform was chosen, since it gives you a symmetrical center

aligned PWM output automatically. A triangular PWM waveform means that the PWM counter starts

at zero, counts up to a max value, and counts downwards to zero again which would look like a triangle

in a diagram.

The output of the PWM circuit is controlled by a counter in the CPU. When the CPU is operating

at 80 MHz, the resolution of the PWM counter is 25 nanoseconds when using a triangular waveform. For

18

Page 21: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Table 3.1: The motor specications.

each phase a comparator variable is then set, and when the counter is below that comparator variable the

PWM output for that phase is on. This can be seen in Figure 3.1. In this project, the PWM frequency

was set to 20 kHz which means that the maximum counter value was set to 1/25∗10−9

20000 = 2000

Figure 3.1: The pulse width modulation counter operation and output for a single phase.

3.4 Computer Communication

Communication between the microprocessor and the computer is done via an serial port using an Uni-

versal Asynchronous Receiver/Transmitter (UART) which is a on-chip feature of the microprocessor. An

UART sends bytes of data by transmitting the individual bits sequentially. Another UART is used as the

receiver and puts the received bits in a shift register until a full byte has been assembled. The receiver

and transmitter UART has to be set to the same number of data bits per transmission, transmission

rate, parity bit setting and other options in order to work. In this project 8 bits of data was sent in each

transmission, plus a start and a stop bit. The baud rate was set to 115200 bits per second.

3.5 Current Measurement

For the rst system design the single-shunt described in Section 2.6. For the second system design

the three-shunt method was used. Both system designs used the circuit described in this chapter to

measure the current owing through the shunt resistor(s). The switch from the single-shunt to the

19

Page 22: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

three-shunt method was done because of easier timing implementation. It was also possible to always

measure the current of all three phases with the three-shunt method. In the single shunt case there are

certain moments for each revolution of the motor when the electrical vector is in areas where current

measurements are impossible.

The circuit in Figure 3.2 was chosen in order to reliably measure the current [17]. This circuit works

for both the single shunt and the three-shunt case. Some additional components such as capacitors was

added to various places in order to reduce noise.

Figure 3.2: A circuit used to measure the current passing through a shunt resistor.

Let's analyse what this circuit does. The operation amplier is assumed to be ideal, which means

that it has an innite amplication, innite input resistance, zero output resistance and V+ is equal to

V− at all times. This gives us the following equationsV− = Vout

R3

R3+R4

V+ = Vin + (10− Vin) R1

R1+R2

V+ = V−

(3.1)

Combining these equations leads to an expression for the output voltage Vout

Vout = (Vin + (10− Vin)R1

R1 +R2)R3 +R4

R3(3.2)

= (Vin(1− R1

R1 +R2) + 10

R1

R1 +R2)R3 +R4

R3(3.3)

The maximum peak current allowed into the motor at stall torque is 16.5 A according to the motor

specications in Figure 3.1. Since Vout is sent straight into one of the analogue-to-digital inputs of the

processor it should never go above 5 V or the processor might break. Rshunt was chosen to be 0.022

Ω which gives the maximum voltage drop over the resistor to be U = 0.022 ∗ ±16.5 = ±0.363 V. The

resistors then needs to be dimensioned so that the voltage Vin = −0.363 V to +0.363 V corresponds to

a Vout = 0 V to 5 V.

A good place to start is to assume that when Vin = 0, the output voltage is Vout = 2.5 V. The

amplication needed to push Vout up to 5 V when Vin is 0.363 V is then Av = (5−2.5)0.363 = 6.9 times. A

close match in the E12 resistor series would be to put R4 = 120kΩ and R3 = 22kΩ which gives the

amplication Av = R3+R4

R3= 22kΩ+120kΩ

22kΩ = 6.55 times.

Given this amplication, it's straightforward to nd the values of R1 and R2 to get the wanted oset

of +2.5 V.

20

Page 23: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

2.5 = (0 ∗ (1− R1

R1 +R2) + 10

R1

R1 +R2) ∗ 6.55 (3.4)

⇒ R1

R1 +R2=

2.5

65.5(3.5)

A close enough match (again from the E12 resistor series) in this case is R1 = 2.2kΩ and R2 = 56kΩ,

diering only ≈ 1% from 2.5/65.5.

3.6 First design

The rst design of the system consisted of three separate PCBs (printed circuit boards) as seen in Fig-

ure 3.3. The rst PCB had a UART communication bus, a linear voltage regulator, a crystal oscillator

and all of the CPU pins drawn to dierent connectors. Basically everything needed to get the micro-

processor running and be able to communicate with a computer. This PCB is the left-most one in

Figure 3.3.

The second PCB was a three-phase inverter board. The components used was three switch controlling

ICs (integrated circuits), six MOSFET switches and three shunt resistors. This card is in the top-right

corner of Figure 3.3. As can be seen from the gure, three sets of cables goes out of this PCB. First,

there is a yellow, red and black cable going into the motor. These are the three-phase connectors for the

motor currents. Then there is a wide 16 pin IDC connector going between the inverter board and the

CPU board (and going out of the picture for a little while). This connector contains the cables for the six

switches of the inverter. The last set of cables are the red and black cables going down to the last PCB.

These cables are connected to the shunt resistor and transports the signal down to the measurement

circuit on the last PCB.

The third PCB is a card made for an entirely dierent project, but since it had some high performance

OP-amps (operational amplier) as well as all the support circuits needed to make them work, it was

(after a couple of modications) used as a current measurement circuit. Only the part of the PCB inside

the white circle was actually used by this project and the components used were only a couple of resistors

and an OP-amp for each red-black connector couple. The three white cables going out of the picture are

the outputs of the current measurement circuit and enters the analogue-to-digital converter in the CPU

via the 14 pin IDC connector at the bottom of the CPU card.

Figure 3.3: A view of the dierent printed circuit boards used in the rst design of the system.

3.7 Second design

The second design of the system was done by integrating all necessary components on one single PCB.

This PCB, without the ground planes drawn out for easier viewing, can be seen in Figure 3.4. The legend

21

Page 24: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

points out where specic important components are located on the PCB. The schematics for the PCB

can be found in appendix 6.2. The schematics for this PCB was drawn by Andreas Nilsson at Research

Electronics and the CAD was done by me in a program called Tango PCB.

The PCB is fed 36 V as input voltage at no 1 in Figure 3.4, since that is the rated voltage for the

motor. This voltage is reduced to 12 V by an LM317 linear voltage regulator located at no 5. The 12 V is

used to power the three no 9 ICs, which controls the switching of the six power inverter switches. There

are also two dierent LM340 linear voltage regulators which regulates the 12 V down to 5 V, marked as

no 6. The reason to have two dierent regulators is to create separate circuits so that noise is limited.

Integrated circuits tend to use current in short, bursty segments and such behaviour tend to create a

lot of noise. One of the 5 V regulators powers a circuit (no 12) used to create -5 and +10 voltages used

to drive the operational ampliers of the current measurement circuits, no 7. The current measurement

circuit is placed very close to the shunt resistors, marked as no 8. The second of the 5 V regulators is

used to power the microprocessor (no 10), and the communication ICs (no 14 and 13).

The system in real life can be seen in Figure 3.5 with everything connected. The big heat sink seen

in the upper parts of the system is due to bad choice of voltage regulator. Using a linear regulator to

bring the 36 V input voltage down to 12 V produced a lot of heat. The 12 V part of the PCB used about

0.15 Ampere of current so the power loss in the linear regulator will be (36− 12) ∗ 0.15 = 3.6 watt. This

required quite a big heat sink to dissipate. In the next production iteration the linear regulator will be

replaced by a switched voltage regulator which produces almost no heat.

Figure 3.4: The printed circuit board used for the second layout of the system.

22

Page 25: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 3.5: The second design of the system with everything connected.

3.8 Programming

The embedded software used in the microprocessor was developed in IAR Embedded Workbench and

written entirely in C. Everything needed to make the system work in terms of software will be covered

in this section.

3.8.1 Main method

The main loop of the software has the following structure:

int main ( )

init_CPU_clock ( ) ;

__disable_interrupt ( ) ;

init_IO_ports ( ) ;

i n i t_ i n t e r r up t s ( ) ;

__enable_interrupt ( ) ;

// I n i t i a l i z e a l l un i t s such as UART, com−port , t imer e t c

. . .

// I n i t i a l i z e a l l g l o b a l v a r i a b l e va l u e s

. . .

FOC_startup ( ) ; //Do zero−curren t AD measurements , and i n i t FOC

while ( encoder_foundZphase==0)

23

Page 26: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

syncEncoder=1; // sp in s the motor at a low speed

syndEncoder=0;

de lay=5;

while ( de lay ) ; //Wait some time u n t i l motor s t op s moving

while (1 ) //Main loop

tgt_inp ( ) ;

i f ( pr in t_in fo_f lag )

// p r i n t i n f o f o r data c o l l e c t i o n

. . .

All of the initialization functions looks almost the same. The features of the microprocessor used in

this project are;

• 16-bit timer

• Vector engine, calculation unit for motor control

• Programmable motor driver, 3-phase PWM generator and generator of synchronous AD converter

start triggers

• Encoder input circuit, counter and comparator for absolute position detection

• General-purpose serial interface (UART), communication circuit

• 12-bit AD converter, analogue-to-digital (AD) converter circuit

• General-purpose Input/output ports

In order to initialize these you just write to a bunch of registers in the order specied in the manual.

For example, this is the code to initialize the Vector Engine in the microprocessor:

void init_VE (void )

VEEN=0x3 ;

VEERRINTEN=0x2 ;

VEREPTIME=0x10 ;

VETRGMODE=0x8 ;

VEMODE1=0x2 ;

VEFMODE1=0x50 ;

VEMDPRD1=0x7d0 ;

VEEMGRS1=1;

Once all the initialization is done, the next step is to do the FOC start up. This is an automated

process where the microprocessor saves the AD values from the current measurement circuit while no

current is owing into the motor. This is done three times with some delay in between to minimize the

eect of disturbances on the measurements.

24

Page 27: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

The next step is to look at the encoder synchronization. After the initialization of the programmable

motor drive (PMD), an interrupt is turned on so that every time the PWM counter reaches the maximum

value a function called PWMinterrupt() is called. This is used to either start the main FOC loop (most

of the time) or to start a smaller FOC loop only used for encoder synchronisation. This small FOC loop

is shown in the next code segment.

void VE_syncEncoder (void )

i f (VESCHTASKRUN&0x020 ) print_to_com0 ( "Error , . . . " ) ;

VETHETA1 += 1 ; // sp in around u n t i l Z i s found

i f (EN1TNCR&0x1000 )

ENC_foundZ=1; // encoder Z found

VEACTSCH=0x10 ; // Schedu le 1

VETASKAPP=0x50 ;

VECPURUNTRG=0x2 ; //run cpu

i f (VEERRDET&0x2 ) print_to_com0 ( "PWM in t e r r up t detec ted . \ n" ) ;

3.8.2 Vector Engine

Let's look at the purpose of the vector engine (VE). The VE is a part of the microprocessor which has

its own CPU and hardware so that the main CPU can be free to do other things. To control the VE,

you specify a schedule to be executed. After specifying a schedule, you choose a task for the VE to start

executing from. The VE will then do all tasks from that task to the last task in that specic schedule.

The dierent tasks are all used in the FOC loop and are as follows;

• Current control, this is PI control of the currents

• SIN/COS computation, calculates sin/cos of the current θ

• Output coordinate axis conversion, this does the inverse Park transformation

• Output phase conversion, this does the space vector modulation

• Trigger generation, calculates PWM compare values for the phases

• Input processing, this collects the measured current values

• Input phase conversion, this does the clarke transformation

• Input coordinate axis conversion, this does the Park transformation

There are four schedules available to choose from. The rst schedule (schedule 0) is Individual task

execution where you specify just one task to execute. The second schedule executes all task (schedule 1).

The third schedule (schedule 4) executes all tasks except the current control (useful for forcing the motor

to move without any measurements of the currents) and the last schedule (schedule 9) only executes

Output control, trigger generation and Input processing. The last schedule is used to do the zero-current

AD measurements.

The small FOC loop in the code segment above shows how you use the vector engine properly. First

there is a small safety check so that no other schedule is currently executed. Then, θ is increased by one.

A PWM/FOC frequency of 20 kHz where you increase θ by one for every loop means one revolution will

take approximately 6.5 seconds. If Z is found the motor is stopped and the synchronisation complete.

Then, the rst schedule and the Current control task (0x50) are chosen and the VE CPU started. Finally

a last safety check is conducted to check that the CPU didn't get stuck/took too long during calculations.

25

Page 28: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

3.8.3 Key press detection loop

The next part of the program is the main loop. By pressing w on the keyboard the print_info_ag turns

true which prints chosen variables at a chosen speed. This is how the data for all the experiments in this

project were collected. The tgt_inp() function detects when data is being sent to the microprocessor,

from a computer for example. Its structure is as follows;

void tgt_inp (void )

i f ( char_receive_count > 0)

char_receive_count−−;char=∗r e c e i v e_po in t e r++;

switch (char )

case ' h ' :

. . .

. . .

default :

print_to_com0 ( "%c has no command attached to i t , " ,char ) ;

print_to_com0 ( " pr e s s 'h ' f o r a v a l i a b l e commands . \ n" ) ;

break ;

Every time a character is received on the UART it is put into a receive buer and char_receive_count

is increased by one. The variable receive_counter is always pointing at the current location of the receive

buer, and once the CPU executes the tgt_inp() function it checks if there are newly received characters

in the buer. If a character is received, some commands corresponding to that character is executed with

the switch-statement. Some of the most useful commands are h (prints a help menu), + and - which

controls the rotation speed of the motor, p which turns the FOC loop on/o, m which changes between

dierent driving modes, c which allows you to enter a new Iqref etcetera.

The print_to_com0 command is a function that sends characters one at a time via the UART to the

computer, where a program made by Research Electronics is used to receive the data and communicate

with the microprocessor.

3.8.4 Field Oriented Control loop

Before looking at the main FOC loop a few supporting functions need to be looked at. Since the system

was tested on its own, a temporary function that created motor commands had to be implemented. This

function was made as simple as possible:

void MC_tick( int t i ck , int d i r )

i f ( d i r==0)

MC_pos += t i c k ;

i f (MC_pos >= EN1RELOAD)

MC_pos −= EN1RELOAD;

26

Page 29: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

else

MC_pos −= t i c k ;

i f (MC_pos < 0)

MC_pos += EN1RELOAD;

Here, the variable MC_pos is the position command of the system. It's value can be from 0 to

the maximum encoder value 8192 (denoted EN1RELOAD). Dir is a variable which decides if the motor

should spin clockwise or counter clockwise. This function will be replaced with the two inputs in the

nished cascade servo system. Another simple function is a function which calculates the shortest

distance between two encoder values, with the result being able to be both positive and negative:

int encoder_distance (unsigned int curr , unsigned int r e f )

i f ( r e f >= curr )

i f ( ( r e f−curr )<( curr+EN1RELOAD−r e f ) )return r e f−curr ;

else

return r e f−curr−EN1RELOAD;

else

i f ( ( curr−r e f )<( r e f+EN1RELOAD−curr ) )return r e f−curr ;

else

return r e f−curr+EN1RELOAD;

Again, EN1RELOAD is 8192, the maximum encoder value. An example: If curr = 10 and ref =

8180, this function would return -22. This function is used to calculate the position errors plotted in

the experiments chapter. There is also a similar function to calculate the distance between two θ values.

The biggest dierence is that EN1RELOAD is replaced by the maximum θ value of 65536.

Now let's look at the main FOC loop. To save space, some driving modes mostly used for testing

and some additional statements at various locations have been removed.

void FOC(void )

i f (VESCHTASKRUN&0x020 ) print_to_com0 ( "Error , . . . " ) ;

MC_tick(MC_speed ,MC_ccw) ;

MC_dist=encoder_distance (EN1CNT,MC_pos ) ;

THETA_dist=theta_distance (EN1CNT,VETHETA1) ;

i f (DC_loop==0)

DC_loop=20−1;DC_error=MC_dist ; //Wanted pos error = 0 => re f = 0

DC_int_ccw = DC_ki∗DC_error + DC_int_ccw ;

//some i f−s ta tements to l im i t the i n t e g r a l par t not shown

DC_output = DC_int_ccw + DC_error∗DC_kp;

else

DC_loop−=1;

27

Page 30: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

MC_speed_temp = ( int ) DC_output ;

MC_buffer += DC_output − MC_speed_temp ;

i f (MC_buffer >= 1)

MC_buffer −= 1 ;

MC_speed_temp += 1 ;

//not shown to save space : ( e l s e , do the oppo s i t e )

i f ( ! ( THETA_dist >= 16384) && ! ( THETA_dist <= −16384))

VETHETA1 += MC_speed_temp ;

//not shown to save space : ( e l s e , do the oppo s i t e )

VEACTSCH=0x10 ; // Schedu le 1

VETASKAPP=0x50 ;

VECPURUNTRG=0x2 ; //run cpu

i f (VEERRDET&0x2 ) print_to_com0 ( "PWM in t e r r up t detec ted . \ n" ) ;

The FOC loop starts by updating the position command, based on what the speed and direction

variables are currently set to (the version shown here is not exactly as it is, but if you assume speed can

be non-discrete values such as 0.05, it is close enough). The distances to the new goal in both θ and

encoder points are then calculated. The DC_loop variable determines how often a new speed should be

calculated. Using a FOC frequency of 20kHz and a DC_loop value of 20, the frequency of the speed

controller loop is 1000 Hz. If it is time to update the speed, the position error PI controller recalculates

the speed. Since the reference position error is zero, the PI controller error signal is simply the current

distance to the goal. There is some safety code to prevent the integral part of the PI regulator to grow

too large not shown as well.

Once a new speed has been calculated, it is rounded down to the nearest integer. The remained is

saved in a buer variable which grows for each FOC loop until it grows bigger than one or smaller than

minus one, at which point it is used to increase/decrease the speed by one and then starting over again.

The last if-statement is used to limit the position of the electric vector in case the rotor is stuck. If

you set θ to a xed value and forcefully move the rotor, you notice that maximal torque is produced

when the rotor is moved 90 electrical degrees from the set position. So by limiting the distance between

the rotor and the electrical vector position to a maximum of 90/360 ∗ 216 = 16384 points of θ, we ensure

that a maximum torque is produced if the rotor gets stuck.

28

Page 31: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Chapter 4

Experiments

4.1 Setup

The printed circuit boards were connected to a standard power supply unit, capable of providing up to

30 V and 5 A. Troubleshooting was performed using a standard multimeter to detect erroneous voltages

or faulty component placements. All data values plotted were obtained by the measurement circuits on

the PCBs, and collected via the UART circuit to a computer. A program made by Research Electronics

was used to send keystrokes to and receive data from the microprocessor.

4.2 Testing the rst design

For the rst design, some experiments were conducted to see how good the current control could become,

as well as how good position control could be obtained. The reference values were set to Id,ref = 0 and

Iq,ref = 8000.

The motor voltage was set quite low, about 16-18 V. The current owing into the motor was also

quite low, about 0.3 - 0.6 A. This is because of the limitations of the rst system hardware layout, where

the thin cables and the separate PCBs caused problems with the common ground when the current was

too high. Also, the voltage regulator that supplied the integrated circuits on the PCBs could not handle

more than about 20 V before breaking. For the current control, the PI-controller on the microprocessor

was used and the Kp and Ki were altered to try and get as good control as possible. For the position

control an simple home made method was used.

The motor was set to rotate at 0.8 Hz by specifying how much the θ variable was changed every

FOC loop. As stated earlier in Section 3.2, θ has to be increased 16 points for each encoder point.

The PWM/FOC frequency was 20 kHz, so the speed (points added to θ every FOC loop) was then:

16 ∗ (0.8 ∗ 8192)/20000 ≈ 5.24 points per loop.

Then, if the distance between the commanded position and the position given by the encoder was too

large, the speed was either increased or decreased by one point for that loop. Since the θ register can

only hold discrete values, all speed values were round down to the closest integral and a buer variable

stored the non-integral part of θ until the next loop, where it was added to θ again.

Figure 4.1 shows the results of the experiments for the rst system layout with a sampling rate of

about 114 Hz (one sample every 8.75 ms). Position error is dened as the dierence between wanted

and actual position. For the current graphs, the values of the Y-axis are not very important except for

illustration purposes. It is simply the value given from the analogue-to-digital converter saved as a xed

point variable but read as an integer.

In Figure 4.1 the dierence is shown between the commanded position and the actual encoder position

as well as the speed multiplied by ten in the upper graph, and the Id and Iq current in the lower graph.

It easy to see that when Ki = 1 and Kp = 1 the current control is not very good. There is one huge

current spike about twice every mechanical revolution.

29

Page 32: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 4.1: Upper graphs: Position error and speed during a current control test of the rst design.

Lower graphs: The d and q axis currents

When the PI controller is set to Kp = 1000 and Ki = 10 the huge current spikes are dampened quite

a lot, but both id and the position seems to be a lot more periodic.

The last current controller result for the rst design can be seen in the two rightmost gures. For

this test, the PI controller was set to Kp = 10000 and Ki = 1000. Compared to the other results,

all the periodic errors in the current seems to have disappeared. The control of the current looks to

be quite smooth and nice except for some white noise. The source of this white noise was most likely

the sub-optimal set-up of the system, with three separate PCBs and not very good grounding, which

resulted in noisy current measurements. The dierence between wanted and actual position almost looks

like white noise as well in this example.

The position control of the motor turned out to be quite a disappointment for all tests done on

the rst layout of the system. As you can see from the three dierent setting of the current controller

presented in this chapter, the position error of the motor is quite rough, sometimes diering as much

as 150 encoder points from the commanded angular position (≈ 6.6 degrees). Also, it seems like the

position dierence gets more noisy when the current control gets more smooth. After these results were

gathered, at least one of the PCBs broke during an experiment with higher voltage.

30

Page 33: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

4.3 Testing the second design

For the second system design, a software implementation of a PI controller was used to control the speed

of the motor during all tests. Various tests were performed to properly tune the PI controller for the

current, as well as for the PI controller of the speed.

In most of the recent research on FOC, the output from the speed PI controller is a reference current as

discussed in Section 2.2. In this project the output from the speed PI controller is instead the increment

of θ for every FOC loop. The benet of this is that the current consumption of the motor is more or less

constant, and it's easier to handle situations where the "base speed" of the motor is unknown.

In order to test the motor in a real environment, a small disc of wood was built and mounted on the

motor. The rotor inertia, as seen in Figure 3.1, was 0.173 kgcm2. A general rule of thumb is to keep the

inertia ratio below 10:1, which means that the inertia of the load should be kept at a maximum of 1.73

kgcm2. In this case, the small disc of wood had a weight of 67 g and a radius of 3.6 cm. This corresponds

of an inertia of Iz = mr2

2 = 0.067∗3.62

2 = 0.434 kgcm2. The inertia ratio is then 0.4340.173 = 2.5 : 1, which is

satisfactory. The wooden disc can be seen in Figure 4.2 next to the motor.

Figure 4.2: The motor and the wooden disc used as a load during the tests of the second system design.

As in the rst system design, the sampling rate of all gures shown here is about 114 Hz and speed

refers to how much the electric vector angle θ is increased for each FOC loop. Position error means the

dierence between wanted and actual position. The pulse-width modulation and FOC loop frequency is

20 kHz.

4.3.1 Determination of current PI controller settings

In Figure 4.3 the appearance of the pulse-width modulation can be seen at the same time as the currents,

for two very dierent settings of the current PI controller. In the two gures to the left, the current PI

regulator is set to Kp = 8 and Ki = 3. For the two gures to the right, the settings are Kp = 20000 and

Ki = 1000. For the left graphs, the current control is not very strict, but the shape of the pulse-width

modulation is almost perfect. On the other hand, in the right graphs, the current control seems to be

almost perfect, but the shape of the pulse-width modulation is not very smooth. In this test no speed

controller was used, the variable θ was simply increased by one every FOC loop so the motor would

rotate.

From this experiment, the values of Kp = 12 and Ki = 4 for the current PI controller were chosen.

Later tests not included in this report showed that the values doesn't really make that much of a dierence

when it comes to the most important thing, the position error of the rotating motor.

31

Page 34: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 4.3: A view of how the current PI controller settings aects both the shape of the current and

the shape of the pulse-width modulation.

4.3.2 Determination of speed PI controller settings

The speed PI controller loop was executed once every twenty FOC loops, which translates to 1000 Hz.

In order to nd a good starting point for the tuning of the speed PI controller, Ziegler-Nichols tuning

rules were used. They are as follows:

1. Set Ki = 0

2. Change Kp until the system oscillates with a constant amplitude, this value is denoted Ku

3. Find the oscillation period Tu when this happens.

4. Set Kp = 0.45Ku and Ki = 1.2Kp

Tu

This gives a good basis from where additional adjustments can be made. In Figure 4.4, KP = 0.08

and KI = 0 and this makes the system oscillate with an almost constant amplitude. The interesting

oscillations are the small ones, since the bigger ones occur for dierent reasons and indierent from the

controller settings.

The distance between the oscillations is about 8 samples, which translates to 0.00875 ∗ 8 ∗ 1000 = 70

controller loops. Following Ziegler-Nichols rules, this results in: Kp = 0.45Ku ≈ 0.03 and Ki = 1.2Kp

Tu=

1.2 0.03670 = 0.0006 Using Kp = 0.03 and Ki = 0.0006, the resulting position error over time can be seen in

Figure 4.5. A longer test, about twenty thousand samples, can be seen in Figure 4.6. In this gure the

position error is plotted against the rotor position, and it seems like the position error is quite dependant

on the rotor position.

32

Page 35: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 4.4: The system is oscillating with an almost constant amplitude when KP = 0.08 and KI = 0.

4.3.3 Iterative Learning Control in order to reduce periodic disturbances

The periodic disturbances seen in Figure 4.6 are probably a type of torque ripple, as explained in

Section 2.7. In order to reduce these torque ripples, an algorithm called Iterative Learning Control (ILC)

was implemented. In order to test this algorithm, over twenty thousand samples were collected. The

root mean square error of one hundred samples at a time was calculated and can be seen in Figure 4.7.

It seems like the positioning error does indeed get smaller using ILC. However, the memory size

of the Toshiba microprocessor was not big enough to implement ILC in a satisfactory way. The 8192

measurable angular positions had to share only 512 position variables, resulting in segments of length

sixteen. This probably severely limited how much ILC could improve the results.

33

Page 36: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 4.5: Upper graph: Position error during a speed PI control test with KP = 0.03 and KI = 0.0006.

Lower graph: The d and q axis currents.

Figure 4.6: The position error is plotted versus the rotor position for twenty thousand samples.

34

Page 37: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 4.7: Using ILC reduces the root mean square of the position error.

35

Page 38: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Chapter 5

Results and Discussion

The results show that the performance requirement of a position error less than 12.5 encoder points is

met. The root mean square of the position error of 18071 samples was 3.34 encoder points, which is

about 0.15 degrees. Using iterative learning control, this RMS value can be decreased further, to about

2.5− 3 encoder points. The eect of ILC is probably limited by the small memory of the microprocessor

which decreases the "resolution" of ILC to segments that are sixteen encoder points wide.

These results were obtained when tuning the speed PI controller at a xed speed. Increasing the

speed and using the same PI controller settings seems to decrease the accuracy of the position control.

The PI controller was never tuned for a higher speed, so if performance also degrades when the speed is

lower than the speed which the PI controller was tuned for is not known.

When the position error is used as control signal to the speed PI controller the current consumption

of the motor is not minimized. The current is minimized if we use the least torque needed and the electric

vector is exactly ninety degrees from the rotor position. When manipulating the electric vector as in this

project, a reference current is set and the electric vector is changed until enough torque is produced so

that the rotor starts to move. This means that a lot more torque is available but not utilized.

In the beginning of the project a lot of time was spent trying to set up the microprocessor properly

and that turned out to be quite troublesome because the manual had some severe errors. For example,

for one of the registers (VEMODE1) the manual tells you explicitly to always write zero to certain bits

(4 and 6). But you have to write ones to these bits or an important feature of the microprocessor called

Vector Engine will not work at all.

An impressive feature of the microprocessor is the way it handles the pulse-width modulation levels.

As stated in Section 3.3, the maximum PWM counter value is 2000. This means that the compare value

of the three phases can only take discrete values between one and two thousand. This should severely

decrease the resolution of the outputted current. Figure 2.10 in Section 2.5.2 spans the vector space

which contains all possible currents for the PWM output using space-vector pulse-width modulation.

But if the compare values are limited to 1 to 2000, this space should consist of dots, instead of being

a continuous space. The problem would get even worse with higher PWM frequency. Using a 50 kHz

PWM frequency results in a maximum counter value of just 800. Also, using a shorter current vector

(less current) would also result in a larger discretization error. But it turns out that the microprocessor

actually solves this by itself by using a PWM-like algorithm on the compare values. If you set θ to a

xed value where you might expect problems to arise and observe the compare values, it can be seen

that they rapidly change between two adjacent values in order to avoid discretization errors. If the "true

value" of the compare value should be for example 14.2, the compare value will be 14 about 80% of the

time and 15 during 20% of the time.

5.1 Dead-time aecting the performance

During the rst weeks of experiments on the second design of the system the performance was much

worse than the ones presented in Chapter 5. A typical plot of the position error over time can be seen in

36

Page 39: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Figure 5.1, as well as the phase currents (these are scaled to a maximum value of 150). The interesting

feature here is that as soon as one of the phase currents cross the zero current section, there is a clear

distortion of the phase current. This causes the position error to quickly rise to about seventy encoder

points, equal to about three degrees of error.

The cause of these distortions is a feature of the pulse width modulation called dead-time. As

explained in chapter 2.5.2 in an inverter leg with two power switches, one of the power switches is always

on and one is always o. When the inverter leg then switches state, both of the power switches needs

to change. Since they both change at the same time, this could cause some kind of situation when one

switch is on and the other one manages to nish switching from o to on. In this case, a short circuit

situation will happen. To prevent this, a dead-time is introduced which is a time lag between the starting

times of the switching. In this project that time lag was 500 nanoseconds.

There are a lot of research available on this subject, and on how to compensate for this eect [18]. But

in this project, this problem was solved by simply setting the dead-time to zero in the microprocessor.

According to the data sheet of the inverter gate drivers, the turn o-time is shorter than the turn-on

time. That means that something almost like dead-time is already built into the hardware of the circuit,

and an additional software-controlled dead-time is not needed, and does more harm than good.

Figure 5.1: The position error compared to the phase currents when using a dead-time of 500 nanoseconds.

37

Page 40: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Chapter 6

Conclusions and suggestions for future

work

6.1 Conclusions

The start of this project was quite slow due to problems with the microprocessor and how to use it,

but once that part was solved three printed circuit boards were built and connected together to create

a rst design of the system. The experiments done on this system showed that the performance of both

the hardware and software was severly lacking. The hardware was therefore completely redesigned and

placed on a single printed circuit board, and the software was rewritten to control the speed via a PI

controller. The experiments on the redesigned system shows that is is possible to build a very cheap

servo system around a BLDC motor with very good performance using FOC. The root mean square of

the position error was about 3.3 encoder points for a xed speed and xed rotation direction, which

is about 0.15 degrees. Using ILC, this error was further reduced to about 2.5 − 3 encoder points, but

memory and resolution problems reduced the practical use of this algorithm.

6.2 Suggestions for future work

A lot of more work can be done on the programming part. For instance an interesting issue is how to

control the rotation speed in a good way. As stated in chapter 4.3, for this project the speed controller

input is the position error and it controls the position of the electrical vector. But imagine that you set

the electrical vector to always be 90 ahead/behind the rotor position, and then you slowly increase the

current (starting from zero) until the motor starts to move. This way you could always get the maximal

torque per current and use the reference current to control the speed. This is how systems built around

FOC generally work from what I've seen. A problem one would need to solve if attempting this is how

to implement a good controller. How do you create a controller that both tries to minimize the current

consumption and is quick to react to load changes without causing a huge position error?

Another way to implement this would be to utilize the existing function theta_distance(). This

function returns the distance between the rotor and the electrical vectors position. A controller could

easily be implemented to try and keep this distance as close as possible to 90 by manipulating the value

of the reference current. This would be sort of a tradeo between a strict "90-only" algorithm and the

algorithm presented in this project which does not try to minimize current consumption at all.

38

Page 41: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Appendix

A1. Schematics for the second system design

These schematics were drawn by Andreas Nilsson at Research Electronics.

1mF

C9 P12

P11

C5

1uF

C4

1uF

4700

R11

560

R10LM317

IC4

A

1

VO2

VI3

1uFC

1

LM5101AM

IC1LO

8

VSS7

LI6

HI5

HS4

HO3

HB2

VDD1

R7

10

R1

10

T1

IRFR3806

T4

IRFR3806

P8

10R4

1uFC

2

LM5101AM

IC2LO

8

VSS7

LI6

HI5

HS4

HO3

HB2

VDD1

R8

10

R2

10

T2

IRFR3806

T5

IRFR3806

P9

10R5

1uFC

3

LM5101AM

IC3LO

8

VSS7

LI6

HI5

HS4

HO3

HB2

VDD1

R9

10

R3

10

T3

IRFR3806

T6

IRFR3806

P10

10R6

C6

100n

F

C7

100n

F

C8

100n

F

ISGND och ISNS skall ha korta avstnd till OP

... och en bit frn kraftiga strmbanor

TAB:n r ven Vout

SDRV.S01 1

A

110909

Servo drive PWR part

SAE

V24

V12

V24

GND

PH1

GNDV12

V24

GND

PH2

GNDV12

V24

GND

PH3

GNDLI1HI1

LI2HI2

LI3HI3

V12

GND

ISGND1

ISNS1

ISGND2

ISNS2

ISGND3

ISNS3

A B C D

4

3

2

1

DCBA

1

2

3

4

A4RevNumber

Title

Size

DateFilename

Drawn byofSheet

Figure A.1: THSERVO1

39

Page 42: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

VALR14

VALR16

100nF

C42

R15

0

P4

100nF

C35

100nF

C34

1uF

C20

1uF

C23

1uF

C26

OPA2277

IC11:B7

+5

-6

OPA2277

IC11:A-2

+3

4

8

1

OPA2277

IC8:B7

+5

-6

100nF

C45

100nF

C46

100nF

C44

100nF

C43

1uF

C41

C36

22uF

IC17

LM340

VO3

G

2

VI1

OPA2277

IC8:A-2

+3

4

8

1R6

10

R7

1K

R8

10

R9

1K

R10

10

R11

1K

33nF

C18

33nF

C21

33nF

C24

P1 P2 P3

C51

100nF

C53

100nF

C52

100nF

100nFC62

VALR22

VALR32

VAL

R17

VALR18

VALR21

VALR31

VALR28

VALR33

VALR34

C10 100nF

130917

24 bit A/D board

SAEVIBR2.S02 32

A

V5REF till Toshibas VREF

R15 och CAP:s nra CPU

ISAD:s till AD-in p CPU

VSPAD speglar batterispnning

ISNS1

ISGND1

V10

V10 V5

V5REF

V5GND

V5P

V5-

GND

GND

GND

GND

V12 V5

V10

V5-

V10

V5-

ISAD3

ISAD2

ISAD1

GND +12V5GND

V5

GND

GND

V10

V10

ISGND2

ISNS2

ISGND3

ISNS3

VSPAD

GND

V24

A B C D

4

3

2

1

DCBA

1

2

3

4

A3RevNumber

Title

Size

DateFilename

Drawn byofSheet

Figure A.2: THSERVO2

40

Page 43: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

1

R29

IC16:F

4069

12 13

VCC14

GND7

4069

IC16:D

98

IC16:E

4069

10 11

220

R30

C30

22uF

1

R25

1

R26

C32

22uFBAT54

D2

C31

22uF

T2

IRLML2030

T1

IRLML9303

C27 39pF

22K

R24

1M

R23

IC16:C

4069

65

IC16:A

4069

21

IC16:B

4069

43

BA

T54

D3

LM4120-5.0

IC13

IN4

EN3

GND2

OUT5

REF1

2.2K

R27

C56

22uF

C58

22uF

BA

T54

D5

C59

10uF

BAT54

D4

C57

10uF

V5P lgpassfiltreras i S02 till Toshiba VREF

DC/DC PWR circuit

A

VIBR2.S03SAE

3 3130917

V5V10

GND

V5-

GND

GND

V5P

GNDV5

V10

GND

GND

A B C D

4

3

2

1

DCBA

1

2

3

4

A4RevNumber

Title

Size

DateFilename

Drawn byofSheet

Figure A.3: THSERVO3

41

Page 44: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

C48

100nF

4.7KR37

J8

123

LM340

IC5VI

1G

2

VO3

J5

IDC6

135

246

J4

54321

C29

100nF

C22 100nF

1uF

C1310uF C12

22P

F

C25

X1

10MHz

C11 22PF

C33

100nF

C28 100nF

C39

100nF

IC6

MAX202

VCC16

GND15

R2IN8

R1IN13

T2UT7

T1UT14

C2-5

C2+4

C1-3

C1+1

V+2

V-6

T1IN11

T2IN10

R1UT12

R2UT9

C47100nF

4.7K

R364.7K

R35

X24C04

IC9

GND4

VCC8

SDA5

TEST7

A01

A12

A23

SCL6

10KR12

J3

12

C37 1uF

BAS16

D1

TMPM373FWDUG

IC7

AGND42

VREF43

XTAL127

XTAL229

RESET34

PA.4/SCLK148

PA.5/TXD147

PA.6/RXD146

PA.2/TB1IN25

PB.3/SWDIO16

PB.4/SWCLK15

PB.5/SWV14

PB.6/TDI13

PD.61

PE.0/TXD017

PE.1/RXD018

PE.2/SCLK019

PE.4/TB2IN20

PE.6/TB3IN45

PE.7/TB3OUT44

PI.3/AN235

PJ.0/AN336

PJ.5/AN837

PJ.6/AN938

PJ.7/AN1039

MODE31

PF.1/TB7OUT24

PF.2/ENCA121

PF.3/ENCB122

PF.4/ENCZ123

PG.0/U12

PG.1/X13

PG.2/V14

PG.3/Y15

PG.4/W16

PG.5/Z17

PG.6/EMG18

PG.7/OVV19

V1530

V3033

PK.0/AN1140

PK.1/AN1241

V511

V526

V532

GND28

GND10

PF.0/BOOT *12

4.7uFC38

4.7uFC40

C19

100nF

C17

100nF

C16

100nF

C15

100nF

C14

1uFJ2

12

J1

12

10K

R38

J7

12

J61

7

35

2468

0R13

0R19

4.7KR20

130620SERVO.S01

TMPM373 simple system

A

11SAE

RELENC

ABSENC

POTAD

V5

GND

EBEA

EZV5D

GND

TXD1RXD1

PA2PA4

PB3PB4PB5PB6

PD6

PK1PK0VSPAD

PE7PE6

PF1

GND

GNDGND

RXD0

TXD0

GND

V5DGND

GND

GND V5D

SDA

SCL

GND

V5D

GNDV5REF

V5D

GND

BOOT

GND

SDASCL

RXD0TXD0

POTAD

ISAD1

HI1LI1HI2LI2HI3LI3EMGOVV

EZEBEA

ISAD2ISAD3

V5D

GND

V12

V5D

GND

BOOT

V5D

PE6 RXD1TXD1 PA4

GND

RXD1

TXD1

V5D

A B C D

4

3

2

1

DCBA

1

2

3

4

A4RevNumber

Title

Size

DateFilename

Drawn byofSheet

Figure A.4: THSERVO4

42

Page 45: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

Bibliography

[1] D. Casadei, F. Profumo, G. Serra, and A. Tani, Foc and dtc: two viable schemes for induction

motors torque control, Power electronics, IEEE Transactions on, vol. 17, no. 5, pp. 779787, 2002.

[2] J. P. John, S. S. Kumar, and B. Jaya, Space vector modulation based eld oriented control scheme

for brushless dc motors, in Emerging Trends in Electrical and Computer Technology (ICETECT),

2011 International Conference on, pp. 346351, IEEE, 2011.

[3] S.-B. Lee, Closed-loop estimation of permanent magnet synchronous motor parameters by pi con-

troller gain tuning, Energy Conversion, IEEE Transactions on, vol. 21, no. 4, pp. 863870, 2006.

[4] P. C. Krause, O. Wasynczuk, S. D. Sudho, and S. Pekarek, Theory of brushless dc machines, in

Analysis of electric machinery and drive systems, vol. 75, pp. 261265, John Wiley & Sons, 2013.

[5] C. Lee and W. Pang, A brushless dc motor speed control system using fuzzy rules, in Power

Electronics and Variable-Speed Drives, 1994. Fifth International Conference on, pp. 101106, IET,

1994.

[6] R. Gabriel, W. Leonhard, and C. J. Nordby, Field-oriented control of a standard ac motor using

microprocessors, Industry Applications, IEEE Transactions on, no. 2, pp. 186192, 1980.

[7] Field orientated control of 3-phase ac-motors. Literature Number: BPRA073, Texas Instruments,

1998.

[8] J. Zambada and D. Deb, Sensorless eld oriented control of a pmsm, in Application Note 1078,

no. DS01078B, Micropship Technology Inc., 2010.

[9] J. R. Mevey, Sensorless eld oriented control of brushless permanent magnet synchronous motors.

M.S. thesis, Dept. Elec. and Comp. Eng., Kansas State University, Manhattan, 2009.

[10] K. Zhou and D. Wang, Relationship between space-vector modulation and three-phase carrier-based

pwm: a comprehensive analysis [three-phase inverters], Industrial Electronics, IEEE Transactions

on, vol. 49, no. 1, pp. 186196, 2002.

[11] H. W. Van Der Broeck, H.-C. Skudelny, and G. V. Stanke, Analysis and realization of a pulsewidth

modulator based on voltage space vectors, Industry Applications, IEEE Transactions on, vol. 24,

no. 1, pp. 142150, 1988.

[12] L. Zhang, C. Wathanasarn, and F. Hardan, An ecient microprocessor-based pulse-width modula-

tor using space vector modulation strategy, in Industrial Electronics, Control and Instrumentation,

1994. IECON'94., 20th International Conference on, vol. 1, pp. 9196, IEEE, 1994.

[13] F. Parasiliti, R. Petrella, and M. Tursini, Low cost phase current sensing in dsp based ac drives, in

Industrial Electronics, 1999. ISIE'99. Proceedings of the IEEE International Symposium on, vol. 3,

pp. 12841289, IEEE, 1999.

[14] S. Chi, X. Wang, Y. Yuan, Z. Zhang, and L. Xu, A current reconstruction scheme for low-cost

pmsm drives using shunt resistors, in Applied Power Electronics Conference, APEC 2007-Twenty

Second Annual IEEE, pp. 17011706, IEEE, 2007.

43

Page 46: Design and implementation of a servo system by Sensor Field …765879/FULLTEXT01.pdf · 2014-11-24 · 75000 USD. Therefore, Research Electronics has decided to build this system

[15] W. Qian, S. Panda, and J. Xu, Speed ripple minimization in pm synchronous motor using iterative

learning control, Energy Conversion, IEEE Transactions on, vol. 20, no. 1, pp. 5361, 2005.

[16] J. P. Yun, C. Lee, S. Choi, and S. W. Kim, Torque ripples minimization in pmsm using variable

step-size normalized iterative learning control, in Robotics, Automation and Mechatronics, 2006

IEEE Conference on, pp. 16, IEEE, 2006.

[17] D. Torres and J. Zambada, Single-shunt three-phase current reconstruction algorithm for sensorless

foc of a pmsm, in Application Note 1299, no. DS01299A, Micropship Technology Inc., 2009.

[18] A. Oliveira, C. Jacobina, A. Lima, and E. Da Silva, Dead-time compensation in the zero-crossing

current region, in Power Electronics Specialist Conference, 2003. PESC'03. 2003 IEEE 34th An-

nual, vol. 4, pp. 19371942, IEEE, 2003.

44