80
Electromechanical Disk Brake for Electric Vehicle A thesis submitted in partial fulfilment of the requirements for the award of the degree Bachelor of Engineering (Mechatronic) from University of Wollongong by Matthew L. Barrett School of Electrical, Computer and Telecommunications Engineering May, 2015 Supervisors: Asoc. Prof. Haiping Du & Dr Phillip Commins

thesis

Embed Size (px)

Citation preview

Page 1: thesis

Electromechanical Disk Brake for Electric Vehicle

A thesis submitted in partial fulfilment of the

requirements for the award of the degree

Bachelor of Engineering (Mechatronic)

from

University of Wollongong

by

Matthew L. Barrett

School of Electrical, Computer and Telecommunications

Engineering

May, 2015

Supervisors: Asoc. Prof. Haiping Du & Dr Phillip Commins

Page 2: thesis

AbstractControl-by-wire is a technology under constant development for modern vehicles in

an e↵ort to improve performance, e�ciency and safety. Development of an elec-

tromechanical brake is an important part of a complete control-by-wire system for

an electric vehicle. The design and control of an electromechanical brake introduces

a number of engineering and design challenges relating to its control and mechanical

design.

This report outlines how an electromechanical disk brake calliper will be manufac-

tured for use on a vehicle being designed and constructed for research. The presented

calliper design is based on a ball ramp actuator powered by an electric motor though

a planetary gear. The design is described and justification presented for the design

chosen. Historically, ball ramps have often been used for clutches or parking brakes,

but there is no current literature where a ball ramp has been demonstrated for an

electromechanical braking system. Here, a low moment of inertia ball ramp is being

described for use to improve control and responsiveness of the system.

Finally, the test bed is outlined demonstrating method and procedure for testing of

the electromechanical brake calliper, as well as its response using di↵erent control

strategies. For this test bed a momentum simulation was created to simulate the

mass of a vehicle slowing down under braking.

It is anticipated that this project will contribute valuable research due to the current

absence of robust literature regarding ball ramps, especially within the context of

electromechanical braking.

ii

Page 3: thesis

AcknowledgementsFirst, I would sincerely like to thank my supervisors Asoc. Prof. Haiping Du and Dr

Philip Commins. Their advice and encouragement has been invaluable throughout

this project. I also thank them for the countless times they have gone out of their

way to help me, such as sending me links to relevant information, or organizing the

servo motor used for the test bed.

Also a massive thanks to Sean from the workshop who spent many hours manufac-

turing parts for my project.

I would also like to thank my boss Wayne, from RPAS Training and Solutions, and

everyone at work who has allowed me to take time o↵ work to write this report as

well as encouraged me throughout the semester.

Finally, I would like to thank my parents who have helped support and encourage

me throughout my university studies.

iii

Page 4: thesis

Statement of OriginalityI, Matthew L. Barrett, declare that this thesis, submitted as part of the requirements

for the award of Bachelor of Engineering, in the School of Electrical, Computer and

Telecommunications Engineering, University of Wollongong, is wholly my own work

unless otherwise referenced or acknowledged. The document has not been submitted

for qualifications or assessment at any other academic institution.

Signature:

Print Name:

Student ID Number: 3858789

Date:

iv

Page 5: thesis

Contents

Abstract ii

Abbreviations and Symbols xiii

List of Changes xiv

1 Introduction 1

1.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Aims and Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.3 Report Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.4 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Literature Review 5

2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2 Electromechanical Brakes . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2.1 Regenerative Braking . . . . . . . . . . . . . . . . . . . . . . . 5

2.2.2 Control-By-Wire . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2.3 Electromechanical Brakes . . . . . . . . . . . . . . . . . . . . 6

2.2.4 Ball Ramp Actuators . . . . . . . . . . . . . . . . . . . . . . . 6

2.2.5 Brake Clamping Force . . . . . . . . . . . . . . . . . . . . . . 7

2.2.6 Brake Controllers . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3 Braking Test Bed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Mechanical Design 12

3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3.2 Calliper Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

v

Page 6: thesis

3.3 Ball Ramp Actuator . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3.1 Design Process . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3.2 Final Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3.3.3 Manufacturing . . . . . . . . . . . . . . . . . . . . . . . . . . 16

3.4 Finished Actuator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.5 Motor and Gearbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.6 Issues and Areas for Improvement . . . . . . . . . . . . . . . . . . . . 22

3.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

4 Electrical Design 25

4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.2 Stepper Motor Controller . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.3 Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.4 Arduino Due . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4.4.1 Quadrature Decoder . . . . . . . . . . . . . . . . . . . . . . . 27

4.4.2 12-bit Digital to Analog Output . . . . . . . . . . . . . . . . . 30

4.4.3 Variable Frequency Waveform Generator . . . . . . . . . . . . 31

4.5 Op-Amp Output Level Shifting . . . . . . . . . . . . . . . . . . . . . 32

4.6 Servo Drive Enabling . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

5 Brake Controller 36

5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

5.2 Control Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

5.2.1 PID Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

5.2.2 Fuzzy Logic Control . . . . . . . . . . . . . . . . . . . . . . . 36

5.2.3 Control Plate Rotation Angle . . . . . . . . . . . . . . . . . . 36

vi

Page 7: thesis

5.2.4 Motor Current . . . . . . . . . . . . . . . . . . . . . . . . . . 37

5.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

5.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

6 Experimental Testing 38

6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

6.2 Project Delays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

6.3 Test Bed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

6.4 Servo Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

6.5 Simulink Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

6.6 Inertia Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42

6.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

7 Conclusion 45

7.1 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

7.2 Ball Ramp Actuator . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

7.3 Test Bed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

7.4 Future Development . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

References 47

A Project Plan 49

A.1 Project Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

A.2 Project Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

A.3 Project Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

A.4 Adaption of Supervisor and Examiners feedback in the ECTE451 report 51

B Logbook Signatures 52

vii

Page 8: thesis

C Hardware Documentation 53

C.1 Control Plate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

C.2 Assembled Ball Ramp Actuator . . . . . . . . . . . . . . . . . . . . . 54

C.3 Actuator Plate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

C.4 Base Plate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

C.5 Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

C.6 Spring Mount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

D Software Documentation 59

D.1 Arduino Due Quadrature Decoder Simulink Block . . . . . . . . . . . 59

D.1.1 Libraries / Includes . . . . . . . . . . . . . . . . . . . . . . . . 59

D.1.2 Discrete Update Source Code . . . . . . . . . . . . . . . . . . 59

D.1.3 Outputs Source Code . . . . . . . . . . . . . . . . . . . . . . . 60

D.2 Arduino Due 12-Bit DAC Simulink Block . . . . . . . . . . . . . . . . 61

D.2.1 Libraries / Includes . . . . . . . . . . . . . . . . . . . . . . . . 61

D.2.2 Discrete Update Source Code . . . . . . . . . . . . . . . . . . 61

D.2.3 Outputs Source Code . . . . . . . . . . . . . . . . . . . . . . . 61

D.3 Arduino Due Frequency Generator Simulink Block . . . . . . . . . . . 62

D.3.1 Libraries / Includes . . . . . . . . . . . . . . . . . . . . . . . . 62

D.3.2 Discrete Update Source Code . . . . . . . . . . . . . . . . . . 62

D.3.3 Outputs Source Code . . . . . . . . . . . . . . . . . . . . . . . 62

D.4 Test Bed Simulink Model . . . . . . . . . . . . . . . . . . . . . . . . . 64

D.5 Test Bed Motor Control Subsystem . . . . . . . . . . . . . . . . . . . 64

D.6 Momentum Sim Subsystem . . . . . . . . . . . . . . . . . . . . . . . 64

D.7 Servo Motor Subsystem . . . . . . . . . . . . . . . . . . . . . . . . . 65

D.8 Servo Drive Enable Subsystem . . . . . . . . . . . . . . . . . . . . . . 65

viii

Page 9: thesis

D.9 Calculate Stopping Time Subsystem . . . . . . . . . . . . . . . . . . 65

D.10 Braking Control Subsystem . . . . . . . . . . . . . . . . . . . . . . . 66

ix

Page 10: thesis

List of Tables6.1 Test bed servo motor properties. . . . . . . . . . . . . . . . . . . . . . 40

x

Page 11: thesis

List of Figures1.1 Zuma Scorpion 300. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.1 Low Inertia Ball Ramp. . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2 Motor angle characteristic curves. . . . . . . . . . . . . . . . . . . . . 7

2.3 Clamp force vs motor torque. . . . . . . . . . . . . . . . . . . . . . . 8

2.4 Clamping force and gap distance response. . . . . . . . . . . . . . . . 9

2.5 UTS Powertrain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.6 EMB Brake Test Bed . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.1 Exploded Rendering of Actuator . . . . . . . . . . . . . . . . . . . . . 12

3.2 Original Brake Caliper . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.3 3D Printed Ball Ramp. . . . . . . . . . . . . . . . . . . . . . . . . . . 14

3.4 Planetary Gearbox. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.5 Ball Ramp Actuator. . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.6 3D Print of final Design. . . . . . . . . . . . . . . . . . . . . . . . . . 15

3.7 Actuator Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3.8 Top View of Actuator . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.9 Ball Ramp Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.10 Manufacturing in CNC Mill . . . . . . . . . . . . . . . . . . . . . . . 19

3.11 Milling Test in Perspex . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.12 Machined Actuator Plate . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.13 Ball Ramp Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.14 Control Plate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3.15 Actuator Base Plate . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

3.16 Stepper Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3.17 Planetary Gearbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

xi

Page 12: thesis

4.1 Arduino Due Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . 26

4.2 Arduino Sheild . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4.3 Comparator Circuit for Quadrature Decoder . . . . . . . . . . . . . . 28

4.4 Comparator Circuit on Sheild . . . . . . . . . . . . . . . . . . . . . . 28

4.5 Quadrature Decoder Driver Block. . . . . . . . . . . . . . . . . . . . 29

4.6 S-Function Builder Screenshot. . . . . . . . . . . . . . . . . . . . . . 29

4.7 Op-Amp Output to Motor Drive . . . . . . . . . . . . . . . . . . . . . 32

4.8 Op-Amp Circuit on Sheild . . . . . . . . . . . . . . . . . . . . . . . . 33

4.9 Servo Drive Enable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.10 Enabling Circuit on Shield . . . . . . . . . . . . . . . . . . . . . . . . 35

6.1 Complete Test Bed . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

6.2 Test bed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

6.3 Test bed brake. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

6.4 Main Simulink Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

6.5 Inertia Simulink Model . . . . . . . . . . . . . . . . . . . . . . . . . . 42

6.6 No Inertia Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

6.7 Free Deceleration With Momentum Sim . . . . . . . . . . . . . . . . 43

6.8 Varying Inertia Gain . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

xii

Page 13: thesis

Abbreviations and Symbols

ABS Anti-lock braking system

DAC Digital to Analog Converter

EV Electric Vehicle

EMB Electromechanical Brake

IC Integrated Circuit

PC Personal Computer

PID Proportional, Integral, Derivative control

PWM Pulse Width Modulation

A Amps Current

V Volts

⌦ Ohms Resistance

xiii

Page 14: thesis

List of Changes

Section Statement of Changes PageNumber

Abstract Rewritten for changes in the project and new work com-pleted in second session

Page ii

Introduction Updated and changed due to changes in project scopesince first session

Page 1

Literature Review New research added and partly rewritten. Page 5

Mechanical Design Updated to reflect the final design. Details of manufac-turing included.

Page 12

Electrical Design Chapter re-written with work completed. Details of allelectrical circuits added.

Page 25

Testing Updated with work completed and the test bed controlsystems. Also added Simulink simulation models.

Page 38

Conclusion Updated to include work completed in second session. Page ??

xiv

Page 15: thesis

Chapter 1

Introduction

1.1 Introduction and BackgroundThis report details the work which was completed as part of a thesis focused on

the design and control of an electromechanical braking system for use in an electric

vehicle (EV). This work involved the design of an innovative actuator system, a brake

calliper, and a test bed and control system. The report also covers the engineering,

design and construction issues encountered.

Control-by-wire has been an area of research for many years. It is now used in

applications from the basic cruise control throttle-by-wire system available on many

cars, through to, for example, a state of the art military drone that is entirely elec-

tronically controlled with the pilot flying remotely. With modern electric vehicles

becoming more advanced, control-by-wire has become of greater interest to manufac-

turers because of its many benefits. Having control-by-wire vehicle control systems

between the driver and the mechanical vehicle control o↵ers advantages in both the

e�ciency and the safety of modern vehicles.

While some control-by-wire systems such as steer-by-wire, or throttle-by-wire, have

been widely produced and installed in passenger vehicles, one area of control-by-wire

where there is a significant gap is brake-by-wire systems. Brake-by-wire has been

used for heavy commercial vehicles such as trucks for many years, but systems for

passenger vehicles are still under development with significant scope for improve-

ment. Most passenger vehicles still use hydraulic braking systems because of the

low cost, and reliability as a well proven system. They also provide a distinctive and

comfortable feel to braking.This latter point introduces a key di�culty in having a

control system such as anti-lock braking (ABS) which improves safety. Most people

would now be familiar, but not always comfortable with the pulsing feeling of the

brake pedal and car as the ABS controller system attempts to improve the drivers

braking input to reduce risk of losing control of the vehicle. An electromechanical

brake with an electronic controller between the calliper and brake pedal may provide

1

Page 16: thesis

Chapter 1. Introduction 2

the feel of the traditional hydraulic braking system, whilst maintaining the safety of

ABS. This can remove pulsing, and provide a more traditional feel whilst allowing

maximum braking in any situation without the brakes locking.

An electromechanical brake is a brake system controlled by an electrical signal caus-

ing a mechanical actuator to apply force to the brake pads for braking. As part

of this project, and to demonstrate the outcomes noted above, an electromechani-

cal brake brake-by-wire system was designed for use on the Zuma Scorpion vehicle

shown in Figure 1.1.

Figure 1.1: Photo of the Zuma Scorpion 300 vechicle.

1.2 Aims and ObjectivesThe aim of this thesis is to develop an electromechanical brake for use on the Zuma

Scorpion vehicle which is being converted to an electric drive. As part of the thesis

an electromechanical brake calliper will be designed and built. Using a disk brake

test bed, the brake system will be implemented and a control algorithm programmed

using MATLAB Simulink. The entire test bed will be controllable through Simulink

in real time using an Arduino Due as the interface.

Tasks that will be required to develop this brake calliper include:

• Develop a high force linear actuator to apply force to the brake pads.

• Design a brake calliper that will fit the original mounting on the vehicle.

Page 17: thesis

Chapter 1. Introduction 3

• Manufacture the brake calliper and actuator.

• Simulate and develop control algorithms for the electromechanical brake.

• Develop a system to control the brake and motor using Simulink.

• Testing of the control algorithms using the electromechanical brake and disk

brake test bed.

While the precise control of the brake calliper under various braking conditions is

an important area for research, this thesis is instead focused on the development of

the mechanical aspect of the electromechanical brake as well as the control of the

test bed. These are base requirements upon which to build further research.

1.3 Report StructureThe report is separated into four key sections each describing part of the project.

Chapter 2 is a literature review of the current state of the art in relation to brake-

by-wire and electromechanical brake systems. It then outlines the control-by-wire,

regenerative braking, electromechanical brakes, and the ball ramp actuators that

will be used within the final brake calliper system and test bed setups for brake

systems.

Chapters 3 and 4 cover the design work completed in the various mechanical and

electrical aspects of the project. Included in this is designs for the electrical interface

and control systems. The mechanical design of the ball ramp actuator is described

in this chapter along with 3D models and photos of the actual parts manufactured.

The test bed setup and all Simulink models used for testing are described in Chap-

ter 6. A system for simulating the inertia of a vehicle on the test bed is also shown

here.

The concluding chapter gives a summary of all the work completed and also com-

pares the outcomes of the project with initial aims. Potential areas for future work

and research are given.

1.4 ContributionsThe main contributions of this thesis are the design of the ball ramp actuator used

as part of the electromechanical brake, and the development of the test bed. The

Page 18: thesis

Chapter 1. Introduction 4

literature reviewed did not show anyone previously using a ball ramp actuator for

the purpose of an electromechanical brake.

As part of the test bed development, various Simulink driver blocks were written

to allow use of the internal quadrature decoder and digital to analog functions of

the Arduino Dues processor. A third Simulink driver block was also written for

variable frequency waveform generation which was used to run a stepper motor at

pulse signal. No Simulink blocks for these functions were previously available.

A inertia simulation system for the test bed was developed to enable testing of brake

systems without needing a large flywheel on the testbed.

Page 19: thesis

Chapter 2

Literature Review

2.1 IntroductionThis is a review of the literature relevant to the current state of brake by wire systems

and electromechanical disk brakes. It outlines the current electromechanical brake

designs as well as the controller research that has been completed already.

2.2 Electromechanical Brakes

2.2.1 Regenerative Braking

Regenerative braking for EV’s is an important technology that can improve vehicle

fuel or energy e�ciency by up to 20 - 50 % [1]. For e�cient energy recovery and

control of a regenerative braking system, an electronically controlled or an electrome-

chanical brake is a highly important component as it allows direct, wheel specific

braking control by the computer controller [1].

The choice of control strategy for distribution of brake force between the regenerative

system and the mechanical disk brake can also have a massive impact on the energy

recovered. Xu et al. [2] developed an intelligent fuzzy logic based regenerative

braking controller strategy that improved driving range by as much as 25% in an

EV. This was achieved by distributing the braking force between the front and

rear wheels based on membership functions in the controller using braking force

command, vehicle speed, and the batteries current state of charge.

2.2.2 Control-By-Wire

Control-by-wire has been in use for many years in the aircraft industry with fly-

by-wire for autopilot systems and computer control. Control-by-wire of any critical

system, such as an aircraft [3] or vehicle brakes must be fault tolerant and have re-

dundant control. Control by wire for passenger vehicles has been an area of research

since the entry of computerisation into the automobile industry. Areas that have

been researched include throttle-by-wire for intelligent cruise control [4], steer-by-

wire for stability control [5] and brake-by-wire which allows intelligent braking for

5

Page 20: thesis

Chapter 2. Literature Review 6

stability and traction control as well as regenerative braking function.

2.2.3 Electromechanical Brakes

Electromechanical brakes can play a central role in improving the safety, feel, and

e↵ective robustness of a brake-by-wire system. As noted, the design and implemen-

tation of an electromechanical brake introduces a number of challenges. Farris and

Goldfarb proposed a multi disk electromechanical brake actuated by a ball screw.

Line et. al. showed the modelling of an electromechanical brake for the control

system[6]. An electromechanical smart brake calliper developed by PBR was used

at Melbourne University for research into its control. Saric et. al. published a

number of papers relating to this brake system which was also based on a ball screw

actuator [7, 8]. These papers focused on various aspects of the electromechanical

brakes control system such as clamp force estimation and braking control algorithms.

2.2.4 Ball Ramp Actuators

Ball ramp actuators are a type of linear actuator that can provide a high and stable

linear force[9]. As two plates having a ramp profile rotate relative to each other, they

generate perpendicular force which can be used to actuate brakes. These actuators

can also be much lower profile than comparable actuators such as ball screws [9].

Although there are a number of patents for various ball ramp designs, there is no

current literature regarding their application in an electromechanical brake system.

Ball ramps have been used in a number of clutch mechanisms for vehicle di↵erential

locks and other electrically controlled clutches where space constraints make them

ideal. Takahashi et al. [10] and Usui et al. [9] both designed electromechanical disk

brake systems based on a ball ramp actuator with a planetary gear reduction and

motor behind them in the calliper. Another advantage of a ball ramp compared to

a ball screw is the much lower cost as precision ball screws are relatively costly [10].

A low inertia ball ramp was suggested by Organek et al. [11] which eliminated the

need for a thrust bearing and also allowed a control plate with much lower moment

of rotational inertia. The ramp design is shown in Figure 2.1 where the middle plate

is rotated as the control input.

Page 21: thesis

Chapter 2. Literature Review 7

Figure 2.1: A low inertia ball ramp design as shown by Organek et al. [11].

2.2.5 Brake Clamping Force

The brake clamping force being generated by the calliper is the critical output

of the system and hence measurement of this force is important. However due

to heat generated by the brake and subsequent cost of sensors, it is undesirable

and di�cult to have a force sensor within the calliper [7, 8]. Consequently other

methods to estimate the braking force must be developed to ensure an e↵ective

control algorithm. Methods of brake force estimation based on motor current and

motor position have been investigated [7, 8].

Figure 2.2: Motor angle characteristic curves for di↵erent brake pad thickness [8].

Saric et al. used a sensor-fusion approach which combined the two methods to im-

prove the estimation of the current clamping force [8]. Chihoon Jo et al. studied the

e↵ects of friction within the brake actuator on the brake force output and developed

a method of estimating the gap between the brake pads and disk. [12]. Research

Page 22: thesis

Chapter 2. Literature Review 8

was also conducted into the e↵ect of temperature on the relationship between motor

angle and clamping force by Saric et al. [7]. Hoseinnezhad et al. developed a method

of calibrating a calliper automatically on start-up to get the characteristic curve and

then achieved a brake force controller with an error margin of less than 0.7% up to

40kn [13]. However, because of variance in the friction within the calliper drive, due

to wear and age factors, the relationship between motor torque and clamp force is

subject to variation. In figure 2.3 the relationship of brake clamping force to motor

torque is shown for callipers of various ages.

Figure 2.3: Clamp force vs. motor torque for di↵erent callipers [8].

2.2.6 Brake Controllers

The control of the brake force applied to the pads is of vital importance. Because the

brake force is applied through the motor a controller is required to quickly apply this

force and accurately maintain it at a required level. ABS braking systems require

high speed response of the braking control [8]. Such braking controllers have been

developed based on a number of di↵erent strategies including PID, fuzzy logic, and

robust control [2, 12, 14]. To achieve a high motor speed and quick response when a

high braking force is requested, Chihoon Jo et al. used an adaptive PID controller

where the proportional gain was changed with the clamping force input [12]. In

Figure 2.4 the response to an input from an adaptive PID controller is shown.

Another factor that must be regulated and ideally monitored by the brake controller,

Page 23: thesis

Chapter 2. Literature Review 9

Figure 2.4: Clamping force and gap distance control by Jo et al. [12].

is the gap distance between the brake disk and pads. In a conventional hydraulic sys-

tem the brake pads are not forced to move away from the brake disk or drum which

can cause energy losses if they are slightly touching. By controlling and maintaining

to the absolute minimum brake pad to disk distance a rapid, optimised response can

be achieved whilst eliminating latent energy loss by residual disc contact . Because

this disc to pad gap will change as the pads wear down, Jo et al. proposed a method

of calibrating this gap within the callipers controller at start-up by moving the pads

in slowly until contact with the disk is detected by an increase in required motor

current [12].

2.3 Braking Test BedVarious test bed layouts can be used for testing braking systems. The most basic

of these is a motor simply attached to a disk brake. Other test bed designs can

allow testing of wheel slip and ABS braking controllers. The INTECO ABS An-

tilock Braking System [15] test bed uses a wheel with the brake and another wheel

connected to the motor to allow measurement of slip di↵erential between them for

testing of ABS braking. Wei Xu et. al. used a complete drive train test bed which

would allow testing on a full size system and also had a flywheel setup for testing

slip [16]. This setup, the Powertrain test bed at UTS is shown in Figure 2.5.

The electromechanical brake system used by Swinburne University of Technology

was tested on a test bed driving it directly from a powerful motor [7]. The setup for

this test bed, shown in Figure 2.6, was controlled using Simulink and the simulations

Page 24: thesis

Chapter 2. Literature Review 10

Figure 2.5: The Powertrain test bed at UTS [16]

were run on a second computer using xPC. External torque sensors, shown as 8 and

11 on Figure 2.6, connected to both the electromechanical brake actuators motor

and the drive motor were used to collect results.

Figure 2.6: Test bed used at Swinburn University for the EMB system[7]

2.4 ConclusionThe literature reveals research endeavours covering many areas of an electrome-

chanical brake system for brake-by-wire. Di↵erent control strategies and methods

for estimating the brake clamping force have been investigated. Although patents

Page 25: thesis

Chapter 2. Literature Review 11

exist regarding various ball ramps, there is no literature representing their applica-

tion in an electromechanical brake system.

The literature reviewed also covered various test bed layouts that have been used

for testing vehicle braking systems.

Page 26: thesis

Chapter 3

Mechanical Design

3.1 IntroductionIt is anticipated that the mechanical design of the electromechanical brake calliper

will make an important functional contribution when implemented on the Zuma

vehicle. This chapter describes how the electromechanical brake was designed and

why the particular approach has been chosen. The core design component of this

electromechanical brake system is the ball-ramp actuator which is described here in

detail. A exploded rendering of the actuator is shown in Figure 3.1

Figure 3.1: Exploded rendering of the ball ramp actuator showing all the parts.

3.2 Calliper DesignThe calliper for this brake system will be designed based on the original calliper

currently on the vehicle. A photo of this calliper is shown in Figure 3.2. It will be

designed as a bolt on replacement without any modification to the current mounts

in place. Through testing the current hydraulic brakes on the vehicle a value for

the maximum clamping force was determined as 5kN. This was based on the brake

pedal being pushed with full force, such as in an emergency situation.

The calliper will be machined as a solid piece from aluminum for an optimum com-

bination of weight and strength.

Due to the delays in manufacturing of the actuator, the brake calliper was not

12

Page 27: thesis

Chapter 3. Mechanical Design 13

Figure 3.2: The original brake caliper from the vehicle.

manufactured, but this was not critical to the outcomes as testing to this stage

would only be conducted on the test bed and not on the actual vehicle.

3.3 Ball Ramp ActuatorA low inertia dual ball ramp ball ramp actuator will be used to apply compressive

force on the brake pads on the modified EV. The ball ramp creates lateral force

perpendicular to rotation and provides a large mechanical advantage through the

use of low pitch slope and action similar to a thrust bearing. This allows e�cient,

low inertia rotation under high load. Because of size constraints on the EV the low

profile design potential of such an actuator o↵ers great advantage. The ball ramp is

also significantly lower cost than ball screws whilst achieving a similar result.

3.3.1 Design Process

Initially a single plate ball ramp actuator was proposed, but due to the added

thickness required for a single plate to retain rigidity, and the subsequent weight

and inertia considerations, a dual ramp, low inertia design was chosen. Such a

dual ramp system, where the forces on the central control plate will cancel out by

transfer through the opposing side ramps, allows that plate to be much thinner.

This significantly reduces the moment of inertia within the actuator. Having the

lower moment of inertia within the actuator is important for more responsive control.

Page 28: thesis

Chapter 3. Mechanical Design 14

Models of the di↵erent designs were 3D printed during design development.

Figure 3.3 is a model of the single ball ramp which was first printed.

Figure 3.3: First ball ramp actuator that was 3D printed.

The final design for the ball ramp actuator was to have a total thickness of only

25mm assembled and an outside diameter of 66mm. The design was changed for

manufacturing to have a 50mm back plate added which housed a single large spring.

While this design would not be used for the vehicle, the spring was available from

the workshop and the extra size would not matter when used on the test bed. The

final control plate has 8 splines and also supports the spring which will apply a

compressive force to stop the balls moving out of place. Below are drawings from

cad models of the actuator. Figure 3.4 shows the actuator at no extension and

figure 3.5 at part extension. Physical and software barriers will be implemented in

the controller to stop the actuators control plate from beyond its limits.

Although various patents exist describing ball ramp actuators, there is no literature

regarding their use in situations where fast control response is required, or within

an electromechanical brake. This was one unknown with the ball ramp as the

inertia of the balls may allow them to move out of position under very rapid motor

acceleration.

During the design process 3D models were printed to get an idea of how the entire

actuator would fit together before having it machined from steel.

Because the ball ramps control plate will move linearly as it rotates during actuation,

Page 29: thesis

Chapter 3. Mechanical Design 15

n66666666

n55550000

1111 88 88.. .. 66 66

11 11

11 11 66 66.. .. 33 33

Figure 3.4: Drawing of ball ramp actuator unactuated.

n66666666

n55550000

1111 88 88.. .. 66 66

11 11

11 11 66 66.. .. 33 33

Figure 3.5: Drawing of the ball ramp actuator.

Figure 3.6: 3D printed prototype of the ball ramp actuator.

a sliding hex bushing is used to attach it to the shaft of the motor.

Page 30: thesis

Chapter 3. Mechanical Design 16

3.3.2 Final Design

The final design was modelled using AutoDesk Inventor and given to the workshop

for manufacture. A number of design changes were made to this prototype actuator

to simplify manufacturing, and to make use of available materials. For example,

stock mild steel was used. These changes were considered to be of no negative e↵ect

on the outcomes as this prototype actuator would only be used on the test bed

where it will operate under lower loads and also required a shorter life.

For tolerances between all the sliding parts such as the spline a gap of 0.03 mm

was used at the recommendation of workshop sta↵. This was to allow enough space

for inaccuracies in manufacturing and also in an attempt to avoid binding between

parts.

Complete drawings of all parts for the final design are given in Appendix C

3.3.3 Manufacturing

Manufacturing of the ball ramp unit required all the parts to be cut using CNC

machines. Because of this requirement, all parts were submitted to the University

Workshop for manufacture. Due to limitations with tools and machines in the Uni-

versity Workshop, and after discussion with the Workshop Sta↵, the initial design

was modified to work within current limitations. Some of these modifications in-

cluded changing the size of the outside spline, and also swapping to a single spring

to apply compression on the actuator. While this new design would not be ideal for

a production brake system due to the larger size, there was no disadvantage as a

prototype system on the test bed.

It was also found that ball ramps were more di�cult to machine than initially

anticipated. The workshop had di�culty programming the CNC mills to perform

this task and even destroyed two milling cutters in the process. Shown in Figure 3.11,

a perspex piece was used to test the programming of the CNC mill before the parts

were cut in steel. This was mostly because to check the programming of the ball

ramps.

This extra work in set up and programming, along with the long wait times for

commencement of manufacturing, meant that the actuator was not complete in

Page 31: thesis

Chapter 3. Mechanical Design 17

SECTION A-ASCALE 1 : 1

A A

Actuator Plate

5mm Ball Bearings

Control Plate

Control Motor

Base Plate

Spring Support Case

4mm Coil Spring

Figure 3.7: 2D cross section of the assembled actuator

time for the final testing in this report. However, machining of all the main parts

has now been completed.

3.4 Finished ActuatorMost of the parts for the ball ramp actuator have been machined and are ready for

assembly of the completed actuator. Photos of the parts which have been made are

shown in Figure 3.12 through to Figure 3.15. While these parts have been machined

and are close to completion, the spring mounting for the front of the actuator is

still being manufactured and the parts are yet to be fitted together as the 0.03 mm

tolerances were not large enough for a smooth sliding fit in the spline.

Page 32: thesis

Chapter 3. Mechanical Design 18

SECTION A-ASCALE 1 : 1

A A

Actuator Plate

5mm Ball Bearings

Control Plate

Control Motor

Base Plate

Spring Support Case

4mm Coil Spring

Figure 3.8: Top view of the ball ramp actuator showing spine ararangment andball ramps

Figure 3.9: Ball ramp actuator with ramps shown at full extention.

3.5 Motor and GearboxThe motor used to drive the ball ramp actuator was a NEMA17 Stepper Motor,

shown in Figure 3.16. This motor was lower torque than what was originally planned.

In spite of this, the motor was able to supply 1.8 N.m of torque at full current which

Page 33: thesis

Chapter 3. Mechanical Design 19

Figure 3.10: A part being manufactured in the CNC mill by the workshop.

would provide enough torque to the output side of the gearbox. The smaller stepper

motor was chosen due to budget limits, and the high cost of large servo motors and

drives.

The motor was attached to a 1:5.18 planetary gearbox, shown in Figure 3.17. This

higher ratio gearbox was used to increase the output torque at the cost of speed.

However, the output speed was still expected to be fast enough for good braking

response as full actuation of the ball ramp only requires half a turn.

Page 34: thesis

Chapter 3. Mechanical Design 20

Figure 3.11: A piece of perspex was used to test the programing of the CNC mill.

Figure 3.12: The finished actuator plate with the spring.

Page 35: thesis

Chapter 3. Mechanical Design 21

Figure 3.13: Ball ramp actuator control plate fitted inside the outside case withspline.

Figure 3.14: Control plate with ramps cut and ball bearings sitting in place.

Page 36: thesis

Chapter 3. Mechanical Design 22

Figure 3.15: Base plate of the ball ramp actuator.

3.6 Issues and Areas for ImprovementAlthough the ball ramp actuator has not been tested yet a number of issues have

already been encountered. The manufacturing di�culties were an initial issue al-

though they were mostly resolved through design changes.

A hex fitting was used for the sliding coupling to the motor shaft instead of a spline,

also due to parts available and manufacturing di�culties. In future testing, a good

quality brass spline and coupling would allow smoother movement of the control

plate as the motor turns.

One final issue that it is anticipated may be encountered when the actuator is tested

is binding between the final actuation plate and the case in the spline. If this were

to eventuate, it could potentially be overcome by having larger tolerances in the

spline.

3.7 ConclusionAn electromechanical disk brake has been designed. The drawings for all parts of

the ball ramp actuator can be found in Appendix C

Page 37: thesis

Chapter 3. Mechanical Design 23

Figure 3.16: The stepper motor with gearbox attached.

Figure 3.17: Photo of the gearset with the planetary gearbox mounted to themotor.

Page 38: thesis

Chapter 3. Mechanical Design 24

Although manufacturing was not completed within the time required for the project,

the main parts were machined and the actuator will be complete in the coming

weeks. Su�cient progress was achieved to establish base testing and workability of

the concepts, and to foresee areas where further issues may arise along with ways

to alleviate them.

Page 39: thesis

Chapter 4

Electrical Design

4.1 IntroductionThe development of the electrical side of the test bed and brake controller system

were an important part of the project which took significant time to complete. All

of the systems were interfaced to Simulink running on a PC using an Arduino Due.

This chapter describes how the electrical systems were set up. It also documents

the Simulink driver blocks which were created for interfacing with the Arduino Due.

4.2 Stepper Motor ControllerAn o↵ the shelf stepper motor controller was used for the actuator of the elec-

tromechanical brake system. This simplified the control of the stepper motor as it

enabled it to be controlled with only pulse and direction signals rather than having

to manually drive the stepper motor from the Arduino.

The stepper motor controller used was a DM542 Microstep Driver. This driver

handled microstepping of the stepper motor eliminating the need to do it on the

Arduino.

4.3 FeedbackAll feedback for both the test bed servo motor and brake controller was read from

the servo drives encoder. Initially it was planned that position, and current feedback

would be used for the brake actuators control loop, but cost constraints changed this

and a geared stepper motor was used.

The servo drive on the test bed gave quadrature encoder output of position. Within

the Simulink models, this position signal was passed through di↵erentiation blocks

to retrieve both the velocity and acceleration of the drive.

Because of noise in this position signal a number of low pass filters had to be applied

for both the velocity and position signals in order to produce smooth and usable

results.

25

Page 40: thesis

Chapter 4. Electrical Design 26

4.4 Arduino DueAn Arduino Due was utilised to incorporate all control systems for testing. The Due

was connected to a computer to run the Simulink simulations in external mode to

enable the collection of results.

Figure 4.1: The Arduino Due and support circuits being tested on a prototypingbreadboard.

The Arduino Due is powered by an Atmel SAM3X8E ARM Cortex-M3 CPU which

runs at 84MHz. The Due was chosen because it o↵ered the advantages of high

clock speed, the internal hardware Quadrature Decoder, and 12-bit DAC output

pins which were essential for control of the servo motor on the test bed.

The Simulink package for Arduino was installed, but this only allowed PWM or

digital I/O pin control. To allow the Quadrature Decoder and 12-bit DAC to be

used, custom Simulink Driver Blocks had to be written for the Arduino Due. Some

extra hardware was also required for outputs and to interface with the 3.3V logic of

the Atmel SAM3X8E.

Page 41: thesis

Chapter 4. Electrical Design 27

Figure 4.2: All support hardware for the Arduino Due on a sheild which wascreated.

4.4.1 Quadrature Decoder

Support Hardware

Interfacing the Arduino Due to the Kollmorgan ServoStar 600 drive was a greater

challenge than initially expected. This di�culty was caused by the di↵erence in

operating voltages between the two systems. While the Arduino Due has a processor

which only operates with logic 3.3V, the quadrature decoder output of the servo drive

runs from 0V to 10V. The issue was resolved by use of an LM393 dual di↵erential

comparator.

In Figure 4.3 the circuit diagram is shown for this interface circuit. Phase A and

B on the input are connected to the quadrature decoder inputs of the servo drive.

The outputs of the comparator are connected to arduino pins 2 and 13 which are

linked to the hardware quadrature decoder of the Atmel SAM3X8E CPU.

Simulink Driver

There were no available Simulink blocks to make use of the hardware quadrature

decoder on the Arduino Dues Atmel SAM3X8E. To overcome this issue, an Simulink

Driver block was written to perform this function.

The Simulink driver block for the Quadrature Decoder of the Arduino was created

Page 42: thesis

Chapter 4. Electrical Design 28

+

Phase B

+

Phase A

GND

3.3V

(Pin 2)

(Pin 13)

33 k⌦ 33 k⌦

33 k⌦

33 k⌦

Figure 4.3: Comparator Circuit for Quadrature Decoder

Figure 4.4: Comparator circuit for the quadrature decoder shown highlighted onthe Arduino sheild. Circuit diagram shown in Figure 4.3.

using the S-Function Builder, this block is shown in Figure 4.5. The driver block

used the Arduino library and set up the registers within the SAM3X8E to enable

the Quadrature Decoder which is on Timer Counter 0. The decoder is connected to

Arduino pins 2 and 13 which are for decoder Phase A and Phase B respectively.

Page 43: thesis

Chapter 4. Electrical Design 29

Figure 4.5: The created Quadrature Decoder driver block connected to a scope.

In Figure 4.6, the Discrete Update window of the S-Function Builder for the quadra-

ture decoder driver is shown. This is where the bulk of the code was written to enable

and start the Decoder in the SAM3X8E. This code is executed once and then the

position output updated at each time step from the register REG TC0 CV0.

Figure 4.6: Screenshot of the Quadrature Decoder driver block being createdusing S-Function Builder. Full code listed in Appendix D.1

The C source code used to enable the Quadrature Decoder is shown. This code

enables the peripheral function of the decoder on Pins 2 and 13. The Quadrature

Decoder is then enabled in position measure mode with no filtering. Finally, the

Page 44: thesis

Chapter 4. Electrical Design 30

timer counter is started and reset to begin measurement.

const i n t quad A = 2 ; // Quadrature Decoder A input

const i n t quad B = 13 ; // Quadrature Decoder B input

//Create bitmasks f o r enab l ing the d i g i t a l p ins with in r e g i s t e r s

const unsigned i n t mask quad A = digita lPinToBitMask ( quad A ) ;

const unsigned i n t mask quad B = digita lPinToBitMask ( quad B ) ;

REG PIOB PDR = mask quad A ; // a c t i v a t e p e r i ph e r a l f unc t i on (

d i s a b l e s a l l PIO f u n c t i o n a l i t y )

REG PIOB ABSR |= mask quad A ; // choose p e r i ph e r a l opt ion B

REG PIOB PDR = mask quad B ; // a c t i v a t e p e r i ph e r a l f unc t i on (

d i s a b l e s a l l PIO f u n c t i o n a l i t y )

REG PIOB ABSR |= mask quad B ; // choose p e r i ph e r a l opt ion B

// a c t i v a t e c l o ck f o r TC0

REG PMC PCER0 = (1<<27) ;

// s e l e c t XC0 as c l o ck source and s e t capture mode

REG TC0 CMR0 = 5 ;

// a c t i v a t e quadrature encoder and po s i t i o n measure mode , no f i l t e r s

REG TC0 BMR = (1<<9) |(1<<8) |(1<<12) ;

// enable the c l o ck (CLKEN=1) and r e s e t the counter (SWTRG=1)

// SWTRG = 1 nece s sa ry to s t a r t the c l o ck ! !

REG TC0 CCR0 = 5 ;

The full source code which was used to implement the Quadrature Decoder Driver

can be found in Appendix D.1

4.4.2 12-bit Digital to Analog Output

The default Simulink driver blocks for analog output on the Arduino Due only

support an 8 bit PWM signal. This was far short of what was desired for control of

the servo drive and so a custom Simulink driver had to be created. The new driver

block was used to make full use of the 12-bit DAC.

As the analogWrite function of Arduino enabled the 12-bit DAC output, it was

possible to use this function to do all initial setup of registers for the DAC. The

analogWrite function could have been used to also update values on the DAC al-

though there is a large amount of overhead in calling analogWrite. To avoid all

Page 45: thesis

Chapter 4. Electrical Design 31

the extra overhead of analogWrite, DAC output values are written to the channels

directly as shown in the following code.

// S e l e c t the DAC i n t e r f a c e which w i l l be wr i t t en to

d a c c s e t c h a nn e l s e l e c t i o n (DACC INTERFACE, 1) ;

// Write the 12�b i t DAC output value to the DAC i n t e r f a c e

da c c wr i t e c onve r s i on da ta (DACC INTERFACE, value [ 0 ] ) ;

The full source code for the 12-bit DAC driver block is listed in Appendix D.2

4.4.3 Variable Frequency Waveform Generator

To allow driving of the stepper motor at a fixed speed a pulse train signal is required

into the stepper motor driver. Because of the frequency of pulses required to drive

the stepper motor at a high speed, it was not desirable to generate this signal using

software. Instead the PWM generator on Pin 5 was used. This PWM generator is

run from Timer Counter 2, Chanel 0 of the SAM3X8E.

The timer is set up in waveform generation mode counting from 0 to a value called

RC. The initial setup of this timer was handled with the analogWrite function of

Arduino as it was much simpler. The register values are then changed manually to

give the desired output. At a value of RA, the output pin is set high. When the

counter reaches RC the output is cleared and the counter reset. The value for the

period RC for a frequency is shown in Equation 4.1

RC =ClockFrequency/2

Frequency

(4.1)

By setting RA always to half of RC, the duty cycle will be 50

RA =RC

2(4.2)

The C source code used write these values to the registers and check RC is

REG TC2 RC0 = VARIANTMCK / 2 / f requency [ 0 ] ;

// Reg i s t e r RA i s s e t to h a l f o f RC f o r a 50% duty cy c l e

REG TC2 RA0 = REG TC2 RC0 / 2 ;

Page 46: thesis

Chapter 4. Electrical Design 32

//Reset the counter , i t s a l r eady past RC, t h i s i s to avoid the counter

be ing past RC in some i n s t an c e s when RC i s changed to a lower va lue

.

i f (REG TC2 CV0 > REG TC2 RC0) {

REG TC2 CCR0 = 5 ;

}

One issue countered with just changing the values of RC is if the value of RC is

decreased to a value lower than the current timer counter value. If this happens,

the timer counter will not match RC causing the timer to reset until an overflow has

occured which would take close to 1 minute. This is undesirable as the waveform

output stays high for that time. To avoid this issue, the value of the current timer

would be compared to RC after every update where RC was changed.

The source code to this waveform generator driver block is in Appendix D.3

4.5 Op-Amp Output Level ShiftingThe motor input on the ServoStar 600 drive takes a +10V to -10V signal. The

gain for this input in relation to torque supplied in amps is set up during drive

configuration.

LM741

+

+9 V

�9VGND

Motor +

GND

Motor -

100 k⌦DAC1

33 k⌦

33 k⌦50 k⌦

100 k⌦

Figure 4.7: Op-Amp Output to Motor Drive

Page 47: thesis

Chapter 4. Electrical Design 33

Figure 4.8: The op-amp level shifting amplifier shown on the Arduino sheild.

The 12-bit DAC output of the Arduino Due operates between 0.5V and 2.8V. To

make this output signal compatible with the servo drive the output is passed through

a summing amplifier circuit. This circuit is based around an LM741 op-amp in a

summing amplifier configuration. The input is set up with a gain of 3 to boost the

signal voltage. The signal is summed with -5.4V to shift the signal level down. Such

an op amp configuration gives a output operating from 3V to -3.9V. The relationship

between the DAC1 input and Motor+ output is listed in Equation 4.3

Motor+ = DAC1⇥ 100⌦

33⌦� 9V ⇥ 50⌦

50⌦+ 33⌦

= DAC1⇥ 3� 5.4V

(4.3)

This configuration was chosen based on resistors that were available at the time.

Although the output was not exactly balanced around 0V, this was overcome by

applying a bias to the output within the Simulink models. A gain was also applied

within the Simulink models to calibrate the output voltage to be the same as input

to the system.

The positive and negative supply rails to the op-amp are powered by 9V batteries.

9V batteries were chosen for power here over a bench top power supply as it allowed

a simpler setup and a bench top power supply with both positive and negative

supplies was not always available for use.

Page 48: thesis

Chapter 4. Electrical Design 34

4.6 Servo Drive EnablingOne issue encountered with the servo drive was that while downloading Simulink

models to the Arduino Due, the outputs would change to di↵erent levels. This

change would cause the servo motor to rapidly speed up, often causing an over-speed

fault. To overcome this issue and enable models to be downloaded to the Arduino

Due and run smoothly, a circuit was developed to enable the servo drive only when

required during model simulation runs and have it disabled during downloading

models.

The enable pin of the ServoStar 600 drive runs on 24V. To allow this pin to be

switched using an arduino, a small reed switch was used and powered by an 2N3904

bipolar junction transistor. The transistor driver circuit and relay are shown in

Figure 4.9.

SN74002N3904470⌦

5V

GND

1N4004 Servo Drive Enable

EN (Pin 53)

EN (Pin 52)

Figure 4.9: Servo Drive Enable

Because the output pins were neither high or low for the entire time of firmware

downloading, using a single pin to drive the enable circuit would cause it to randomly

turn on the servo motor at some point still. This issue was overcome by having a

logic circuit for the servo drive enable lines which required one input high and the

other input low. The logic equation is shown in Equation 4.4.

OUTPUT= EN + EN (4.4)

This meant that when both pins were either high or low during firmware download,

Page 49: thesis

Chapter 4. Electrical Design 35

the servo drive would not be enabled.

Figure 4.10: Servo drive enabling circuit shown on the Arduino shield.

The logic circuit was implemented with a SN7400 Quad NAND gate IC. This IC

was chosen as the NAND gates could be used to implement a NOT gate as well as

the AND meaning only one IC was needed for the logic circuit. This arrangement

of NAND gates is shown in the circuit diagram in Figure 4.9.

4.7 ConclusionThis chapter covers all the electrical design completed to run both the test bed and

electromechanical brake. Various circuits have been designed to interface the servo

drive to the Arduino Due. New Arduino Due driver blocks have been written for

Simulink to allow use of the Quadrature Decoder as well as the 12-bit DAC output.

A custom block was also written for a variable frequency waveform generation to

run the stepper motor.

Page 50: thesis

Chapter 5

Brake Controller

5.1 IntroductionThe braking force controller and electronics are an important part of the system.

This chapter describes the control methods which are to be tested and implemented

for simulations on the test bed of the electromechanical brake system.

5.2 Control MethodsThere are a number of possible control methods for the braking force applied by

the electromechanical brake calliper. For this project two of these methods will be

implemented and the the resulting control responses will be investigated. These two

methods will be PID control and also fuzzy logic. Di↵erent feedback methods for

control will also be tested. The two main feedback methods to be tested will be the

control plate rotation angle and motor current.

5.2.1 PID Control

A PID controller will be implemented for the electromechanical brake first because

of its simplicity. For tuning this controller, a mathematical model of the brake

system will be found to get the transfer function which will allow simulation of the

braking with this control method.

5.2.2 Fuzzy Logic Control

Because the system for the electromechanical brake may be di�cult to define math-

ematically, another method of control which may have better results is fuzzy logic.

The fuzzy logic control will be implemented using the fuzzy logic toolbox within

MATLAB and Simulink.

5.2.3 Control Plate Rotation Angle

One way of estimating the brake force applied is through the rotation angle of the

control plate, because of deformation within the balls and ramps as well as other

parts of the actuator, the rotation angle will be higher as the force is increased. for

this method the brake pad to disk gap distance must be known and so a method of

36

Page 51: thesis

Chapter 5. Brake Controller 37

detecting this distance must also be developed as the gap will change as brake pads

are worn down.

5.2.4 Motor Current

Because the motor current is directly related to the torque output, the motors

current is a good indication of the torque being applied to the actuator and therefore

the force output.

5.3 ImplementationBy having the servo motor for the electromechanical brake actuator connected to

Simulink in MATLAB, control strategies can be easily implemented and tested. A

control strategy based on combing the control plate rotation angle and motor current

will also be developed.

5.4 ConclusionIn this chapter, the methods which will be used for control of the electromechanical

brake have been outlined. Further work in this area of the project will be completed

once the brake and test bed have

Page 52: thesis

Chapter 6

Experimental Testing

6.1 IntroductionThe brake calliper was to be tested using a test bed consisting of a large servo motor

and a disk brake. By linking this motor and the electromechanical brake unit to

simulink, testing could be completed and the results sent back to MATLAB. The

brake calliper was to be tested using PID and fuzzy logic control but due to delays

in manufacturing of the actuator for this brake calliper, this was not possible. This

chapter covers the test bed and how it was controlled using Simulink and some

simulation models.

Figure 6.1: The test bed set up with connection to Simulink.

6.2 Project DelaysUnfortunately the brake actuator for the electromechanical brake was not manu-

factured in time for testing to be completed by the end of the project. Unforeseen

delays waiting for CNC machining on parts during manufacture led to the actuator

taking months longer than expected. As well as this, the workshop manufacturing

parts for the ball ramp actuator had di�culties with programming CNC machines

38

Page 53: thesis

Chapter 6. Experimental Testing 39

to cut the ball ramps. The ball ramps proved to be more complicated in shape and

programming demands than originally thought. Although the brake actuator itself

was not finished, the test bed was completed along with all models and basic results

of the inertia simulation were completed.

6.3 Test BedThe test bed will utilise one previously built for studying static friction. This test

bed will be modified to accommodate a brake disk from the Zuma Scorpion vehicle

and the electromechanical brake which is manufactured.

Figure 6.2: The test bed before modifications.

The original test bed had a small disk brake with a basic calliper which enabled

a fixed clamping force to be applied by use of a manually adjustable compression

spring. This disk brake is shown below in Figure 6.3. This was a very basic disk

brake which would operate at a fixed clamping force applied by the predetermined

manual setting of a compressed spring.

6.4 Servo MotorThe servo motor that will turn the disk brake on the test bed is a Kollmorgan DDR

(Direct Drive Rotary) servo motor, model D061M-22-1310. This motor runs from

a Kollmorgan ServoStar 600. A 415V, 3-phase motor drive which was interfaced to

Page 54: thesis

Chapter 6. Experimental Testing 40

Figure 6.3: Basic disk brake on the test bed.

Simulink. The motor also has a high resolution sine wave encoder with a 0.62 arc.sec

resolution or 2,097,152 counts per revolution. This high resolution encoder makes

it possible to collect accurate measurements of the motor velocity and acceleration

while testing the brake system. Although the extremely high resolution of the

encoder was available to the servo drive, only 65,536 counts were output from the

drive to simulink which proved more than adequate for the application.

Table 6.1 shows some of the characteristics of this motor.

Kollmorgan D061 Servo Motor

Peak Torque N-m 16.9

Continuous torque N-m 5.3

Max Speed rpm 500

Sine Encoder Resolution counts/rev 2,097,152

Rotor Inertia kg �m

2 0.0061

Table 6.1: Properties of the servo motor on the test bed.

6.5 Simulink ControlAll modeling and simulations for testing were completed using Simulink and MAT-

LAB. By using Simulink for control of the test bed and brake system, parameters

could be quickly changed while simulations or tests were being run. This allowed

Page 55: thesis

Chapter 6. Experimental Testing 41

rapid development of the system. The graphical models within Simulink also clearly

showed the processes occurring happening in di↵erent sections of the system.

Figure 6.4: The main model within Simulink for the control of the braking testbed.

The simulation was broken up into a number of key phases during any particular

test run. These phases were:

• Enable servo drive.

• Accelerate servo to 600 RPM set point with PID control.

• Begin braking after 2 seconds when the motor velocity has stabilized.

• Enable brake controller

• Braking controlled with fuzzy control or PID loop.

• Switch servo drive to inertia simulation.

• Servo comes to complete stop.

• Disable servo.

• Disable brake controller.

Page 56: thesis

Chapter 6. Experimental Testing 42

• End test run.

All Simulink models and subsystems are shown in Appendix D.

6.6 Inertia SimulationFor testing of the brake system either a flywheel had to be added or inertia of

a vehicle had to be simulated on the test bed servo. Rather than mounting a

flywheel of fixed mass to the test bed servo, a Simulink subsystem was developed

to simulate the e↵ect a flywheel would have. The deceleration of the motor without

this simulation is shown in Figure 6.6.

Figure 6.5: Simulink model of the inertia simulation subsystem. Input is currentacceleration and the inertia gain to be applied. Output is torque to motor

This was accomplished using a proportional control loop set for zero acceleration.

By having only proportional control, the system would apply a torque to resist any

change in acceleration similar to the inertia of a vehicle. The subsystem created,

shown in Figure 6.5, had a feedback loop passing the acceleration back into the

motor as a negative torque.

The gain for this proportional control loop is used to set the level of simulated

inertia. A higher gain applies more torque to resist any change in velocity much in

the way the inertia of a heavier vehicle would function.

The issue with this system was that at higher gains the system would become un-

stable when no external brake force was applied. This was due to noise in the signal

and the double di↵erentiation used to calculate acceleration. To overcome this in-

stability and oscillation in both velocity and acceleration low pass filters were used.

When there was no external braking force, inertia gain still had to be kept low to

avoid excessive oscillation as seen in Figure 6.7.

Page 57: thesis

Chapter 6. Experimental Testing 43

Time(s)0 0.5 1 1.5 2 2.5 3 3.5 4

Velo

city

(R

PM

)

0

100

200

300

400

500

600

700Brake Test Bed Results

Acc

ele

ratio

n (

RP

M/s

)

-3500

-3000

-2500

-2000

-1500

-1000

-500

0

Figure 6.6: The motor decelerating with no inertia simulation. The motor comesto a stop very fast due to the low inertia

Time(s)0 5 10 15 20

Velo

city

(R

PM

)

0

100

200

300

400

500

600

700Brake Test Bed Results

Acc

ele

ratio

n (

RP

M/s

)-100

-50

0

Figure 6.7: Test bed decelerating with inertia and no external braking force.

Tests were also completed using a fixed brake clamping force and varying the sim-

ulated momentum. Figure 6.8 shows the results for two simulations with the same

fixed brake clamping force. The second graph in the figure shows a much slower

deceleration due to the higher inertia simulated.

6.7 ConclusionThe test bed for testing disk brakes was utilized with some adaptations and an

inertia simulation created. The test bed was used to run tests on this simulation

using a fixed clamping force brake setup. The test bed was ready to have the elec-

tromechanical disk brake mounted for testing and tuning of the control algorithms.

Page 58: thesis

Chapter 6. Experimental Testing 44

Time(s)0 2 4 6 8 10

Velo

city

(R

PM

)

0

100

200

300

400

500

600

700Momentum Gain 0.015

-300

-200

-100

0

Time(s)0 2 4 6 8 10

0

100

200

300

400

500

600

700Momentum Gain 0.03

Acc

ele

ratio

n (

RP

M/s

)

-300

-200

-100

0

Figure 6.8: Comparison of the results using a fixed brake clamping force anddi↵erent inertia gains.

Unfortunately due to the delays in manufacturing of the ball ramp actuator, the

electromechanical disk brake is yet to be tested.

Page 59: thesis

Chapter 7

Conclusion

7.1 SummaryThe aim of this thesis was to develop an electromechanical brake actuator as well

as test it and develop control algorithms for the actuator. A complete design for

the electromechanical brake actuator was presented and a test bed for testing it was

developed.

Although there were delays in manufacturing the ball ramp actuator and it could not

be tested for this report, manufacturing will complete and testing will be performed

in the coming weeks.

7.2 Ball Ramp ActuatorThe ball ramp actuator for the electromechanical brake was fully designed and man-

ufacturing was almost completed at the time of this report. Unfortunately there

were longer delays than expected for manufacturing and so testing could not be

completed.

The ball ramp actuator is a di↵erent method of controlling an electromechanical

brake compared to what has been used in all the literature reviewed. In light of this

it is believed this testing of it will be valuable.

7.3 Test BedA test bed was set up based on a previous test bed which made use of a disk brake.

Various challenges were overcome to control this test bed using Simulink running

in external mode on an Arduino Due. Simulink driver blocks were also created to

allow use of the hardware Quadrature Decoder and 12-bit DAC. Finally, a Simulink

driver block was written for a variable frequency waveform generator.

7.4 Future DevelopmentIn the future a larger test bed could be designed to include a friction wheel against

a flywheel. This would be provide opportunity to investigate regenerative braking

and more advanced control algorithms such as for ABS braking. Having a wheel

45

Page 60: thesis

Chapter 7. Conclusion 46

running against the flywheel would also allow measurement of wheel slip and provide

mechanism for development of more advanced slip control systems.

Page 61: thesis

References[1] JK Ahn, KH Jung, DH Kim, HB Jin, HS Kim, and SH Hwang. Analysis of a regenerative

braking system for hybrid electric vehicles using an electro-mechanical brake. International

Journal of Automotive Technology, 10(2):229–234, 2009.

[2] Xu Guoqing, Li Weimin, and Xu Kun. An intelligent regenerative braking strategy for electric

vehicles. Energies (19961073), 4(9):1461 – 1477, 2011. ISSN 19961073.

[3] Pascal Traverse, Isabelle Lacaze, and Jean Souyris. Airbus fly-by-wire: A total approach to

dependability. In Building the Information Society, pages 191–212. Springer, 2004.

[4] Petros A Ioannou and Cheng-Chih Chien. Autonomous intelligent cruise control. Vehicular

Technology, IEEE Transactions on, 42(4):657–672, 1993.

[5] Paul Yih and J Christian Gerdes. Modification of vehicle handling characteristics via steer-

by-wire. Control Systems Technology, IEEE Transactions on, 13(6):965–976, 2005.

[6] Chris Line, Chris Manzie, and Malcolm C Good. Electromechanical brake modeling and

control: from pi to mpc. Control Systems Technology, IEEE Transactions on, 16(3):446–457,

2008.

[7] Stephen Saric, Alireza Bab-Hadiashar, and Johannes van der Walt. Estimating clamp force for

brake-by-wire systems: Thermal considerations. Mechatronics, 19(6):886 – 895, 2009. ISSN

0957-4158.

[8] S. Saric, A Bab-Hadiashar, and R. Hoseinnezhad. Clamp-force estimation for a brake-by-

wire system: A sensor-fusion approach. Vehicular Technology, IEEE Transactions on, 57(2):

778–786, March 2008. ISSN 0018-9545. doi: 10.1109/TVT.2007.905251.

[9] T. Usui and Y. Ohtani. Electric disc brake, December 10 2002. US Patent 6,491,140.

[10] K. Takahashi and K. Kawase. Electric braking device, August 28 2001. US Patent 6,279,691.

[11] Gregory J Organek and David M Preston. Low inertia ball ramp actuator, February 3 1998.

US Patent 5,713,446.

[12] Chihoon Jo, Sungho Hwang, and Hyunsoo Kim. Clamping-force control for electromechanical

brake. Vehicular Technology, IEEE Transactions on, 59(7):3205–3212, Sept 2010. ISSN 0018-

9545. doi: 10.1109/TVT.2010.2043696.

[13] R. Hoseinnezhad, A Bab-Hadiashar, and T. Rocco. Real-time clamp force measurement in

electromechanical brake calipers. Vehicular Technology, IEEE Transactions on, 57(2):770–

777, March 2008. ISSN 0018-9545. doi: 10.1109/TVT.2007.906374.

[14] Bin Wang, Xiaoyu Huang, Junmin Wang, Xuexun Guo, and Xiaoyuan Zhu. A robust wheel

slip control design for in-wheel-motor-driven electric vehicles with hydraulic and regenerative

braking systems. In American Control Conference (ACC), 2014, pages 3225–3230. IEEE,

2014.

[15] Inteco abs testing system. URL http://www.inteco.com.pl/products/

abs-antilock-braking-system/.

[16] Wei Xu, Gang Lei, Yongchang Zhang, Tianshi Wang, and Jianguo Zhu. Development of

47

Page 62: thesis

References 48

electrical drive system for the uts phev. In Energy Conversion Congress and Exposition

(ECCE), 2012 IEEE, pages 1886–1893, Sept 2012. doi: 10.1109/ECCE.2012.6342582.

Page 63: thesis

Appendix A

Project PlanSupervisor Dr. Haiping Du

Title Electromechanical Disk Brake for use in Electric Vehicle

A.1 Project OverviewControl-by-wire is a technology under constant development for modern cars to

make them more e�cient and safer. Development of an electromechanical brake is

important part of a complete control-by-wire system for an electric car. The design

and control of an electromechanical brake introduces a number of interesting issues

relating to its control and mechanical design.

This project will develop an electromechanical brake calliper and test various control

algorithms on the brake controller. The calliper design is based on a ball ramp

actuator run by an electric motor though a planetary gear. The design was developed

based on a ball ramp actuator. Ball ramps have often been used for clutches or

parking brakes but there is no current literature where a ball ramp has been used

for an electromechanical braking system. A low moment of inertia ball ramp is being

used to improve control response of the system.

A test bed is being developed using a large servo motor which will allow testing of

the electromechanical brake as well as testing the control algorithms on it. This

project will be significant research because of the lack of literature regarding ball

ramps especially within the context of the electromechanical brake.

A.2 Project DescriptionThis project will design an electromechanical brake system for a vehicle being used

for research at the university. The vehicle is a Zuma Scorpion 300 which is currently

being converted to an electric drive with independent in hub motors for each wheel.

To allow regenerative braking and independent braking of the wheels an electrome-

chanical brake system is required. The original project was going to develop the ball

ramp actuator brake system and complete all testing as well as implement it on the

vehicle. Because of the time constraints the project will now be more focused on

49

Page 64: thesis

Appendix A. Project Plan 50

manufacturing the brake caliper for the test bed and testing the algorithms to get

various results. Unfortunately with the time constraints involved with having parts

manufactured it would not be possible to test the brake and also get it installed

and running on the vehicle. The original project proposal and plan was also based

on a ball screw actuator design. During the research for ECTE451 the ball ramp

actuator was chosen instead based on the many benefits it had including lower cost

and also being lower in profile.

A.3 Project PlanIn Autumn session for ECTE458 the electromechanical brake designed in ECTE451

will be manufactured and tested. The mechanical design was the main focus previ-

ously and so now the project is moving into manufacturing and testing. The test

bed will also be tested and set up for control via MATLAB.

Initially time will be focused on ordering all required parts as well as having parts for

the ball ramp actuator manufactured by the workshop. This is of highest priority,

as any delays to manufacturing the actuator will delay the project.

While parts are being delivered the control algorithms for the braking system will

be modelled and simulated in MATLAB and Simulink. These control algorithms

will be optimised so they are ready to be implemented on the brake calliper as soon

as it is manufactured. During this time the servo motor for the test bed will also be

tested to ensure it works with Simulink to allow testing immediately.

After the full system is implemented on the test bed, the various algorithms for

braking control will be tested and the performance compared. This will be completed

by week 9 to allow su�cient time for writing of the final project report and editing

time.

Page 65: thesis

Appendix A. Project Plan 51

Milestone To be completed by

ECTE458 (Autumn 2015)

All parts ordered Week 3

Ball Ramp Actuator Parts Manufactured Week 5

Control Algorithms Written Week 5

Brake unit building completed Week 6

Begin Writing Final Report Week 8

Testing / improving of brake control algorithm Week 8

All testing completed and results ready Week 9

Final report draft Week 10

Finalising of final report Week 11

Final report due Week 12

A.4 Adaption of Supervisor and Examiners feed-

back in the ECTE451 reportAfter reading the comments from my supervisor and examiner as well as discussion

with my supervisors, I have cut down on the project plans to allow it to be finished

within the time period. To achieve this I have decided to focus on manufacturing

of the ball ramp actuator and a basic brake calliper for the test bed which I will

be using. I also learnt from discussions with my supervisor that my report writing

skills need improvement and that I should get others such as family to proof read

my report before submission. I will address this problem by finishing

Page 66: thesis

Appendix B

Logbook Signatures

52

Page 67: thesis

Appendix C

Hardware DocumentationBall Ramp Actuator Drawings

All Dimensions are in mm. Not to scale.

C.1 Control Plate

6.00

50.00

2.40

.40

R2.50

P50.0020.00

53

Page 68: thesis

Appendix C. Hardware Documentation 54

C.2 Assembled Ball Ramp Actuator

SECTION A-ASCALE 1 : 1

A A

Actuator Plate

5mm Ball Bearings

Control Plate

Control Motor

Base Plate

Spring Support Case

4mm Coil Spring

Page 69: thesis

Appendix C. Hardware Documentation 55

C.3 Actuator Plate

60.00

5.00

.40 2.40

5.00

24.00

R2.50

R2.50

P15.00P24.00

10.00

Page 70: thesis

Appendix C. Hardware Documentation 56

C.4 Base Plate

P66.00

P4.0020.00

29.00

.40

2.40

Page 71: thesis

Appendix C. Hardware Documentation 57

C.5 Case

R36.00

R25.02

7.00

P4.00

66.00

10.06

R2.50R2.50

32.03

21.00

Page 72: thesis

Appendix C. Hardware Documentation 58

C.6 Spring Mount

P24.03P34.00P66.00

29.00

P4.00

50.0042.00

24.03

Page 73: thesis

Appendix D

Software Documentation

D.1 Arduino Due Quadrature Decoder Simulink

Block

D.1.1 Libraries / Includes// Inc lude the Arduino l i b r a r y i f not compi l ing f o r matlab

# i f n d e f MATLAB MEX FILE

# inc lude <Arduino . h>

# end i f

D.1.2 Discrete Update Source Code// Only s e t up once i n i t i a l l y

i f (xD[ 0 ] !=1 ) {

// setup here

# i f n d e f MATLAB MEX FILE

// Only f o r the arduino hardware , t h i s i s n t compiled f o r matlab

const i n t quad A = 2 ; // Quadrature Decoder A input

const i n t quad B = 13 ; // Quadrature Decoder B input

//Create bitmasks f o r enab l ing the d i g i t a l p ins with in r e g i s t e r s

const unsigned i n t mask quad A = digita lPinToBitMask ( quad A ) ;

const unsigned i n t mask quad B = digita lPinToBitMask ( quad B ) ;

REG PIOB PDR = mask quad A ; // a c t i v a t e p e r i ph e r a l f unc t i on (

d i s a b l e s a l l PIO f u n c t i o n a l i t y )

REG PIOB ABSR |= mask quad A ; // choose p e r i ph e r a l opt ion B

REG PIOB PDR = mask quad B ; // a c t i v a t e p e r i ph e r a l f unc t i on (

d i s a b l e s a l l PIO f u n c t i o n a l i t y )

REG PIOB ABSR |= mask quad B ; // choose p e r i ph e r a l opt ion B

// a c t i v a t e c l o ck f o r TC0

REG PMC PCER0 = (1<<27) ;

// s e l e c t XC0 as c l o ck source and s e t capture mode

REG TC0 CMR0 = 5 ;

59

Page 74: thesis

Appendix D. Software Documentation 60

// a c t i v a t e quadrature encoder and po s i t i o n measure mode , no f i l t e r s

REG TC0 BMR = (1<<9) |(1<<8) |(1<<12) ;

// enable the c l o ck (CLKEN=1) and r e s e t the counter (SWTRG=1)

// SWTRG = 1 nece s sa ry to s t a r t the c l o ck ! !

REG TC0 CCR0 = 5 ;

# end i f

// Set s t a t e to 1 f o r running s t a t e

xD[0 ]=1 ;

}

D.1.3 Outputs Source Code// Only run t h i s i f a l r eady i n i t i a l i z e d

i f (xD[0]==1) {

#i f n d e f MATLAB MEX FILE

// i f not compiled f o r matlab then a s s i gn the value from the TC0 CV0

r e g i s t e r which conta in s the quadrature decoder p o s i t i o n value to

the output po s i t i o n

po s i t i o n [0 ]=REG TC0 CV0 ;

#end i f

}

Page 75: thesis

Appendix D. Software Documentation 61

D.2 Arduino Due 12-Bit DAC Simulink Block

D.2.1 Libraries / Includes// Inc lude the Arduino l i b r a r y i f not compi l ing f o r matlab

# i f n d e f MATLAB MEX FILE

# inc lude <Arduino . h>

# end i f

D.2.2 Discrete Update Source Code// Only perform setup i f s t i l l in the i n i t i a l s t a t e

i f (xD[ 0 ] !=1 ) {

// setup here i f we are not compi l ing f o r matlab

# i f n d e f MATLAB MEX FILE

//make use o f the analogWrite command with in matlab to enable the DAC,

e a s i e r than manually manipulat ing the r e g i s t e r s here

analogWrite (DAC1, 0 ) ;

# end i f

xD[ 0 ]=1 ;

}

D.2.3 Outputs Source Codei f (xD[0]==1) {

// Check i f be ing compiled f o r matlab

#i f n d e f MATLAB MEX FILE

// S e l e c t the DAC i n t e r f a c e which w i l l be wr i t t en to

d a c c s e t c h a nn e l s e l e c t i o n (DACC INTERFACE, 1) ;

// Write the 12�b i t DAC output value to the DAC i n t e r f a c e

da c c wr i t e c onve r s i on da ta (DACC INTERFACE, value [ 0 ] ) ;

#end i f

}

Page 76: thesis

Appendix D. Software Documentation 62

D.3 Arduino Due Frequency Generator Simulink

Block

D.3.1 Libraries / Includes// Inc lude the Arduino l i b r a r y i f not compi l ing f o r matlab

# i f n d e f MATLAB MEX FILE

# inc lude <Arduino . h>

# end i f

D.3.2 Discrete Update Source Code// Pin 5 i s used f o r PWM output us ing waveform genera t i on with in the

t imer counter .

// Only run t h i s once i n i t i a l l y

i f (xD[ 0 ] !=1 ) {

// setup here

# i f n d e f MATLAB MEX FILE

// Only f o r the arduino hardware , t h i s i s n t compiled f o r matlab .

// Make use o f the analogWrite command to s e t up the pin .

// Pin 5 i s connected to a t imer f o r PWM generat ion , analogWrite w i l l

s e t up a l l r e g i s t e r va lue s f o r t h i s and then RA and RC w i l l be

changed manually in the output func t i on .

analogWrite ( 5 , 1 ) ;

# end i f

xD[ 0 ]=1 ;

}

D.3.3 Outputs Source Code// Pin 5 i s connected to Timer Counter 2 on Channel 0

// RA and RC are used to s e t the per iod and duty cy c l e o f the generated

waveform

// Only run t h i s i f a l r eady i n i t i a l i z e d

i f (xD[0]==1) {

#i f n d e f MATLAB MEX FILE

// Only f o r the arduino hardware , t h i s i s n t compiled f o r matlab

Page 77: thesis

Appendix D. Software Documentation 63

// I f f requency equa l s 0 then stop the output by s e t t i n g RA higher than

RC so the output w i l l never go high . This a l s o avo ids a d i v i s i o n

by zero in the per iod c a l c u l a t i o n .

i f ( f r equency [ 0 ] == 0) {

REG TC2 RA0 = REG TC2 RC0 + 1 ;

// Reset the counter back to 0

REG TC2 CCR0 = 5 ;

}

e l s e {

// Ca l cu la t e the r equ i r ed per iod f o r RC and s e t the r e g i s t e r

REG TC2 RC0 = VARIANTMCK / 2 / f requency [ 0 ] ;

// Reg i s t e r RA i s s e t to h a l f o f RC f o r a 50% duty cy c l e

REG TC2 RA0 = REG TC2 RC0 / 2 ;

//Reset the counter , i t s a l r eady past RC, t h i s i s to avoid the counter

be ing past RC in some i n s t an c e s when RC i s changed to a lower va lue

.

i f (REG TC2 CV0 > REG TC2 RC0) {

REG TC2 CCR0 = 5 ;

}

}

#end i f

}

Page 78: thesis

Appendix D. Software Documentation 64

D.4 Test Bed Simulink Model

D.5 Test Bed Motor Control Subsystem

D.6 Momentum Sim Subsystem

Page 79: thesis

Appendix D. Software Documentation 65

D.7 Servo Motor Subsystem

D.8 Servo Drive Enable Subsystem

D.9 Calculate Stopping Time Subsystem

Page 80: thesis

Appendix D. Software Documentation 66

D.10 Braking Control Subsystem