• No results found

Automated control and test system for long time stess tests of microwave ovens

N/A
N/A
Protected

Academic year: 2021

Share "Automated control and test system for long time stess tests of microwave ovens"

Copied!
79
0
0

Loading.... (view fulltext now)

Full text

(1)

Department of Science and Technology

Institutionen för teknik och naturvetenskap

Linköping University Linköpings Universitet

SE-601 74 Norrköping, Sweden

601 74 Norrköping

LiU-ITN-TEK-A--10/061--SE

Automated control and test

system for long time stess tests

of microwave ovens.

Anders Appelgren

(2)

LiU-ITN-TEK-A--10/061--SE

Automated control and test

system for long time stess tests

of microwave ovens.

Examensarbete utfört i ITN

vid Tekniska Högskolan vid

Linköpings universitet

Anders Appelgren

Handledare Anders Ekström

Handledare Conny Johansson

Examinator Amir Baranzahi

Norrköping 2010-10-22

(3)

Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare –

under en längre tid från publiceringsdatum under förutsättning att inga

extra-ordinära omständigheter uppstår.

Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner,

skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för

ickekommersiell forskning och för undervisning. Överföring av upphovsrätten

vid en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning av

dokumentet kräver upphovsmannens medgivande. För att garantera äktheten,

säkerheten och tillgängligheten finns det lösningar av teknisk och administrativ

art.

Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i

den omfattning som god sed kräver vid användning av dokumentet på ovan

beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådan

form eller i sådant sammanhang som är kränkande för upphovsmannens litterära

eller konstnärliga anseende eller egenart.

För ytterligare information om Linköping University Electronic Press se

förlagets hemsida

http://www.ep.liu.se/

Copyright

The publishers will keep this document online on the Internet - or its possible

replacement - for a considerable time from the date of publication barring

exceptional circumstances.

The online availability of the document implies a permanent permission for

anyone to read, to download, to print out single copies for your own use and to

use it unchanged for any non-commercial research and educational purpose.

Subsequent transfers of copyright cannot revoke this permission. All other uses

of the document are conditional on the consent of the copyright owner. The

publisher has taken technical and administrative measures to assure authenticity,

security and accessibility.

According to intellectual property law the author has the right to be

mentioned when his/her work is accessed as described above and to be protected

against infringement.

For additional information about the Linköping University Electronic Press

and its procedures for publication and for assurance of document integrity,

please refer to its WWW home page:

http://www.ep.liu.se/

(4)

Abstract

To be able to improve products extensive testing is required in order to find hidden flaws in the design. The earlier flaws are found the higher are the probability that they can be corrected before the product is released onto the market. If the tests could be carried out all hours of the day every day of the week, this would introduce another level of stress to the product. More stress than if the product would be tested only during working days and it may reveal issues that could be corrected to improve the product further.

Although a similar test environment already exists at Whirlpool Sweden AB, there are requests to rethink and improve these tests so that the microwave ovens are tested in an environment more close to reality. This thesis will present a concept proposal of how to improve the tests. Further, the thesis will include initial construction of a machine that could perform automated tests with the ability to interpret errors and report them. In the end, the machine should press buttons on the microwave oven, look at the display with a camera, open the door and so on.

The mechanics for the machine is bought, so a big part of the thesis will be electronics design. The project will include an embedded system design with a 32-bit ARM micro controller that is going to control the machine. As this part is quite big the thesis will include the hardware design, but not much programming.

The hardware design of the embedded system did work as expected, without any revisions. The hardware has been verified by electrical tests and basic software to test the general functions of the hardware.

In the future, the hardware needs programming and the machine has to be equipped with a mechanical finger to be able to press buttons.

Keywords: Embedded system design, ARM, Cortex-M3, , Linear guide, Step-per motor.

(5)
(6)

Acknowledgements

I would like to thank Whirlpool Sweden AB for providing the resources for the thesis, all the persons at Whirlpool that have helped and supported me during the thesis work.

I especially want to thank my supervisors at Whirlpool, Anders Ekstr¨om and Conny Johansson, for making this thesis possible and also Rebecca Odin for all the help and guidance. For technical support I want to thank Anders Zeijlon for supporting me throughout the project.

I also want show my gratitude to my fellow classmates Henrik and Tobias for their invaluable support and encouragement during the whole thesis work. I also want to thank my family that has shown great patience with me and my occupied mind during the thesis.

(7)
(8)

Nomenclature

Most of the reoccurring abbreviations are described here.

Abbreviations

ACT Automated Control and Test PCB Printed Circuit Board LCD Liquid Crystal Display EAN European Article Number RFID Radio Frequency IDentification USB Universal Serial Bus

DC Direct Current

ESR Equivalent Series Resistance PID Proportional Integral Derivative ARM Advanced RISC Machine

RISC Reduced Instruction Set Computer CAD Computer Aided Design

CNC Computed Numerical Control UV UltraViolet

MCU Micro Controller Unit

EEPROM Electrically Erasable Programmable Read-Only Memory CAN Controller Area Network

TTL Transistor-Transistor Logic PLL Phase Locked Loop

A/D Analogue to Digital

EMI ElectroMagnetic Interference PWM Pulse Width Modulation JTAG Joint Test Action Group SPI Serial Peripheral Interface bus I/O Input-Output

DIP Dual In-line Package

UART Universal Asynchronous Receiver/Transmitter LED Light Emitting Diode

GPIO General Purpose Input/Output

ASCII American Standard Code for Information Interchange

(9)
(10)

Contents

1 Introduction 1 1.1 Background . . . 1 1.1.1 Company description . . . 1 1.1.2 Tests today . . . 1 1.2 Problem description . . . 2 1.3 Objectives . . . 2 1.3.1 Thesis goal . . . 3 1.3.2 Project goal . . . 3 1.4 Limitations . . . 3 1.5 Methods . . . 3 1.6 Topics covered . . . 4 2 The Concept 5 2.1 Automated Control and Test system . . . 5

2.1.1 Identification . . . 5

2.1.2 Buttons . . . 5

2.1.3 Open the door . . . 6

2.1.4 Change load . . . 6 2.1.5 Visual inspection . . . 6 2.1.6 Measurement . . . 6 2.1.7 Evaluating failures . . . 6 2.2 The machine . . . 6 2.2.1 Robot arm . . . 7 2.2.2 Linear guides . . . 7 2.3 Electronics . . . 8 2.3.1 Computer . . . 8 2.3.2 Hardware . . . 9 3 Theory 11 3.1 Step-down converter . . . 11 3.1.1 The principle . . . 11 3.1.2 Mathematical reasoning . . . 12 3.1.3 Comments . . . 14 4 Considerations 15 4.1 Evaluating options . . . 15 4.1.1 Machine . . . 15 4.1.2 Motors . . . 15 Appelgren, 2010. vii

(11)

4.1.3 Electronics . . . 16

4.1.4 Linear guides . . . 17

4.2 Choosing a microcontroller . . . 17

4.3 Compiler and code environment . . . 18

5 Embedded system design 19 5.1 Construction . . . 19

5.1.1 Existing hardware . . . 19

5.1.2 Subsystem . . . 20

5.1.3 PCB Manufacturing . . . 21

5.1.4 Disclaimer . . . 22

5.2 ACT Power supply . . . 22

5.2.1 Schematic . . . 22

5.2.2 Layout . . . 23

5.3 ACT Commander . . . 24

5.3.1 Schematic . . . 25

5.3.2 Layout . . . 30

5.4 ACT Commander Connector . . . 30

5.4.1 Schematic . . . 31

5.4.2 Layout . . . 31

5.5 ACT Commander Communicator . . . 31

5.5.1 Schematic . . . 32

5.5.2 Layout . . . 33

5.6 ACT Commander Stepper driver . . . 34

5.6.1 Schematic . . . 34 5.6.2 Layout . . . 38 6 Programming 39 6.1 Existing software . . . 39 6.1.1 Modules . . . 39 6.1.2 Disclaimer . . . 39 6.2 Operating system . . . 39

6.3 Stepper controller communication . . . 40

6.3.1 Specification . . . 41

6.3.2 Data stream . . . 43

6.4 Display font . . . 44

7 Results 45 7.1 Embedded system design . . . 45

7.1.1 ACT Power supply . . . 45

7.1.2 ACT Commander . . . 46

7.1.3 ACT Peripheral systems . . . 48

7.2 Programming . . . 49

7.2.1 Serial Communication . . . 49

7.2.2 Fonts . . . 50

(12)

Contents ix

8 Discussion 53

8.1 The concept proposal . . . 53

8.2 Embedded system design . . . 53

8.3 Programming . . . 53

8.4 Goals . . . 54

9 Conclusion 55 9.1 Comments . . . 55

9.2 Future work . . . 55

A The Font Parser 63 A.1 Source code generator . . . 63

(13)
(14)

Chapter 1

Introduction

In this chapter, the reader is introduced to the master’s thesis. First, the background of the project will be presented together with a description of the company where the thesis work has been carried out. There are also a problem description and objectives of the project. Furthermore, limitations and methods are described. Finally, a description of what topics this thesis will cover.

1.1

Background

This thesis has been carried out at Whirlpool Sweden AB in Norrk¨oping, where built in microwave ovens are developed and produced.

1.1.1

Company description

Whirlpool Corporation is a global manufacturer of domestic appliances and was founded 1911. The corporate headquarters is located near Benton Har-bor, Michigan, USA and the European headquarters is in Milan, Italy. The company has 67 technology and research centres and manufacturing facilities in 12 different countries divided over four continents. Whirlpool Corporation has more than 70 000 employees. In 2008 sales were about $19 billion. In Europe, Whirlpool sells products under a number of different brands, such as Whirlpool, Kitchen Aid and Bauknecht [1, 2, 3].

The factory in Norrk¨oping, Sweden, dates back to the early sixties and is now the main technology centre for microwave ovens. The main focus is, and has been for some years, microwave ovens for built in purposes. The facility produces about 350 000 units each year, and the majority of the products are sold in Europe and North America [3].

Whirlpool Sweden AB has about 350 employees where about 60 people works with product improvement and development [3].

1.1.2

Tests today

Before a microwave oven is ready for production the prototype has to survive extensive testing to assure that the design fulfill all the requirements set. A department called PALO (Product Approval and Lab Operation) is specialized

(15)

to do these tests and then approve that the product could be released into production.

When in production, each unit has to pass final inspection to guarantee that the finished product is working properly. The tests are carried out using robots with the ability to press buttons and turn knobs. The system is using cameras to check displays and markings.

1.2

Problem description

There are differences in test methods for the development and production. Nat-urally, the development phase of a new platform requires more testing than if it is in production. For example, if a new hinge for a door has been constructed specifically for a new model, this hinge will be tested thoroughly during the development. When the platform eventually is in production the hinge will be verified that it is mounted correctly and is mechanically working as it supposed to be.

During the development of a new platform each component is tested apart, but there is really no final test when the whole oven is tested. There are au-tomated stress tests where the oven is working as a unit. In that case the control panel is bypassed using, for example, relays. As the control panel is bypassed, the buttons will not physically be pressed during the lengthy stress test. Therefore the test will not cover mechanical failure of the buttons.

Because of this, a new test method is requested. A test where the oven is in some sense used as it would be in everyday life when the customer is using the product. As this test would be carried out during a long period of time, the test needs to be automated.

This thesis is the first step into the new ACT (Automated Control and Test) system.

Following questions will be used to define the thesis work.

• How could a machine that is able to control a microwave oven look like? • How to make the setup as easy as possible?

• Should the machine be made independent of a PC?

• How could raw data be stored locally in the system before transferred to a computer?

• The safety is always an important issue, how to handle these exceptions?

1.3

Objectives

This thesis will constitute a part of the project. The objectives can be divided into what objective this thesis has, and objectives of the whole project.

(16)

1.4. Limitations 3

1.3.1

Thesis goal

The objective with this thesis is to find a conceptual solution of how to simulate real usage of a microwave oven and identify what to take into account when choosing what type of machine that is going to be used. Then begin construc-tion of electronic hardware that will constitute the foundaconstruc-tion of the project. The following is the major checkpoints in the thesis work.

• Concept proposal • Ordering of a machine

• Develop schematic and PCB layout • Manufacturing of several PCBs • Software for verifying the hardware

1.3.2

Project goal

In a larger perspective this machine will perform tests automatically. The ma-chine will be able to more or less do anything that a human being is doing when using a microwave oven. That is, pressing buttons, turn knobs, look at the display, open and close the door.

1.4

Limitations

This report assumes that the reader has some knowledge of embedded system design and terminology related to it.

The thesis work will span over 20 weeks. Therefore, the work has to be limited to a reasonable size. First, the machine itself will be bought, as this thesis will not include any mechanical construction. Instead, it will mainly consist of electronic hardware design, but will not include much programming due to the limited amount of time. The software will only verify that the hardware is electrically sound.

1.5

Methods

The project will begin with a pre-study of what tests are carried out today and how to implement them in the new test system.

Then a concept proposal will be presented based on how dynamic the system needs to be. For example, the microwave ovens that will be tested using this rig are of different size. Therefore, the size of the machine needs to be chosen to accommodate the biggest microwave.

The machine will have to use some sort of mechanical finger to be able to press buttons. This arrangement will be mounted on the machine. Because of this an estimation of how much weight the machine has to be able to lift must be done.

Eventually, when a machine has been chosen, an assessment in what is needed in terms of electronics. Some of the electronics has to be bought and some will be developed during the thesis work.

(17)

1.6

Topics covered

The report has in total nine chapters and one appendix. Main topics dealt with are:

Chapter 2: Conceptual description, here the machine is discussed, what the machine will be able to do and different possibilities are explored. For example the type of machine that could be used for this thesis.

Chapter 3: Theory around the step down converter is explained in this chap-ter.

Chapter 4: In the fourth chapter, the different options are considered and one option will be chosen setting the path of the work ahead. This applies both to mechanical and electrical.

Chapter 5: The largest part of the thesis is the embedded system design. The system will be constructed from scratch, explained in this chapter. Chapter 6: The thesis will include some programming, mainly basic

function-ality.

Chapter 7: In the seventh chapter, the results are shown.

Chapter 8: In the discussion, the choices made in the thesis will be defended, but there are also possible drawbacks in making various choices.

Chapter 9: The last chapter is the conclusion, where the thesis work is com-mented and what parts are left to do before the machine will be function-ing.

Appendix A: An appendix that contains the code for generating source code for fonts for the LCD display.

(18)

Chapter 2

The Concept

One of the first milestones of this thesis is to develop a concept proposal of the whole project. In this chapter, a concept will be introduced. Basically, the goal is to derive a solution to move the tests that could be fully automated from personnel performing these tests today.

2.1

Automated Control and Test system

Although not presented to any extent here, other applications would suit this machine. Not only to test a prototype or finished product. It could also perform specification tests of, for example, individual electrical components. If this were to be included in the concept, the task would be far more extensive. Therefore, the system will have its main focus on controlling and measuring a microwave oven in general.

The conceptual system can be broken down into a number of different areas.

2.1.1

Identification

A system to determine what type of oven is used, and that type of test that is supposed to be carried out. One way to solve this is to have an EAN code or RFID recognition. This recognition could then be tied to a certain testing scheme.

2.1.2

Buttons

To be able to start a microwave oven, naturally, buttons have to be pressed and knobs have to be turned. To make the test closer to reality, the button has to be pressed with different force and not at exact the same position each time. Using a mechanism as such would require some sort of sensor that probes the force by which the button is pressed. Suppose that the known position would be at the center of the button, a random error function would introduce stress to the button as the point where the force applied is random.

(19)

2.1.3

Open the door

Ability to open the door is a demand if the machine would be fully autonomous. Because the load has to be changed from time to time the door has to be opened. This could also test the safety switches that assures that the microwave oven cannot be started when the door is open.

2.1.4

Change load

Load is referred to the media that is going to be heated. In most long time stress tests water is used as the load. As the water is heated to its boiling point, the water needs to be changed after a certain time. This could be done using a refilling module which extracts the hot water and refills the container with cold water.

2.1.5

Visual inspection

A system that examines the test object visually is needed to be able to read the display, so the machine could navigate through the microwave oven’s user interface and power settings. A camera is highly suited for this task. Further-more, a camera could detect if the cavity light is working, and the turning plate is turning. Also, if the different buttons are labelled using, for example, colored stickers which are placed on the button the machine could by itself find and store the position of each button.

2.1.6

Measurement

The main task of the system is to perform measurements. Measuring the power consumption is very important. The power consumption could tell if the differ-ent electronic modules in the microwave oven are working, as it is known how much power each module should consume.

The microwave leakage is a safety detail, and by measuring the leakages over a long time, changes in the leakage over time could be detected.

By measuring the temperature of the water with a certain volume before a test and then measure the temperature after a certain time, the power output of the magnetron could be calculated.

2.1.7

Evaluating failures

When an error occurs, the machine needs to be able to handle that exception. If the cavity light fails, this will not affect the function of the oven in any bigger extent. So the test does not necessarily have to be stopped, the system would only need to note when the light failed. If the magnetron stops working, the test needs to be stopped.

2.2

The machine

The machine has to reach each button, no matter what type of microwave oven it is. As there are a variety of microwave ovens that Whirlpool produces, the machine has to be big enough so the biggest model could be tested as well.

(20)

2.2. The machine 7

2.2.1

Robot arm

One solution would be the use a multi axis robot arm. This solution is already in use in the final inspection in production [3]. A robot like this needs a con-siderable amount of space, taken safety distance into account. As this type of robot in figure 2.1 is quite heavy, it therefore limits the movability of the robot. In addition it has to be attached solid to the ground. Obviously, this could be seen as a big drawback in an application where movability in a sense is required.

Figure 2.1: A robot used in production [3].

2.2.2

Linear guides

If the machine’s number of axes is limited to two, the robot could still reach a certain point and be placed in front of a button. A third axis is then required to actually press the button. This could be an air pressure controlled cylinder that would act as a mechanical finger. Of course, using only two axes would limit how, in a sense, dynamic the machine would be. On the other hand, a machine like this would be far less complex to control than a, for example, multi axis robot arm.

For this thesis, a two axis arrangement is chosen. First of all, a multi axis robot arm is far more expensive than a two axis robot. Also, as this area of long time stress testing is quite new, the machine, seen in figure 2.2 could be seen as a proof of concept rather than an all finished testing rig.

(21)

Figure 2.2: A concept sketch of a supposed design.

To assure that the machine itself is rigid, two parallel linear guides are used in X-axis.

2.3

Electronics

The system will naturally require electronics to function. Figure 2.3, is as conceptual description of the hierarchy of the ACT-System.

Figure 2.3: Different blocks constituting the ACT system.

2.3.1

Computer

An ordinary computer will play an important role in the system as it would be at the top of the whole ACT-hierarchy. It will supervise all different functions although not controlling the dedicated functions directly, for example move to a certain button and press it. There will be a hardware interface between the machine and the computer that handles the low level functions.

The computer will instead be used to gather and analyze the raw data that is measured. Once the data has been analyzed, preferably, the computer would be connected to a server at where data could be placed. As the machine needs coordinates to know where the buttons are placed in order to maneuver the microwave oven, software where a testing scheme is built is required also. This is then downloaded into the hardware so the computer could be disconnected and the machine would still be functioning.

(22)

2.3. Electronics 9

2.3.2

Hardware

To be able to get the system functional, some hardware has to be developed. The hardware needs to be designed to accommodate further expansion of the system. Therefore, as seen in figure 2.3, there is a controlling hardware that is the master unit in the hardware hierarchy, but it will be subordinate to the computer. Further down in the tree in figure 2.3 there are peripheral hardware that acts as a link between the physical unit and the commanding hardware. It will handle dedicated and low level functions. The physical unit could for example be the motors driving the machine or a camera.

The computer and the controlling hardware will communicate through USB. The possibility of storing the measured data locally in the hardware is required if, for example, the computer is turned off. Therefore the hardware has to be equipped with memory. To keep the system extendable, the controlling hardware has to support a number of different serial protocols. The following figure, figure 2.4, shows another visualization of the hardware system.

Figure 2.4: Block Diagram and different communication protocols. Seen as an executing unit the peripheral hardware is told what to do, and will therefore not have any mandate to make decisions. Naturally, the unit will have built in security functions in case something fails.

(23)
(24)

Chapter 3

Theory

In this chapter some theory is explained to help the reader to have a more general understanding of a crucial building block of this thesis.

3.1

Step-down converter

In the thesis, switch-mode DC to DC converters are going to be used. The converters are bought as finished units so the converters will not be constructed as part of the thesis work. Although the units are more or less ready to solder on the PCB, the theory behind the units are very important.

3.1.1

The principle

A switch-mode DC to DC converter, also known as a step-down converter, converts a certain voltage level to a lower level. The principle is shown in figure 3.1.

Figure 3.1: Step-down converter principle schematic.

The switch S controls the amount of time the input voltage UIN is equal

to US, also known as duty cycle. The switch will be turned on and off at a

frequency in the magnitude of 104

Hz [4]. If the duty cycle is changed, the output voltage UOU T will change accordingly. The diode D, seen as ideal [4],

is for preventing the negative voltage induced by the inductor to flow through the circuit. When the switch is closed, the current will be delivered from the source. When the switch is opened there will still be a current running through the load and the diode as there are energy stored in L and C.

(25)

3.1.2

Mathematical reasoning

The behaviour of the circuit in figure 3.1 can be described mathematically. The fundamental relationship for an ideal capacitor is characterized by the charge q, a constant C and the voltage over the capacitor u [4, 5].

q= Cu (3.1)

The definition of current i is the rate of flow of the charge dq, over a certain time dt.

i(t) =dq

dt (3.2)

The current, iC passing through the capacitor is derived using 3.1 and 3.2.

iC(t) = C

du

dt (3.3)

If the current in 3.3 is zero, the voltage derivative has to be zero meaning that the voltage will not change. This is valid because the capacitor will not get charged without any current applied. If the current is constant, the voltage derivative will be constant meaning that the voltage will change linearly - the capacitor will get charged. A similar reasoning as for the capacitor can be done for the ideal inductor. The definition of magnetic flux, Φ, is a constant L multiplied with the current [4, 5].

Φ = Li (3.4)

According to the law of induction, the voltage over the inductor is the change in magnetic flux over time.

uL(t) =

dt (3.5)

Using 3.4 and 3.5 the voltage, uL over the ideal inductor is acquired.

uL(t) = L

di

dt (3.6)

When the voltage is zero in 3.6, the current will be constant as the current derivative will be zero. If the voltage is constant, the current will change linearly. The inductor and capacitor in figure 3.1 could be seen as a low pass filter to smooth out the square-wave voltage that is acquired from the switch turning on and off.

In the figure 3.2 the output voltage UOU T will be, given a certain duty cycle

δthe mean value. The area A above UOU T is the same as below UOU T.

(26)

3.1. Step-down converter 13

An expression for UOU T could be by derived based on figure 3.2 [4],

UOU T = 1 T Z T 0 usdt= UIN δT T = δUIN (3.7)

If the load RL is constant, the DC-current through the inductor will be the

same as the current through RL. According to 3.6, the current will have a zigzag

pattern as the voltage has a square-wave shape, see figure 3.3.

Figure 3.3: The current through the load RL.

When the switch is closed, in the period δT the voltage could be defined as [4],

diL

dt =

UIN− UOU T

L (3.8)

When the switch is open, during (1 − δ)T [4], diL

dt =

−UOU T

L (3.9)

For the step-down converter to work properly, it is important that the current throught the inductor does not reach zero. Therefore the magnitude of the ∆IL

must not exceed the mean current through the inductor which is the same as IOU T. Taken with a security margin, ∆IL could be defined as [4],

∆IL≤ 0.4IOU T (3.10)

Using figure 3.2 and figure 3.3 and knowing the condition in 3.10 the value L can be found. L=UOU T(1 − δ)T |∆IL| ≥UOU T(1 − δ)T 0.4IOU T (3.11) Assuming that the capacitor that is chosen has a much lower impedance than the load resistance RL, the ripple, variation in output voltage, could be

approximated for a certain L and C.

If the duty cycle is 50% or δ = 0.5 the voltage over the diode, uS could be

approximated to a Fourier series [6, 7],

US(t) = UIN( 1 2+ 2 πsin ωt − 2 3πsin 3ωt + 2 5πsin 5ωt − . . .) (3.12) As L and C constitute a low-pass filter, only the first term is relevant as the higher angular frequencies are filtered out. Calculating, using only the first term, ω, the filter could be expressed as

(27)

UOU T uS = 1 jωC jωL+ 1 jωC = 1 1 − ω2 LC ≈ − 1 ω2 LC (3.13)

The ripple could then be expressed as [4], ˆ UOU TAC = 2 πUIN 1 ω2 SLC = 2 πUIN 1 (2πfS)2LC (3.14) Where fS is the switching frequency.

3.1.3

Comments

In reality the ripple will be larger than what 3.14 is showing. This because the components are not as ideal as assumed in calculations. Mainly, the character-istics of the capacitor is particular important. Such as losses in the capacitor, known as ESR (Equivalent Series Resistance) is both temperature and frequency dependent [8].

Through the inductor, the mean current ILis fed to the load resistance RL

while the varying ∆IL goes through the capacitor. As the variation in current

through the capacitor could possibly be quite large, the variation of the voltage over the capacitor could be quite large as well even though the ESR is small. The ripple could be expressed as [4],

ˆ UOU T =

∆IL

2 rC (3.15)

Where rC is the ESR. It is therefore important to use capacitors that have

(28)

Chapter 4

Considerations

There is a lot to consider when choosing a machine, in this chapter the reader will be presented what different options there is and why a certain option is chosen.

4.1

Evaluating options

The machine is yet to be ordered. As there are some options to choose from when ordering the machine, for example, what type of motor should be used.

4.1.1

Machine

The size of the machine is depending on how big the testing object is. Whirlpool sells a microwave oven that is about 800 mm wide, and is one of the biggest. Therefore, the robot has to be able to travel across the whole unit together with some margin. A reasonable travel distance in X-direction would then be around 1000 mm. In Y, 800 mm would be sufficient.

4.1.2

Motors

Because the machine uses electrical motors, it has to be decided what type of motor to use. In this particular case, two options exist. Either DC-servo motors or stepper motors.

The advantage of a DC-servo motor is its reasonable high torque compared to its physical size. As it is a DC-servo there are two major components in this type of motor system. A DC-motor and a position control [9]. The DC-motor has no way of knowing the position, because the motor will start to rotate when a voltage is applied to its terminals, so the position control is used as a reference to determine the location. This is a well known problem in automatic control engineering. Although this would be a good choice, it became apparent that this type of motor system is quite expensive.

Instead, stepper motors are chosen [10]. A stepper motor is quite different from the DC-motor, a full revolution of a stepper motor is divided into a rather large number of steps. Each step corresponds to a certain digital code. Therefore stepper motor knows its own position, but the controller does not. Called open-loop in automatic control engineering [9]. The motors are fitted with position control giving the feedback so the control will be closed-loop [9]. This giving the

(29)

same advantages as the DC-Servo motor has. In addition, this setup becomes nearly half the price of the offered DC-Servo solution. One of the stepper motors is seen in figure 4.1.

Figure 4.1: A stepper motor with rotary encoder.

4.1.3

Electronics

As the thesis does not include construction of the electronics needed to drive the motor directly, controls where bought together with the linear guides and stepper motors. This stepper motor control does support position control as it has a built in PID-controller [9]. The control, seen in figure 4.2, communicates through USB and general purpose input and output pins [11].

(30)

4.2. Choosing a microcontroller 17

4.1.4

Linear guides

There are two ways of feeding slides of the linear guides. Spindle drive and belt drive.

The spindle drive could be seen as an ordinary screw and a nut, see figure 4.3. Suppose that the nut is held in such a way that the nut is not turning when rotating the screw itself. When turning the screw, the nut will start travel back or fourth depending on in what direction the screw is turned. The principle of the spindle drive is the same, although a bit more sophisticated.

Figure 4.3: The principle of spindle drive.

The belt drive is the other option. The belt is toothed and connected to two gears in each end, figure 4.4. In one end the motor is connected to the gear. The belt itself is connected to the slide. When the motor is turning, the slide will follow the motion as the belt is connected to it.

Figure 4.4: The principle of belt drive.

In this particular application belt drive is best suited, mostly because of its size and weight. The spindle drive is mechanically very rigid, but is both very heavy and the guides become quite large in size in order to accommodate the spindle drive itself.

4.2

Choosing a microcontroller

The microcontroller has to support a number of different serial protocols, have reasonably good performance and have enough number of pins so all the periph-erals could be mapped to pins. An 8-bit microcontroller was never considered, as one of the personal goals of this thesis was to learn more about ARM.

When choosing a microcontroller, there are a lot of things to take into ac-count. Not only the microcontroller’s performance, but also a working tool chain and support from people at Whirlpool.

Whirlpool uses the STMicroelectronics’s STM32F ARM Cortex-M3 [12] in one of the microwave ovens produced. A chip in the STM32F family was very well suited for the thesis, the 100 pin STM32F103VBT6 [13].

(31)

4.3

Compiler and code environment

Each microcontroller needs a certain tool chain in order to be able to compile code and program the chip. Two options were considered, both having its advantages and disadvantages.

The first option is Yagarto [14], a GNU ARM tool chain for Windows that together with a plugin from Zylin is integrated into Eclipse code environment. Together with an open source operating system, FreeRTOS [15], this option is tested successfully.

Whirlpool already has a licensed tool chain for this microcontroller, the Embedded Workbench for ARM from IAR Systems [16], together with the JLink Debugger [17], Figure 4.5. The package is more or less ready-to-go.

Figure 4.5: J-Link Debugger.

The option of using Embedded Workbench for ARM is chosen as support from people at Whirlpool is to prefer. Also, a huge library of modules, operating system and documentation is provided from Whirlpool giving a jump start.

(32)

Chapter 5

Embedded system design

One of the largest parts of the thesis is the construction and manufacturing of the embedded system. In this chapter the reader is shown how the embedded system is constructed.

5.1

Construction

By dividing the system in to smaller dedicated PCBs, some problems will be eliminated. For example, if one PCB has to be redesigned, only that PCB has to be reconstructed. If the system would consist of only one PCB, flaws in the design would mean that the whole PCB has to be redesigned, making the system rather vulnerable.

5.1.1

Existing hardware

An already existing hardware is used as a base to construct a new hardware. This hardware is used in one of the microwave ovens. The core is a Cortex-M3, although with less pins. This has the disadvantage that all the peripherals in the chip cannot be routed to individual pins. Therefore, the requirement of accessing all the communication protocols in the chip is not fulfilled. Also, as the existing hardware is constructed as a part of a microwave oven, the hardware has some undesired functions.

The hardware, seen in figure 5.1, has a monochrome blue and white display matrix.

Figure 5.1: Picture is showing the front of the existing hardware.

(33)

The PCB is placed in a plastic cover, which protects the components, but also has some small brackets for connectors, figure 5.2. The cover is designed to fit in a sort of plastic frame, which eases the mounting of the unit.

Figure 5.2: The cover.

The new hardware will have the same mechanical measurements as the ex-isting hardware; see Figure 5.3, so it could be suited in a modified plastic cover. The PCB is attached to the display, so some holes are needed to be drilled on the PCB. The plastic cover is then attached to both the display and PCB.

Figure 5.3: The existing hardware.

5.1.2

Subsystem

The system will consist of five subsystems, see figure 5.4. Each system will be connected with IDC-cables, making the system extendable. The subsystems could be exchanged to support other applications.

(34)

5.1. Construction 21

5.1.3

PCB Manufacturing

The PCBs will be manufactured at LiU Campus Norrk¨oping, and will be a part of the thesis. The following is the major points in the workflow when manufacturing a PCB.

• Drawing CAD • Print pattern • Drill holes • Copper plating • Apply photo resist • Etching

• Apply solder mask

Before the PCB is manufactured, the schematic is made and the PCB layout is drawn. The schematic and CAD are made in Altium Designer, [18]. Each component in the schematic is tied to a certain footprint. Sometimes these footprints has to be drawn, but most of the times the footprints can be found in the libraries in Altium Designer.

Once the CAD is done, the pattern is printed with a special photo plotter. The film is then processed in a dark room. If a two layer design is manufactured, two films for the pattern have to be made. Also, two films for the solder mask have to be printed.

The next step is to drill holes in the FR4 substrate. The hole pattern and hole sizes are exported from the CAD. The holes are then drilled using a CNC drill.

If the design requires two layers, the top and bottom layer has to be gal-vanically interconnected. This is done by copper plating the holes. The process applies a thin copper layer on the substrate.

Before etching, a photo resist is applied to the substrate. The film that was printed earlier is placed on top of the photo resist and the substrate is then exposed to UV-light. This hardens the photo resist where copper is desired, undesired photo resist is washed away. The resist will protect the copper in the etching phase.

The etching will chemically remove all the undesired copper. This stage is quite critical because the etching has to be timed so the etching fluid does not start to creep under the photo resist destroying the PCB. Once the etching is done, the PCB is visually examined to see if the etching process has been successful.

The last step is to apply solder mask. The mask protects the copper layer from oxidation. Similar to the photo resist, the solder mask is exposed to UV-light to be harden where solder mask is desired. As mentioned earlier, a film for the solder mask is printed. The film shows where the solder mask is undesired, in other words where components are going to be soldered. The undesired solder mask is then washed away and then the PCB is exposed to UV-light once again to further harden the solder mask.

(35)

5.1.4

Disclaimer

Due to confidentiality the entire schematic of some of the systems will not be published in the thesis report.

5.2

ACT Power supply

The system will be supplied with 24 V , the voltage has to be reduced to 12 V , 5 V and 3.3 V , see figure 5.5. By using three step-down converters, the voltage could efficiently be reduced. The advantage of the step down converter will be that the voltage reduction will not generate as much heat as a linear voltage regulator. As the MCU requires a backup battery to keep the real time clock running, a battery holder is mounted on the PCB.

Figure 5.5: The main principle of the power supply.

5.2.1

Schematic

The input consists of an ordinary two pin screw connector, where the 24 V supply is connected. The circuit is protected from polarity reversal by a series diode. The voltage drop over the diode, approximately 0.7 V , is not an issue as the voltage, indicated as 24 V in figure 5.6, will only be connected to the step down converters.

Figure 5.6: Input connector.

To assure that the circuit is in some sense safe, fuses are connected to the input of the step-down DC/DC converters, refer to figure 5.7. If a DC/DC converter would consume more energy than it is supposed to, the fuse would prevent other electronics from being destroyed as a result of the faulty step down converter. The step down converters, that has a wide input voltage range, 9 − 36 V has also some built in security functions, but this does not prevent further safety precaution as the diode and the fuses.

(36)

5.2. ACT Power supply 23

Figure 5.7: Step down schematic.

To increase voltage stability ordinary decoupling capacitors are placed at both the output and input of the power supply unit, see figure 5.8. A larger 220 µF is connected to the input to prevent sudden and fast voltage drops to affect the system.

Figure 5.8: Decoupling and Battery.

There are two types of output connectors, figure 5.9. There is one six pin IDC connector for supplying the ACT Commander, and three other connectors for supplying other parts of the system.

Figure 5.9: Output connectors.

5.2.2

Layout

The size of the PCB is dependent on the components, not any specified measure-ment. Although there is no demand on a certain dimension, the components are placed as dense as possible to reduce the size of the PCB. The PCB, see figure 5.10, is a two layer 1.6 mm FR4 substrate with copper plated holes. Some of the components are not available in any library provided with the CAD software, Altium Designer, so they have to be drawn prior to the PCB design.

(37)

Figure 5.10: ACT Power supply CAD layout.

5.3

ACT Commander

Together with the ACT Power supply, the Commander will be the core of the system. These two blocks has a generic function, which would suit quite a large variety of applications. Instead, the peripheral subsystems will define the specific function of the system. By exchanging the peripheral blocks, the system could be used elsewhere.

Referring to figure 5.11, the Commander will, in principle, consist of a dis-play, Flash EEPROM, RS232 Converters, CAN Converter and a few connectors.

(38)

5.3. ACT Commander 25

5.3.1

Schematic

As the STM32 supports remapping of pins, all the serial protocols could be used. The following figure 5.12 shows the mapping of the pins. The series resistors connected to most of the pins act as a current limiter. The MCU does in fact manage TTL logic levels at the input, but this is a safety precaution to avoid damaging the 3.3 V powered MCU.

Figure 5.12: STM32F103VBT6 Pinout.

There are two crystal oscillators connected to the MCU, see figure 5.13. The 8 M Hz crystal oscillator is for the built in PLL that is boosting the system clock to 72 M Hz. The other is used as a real-time clock oscillating at a frequency of 32.768 kHz which could be divided using a 15-bit binary counter to exactly one second. This because 215

(39)

Figure 5.13: Oscillator circuits.

For supplying the MCU, 3.3 V is used. There is also support of backup of a battery which is located on the ACT Power supply. Figure 5.14 shows two sub circuits one for the backup battery, and one for the built in A/D converter. To get a stable input voltage to the A/D converter, an EMI-filter is connected in series with the 3.3 V supply. The filter has an impedance of 50 ohm at 100 MHz.

Figure 5.14: Power supply circuit for the MCU.

As the voltage levels of the RS232 serial port is much higher than 3.3 V a converter, see figure 5.15, has to be used. There are four lines for the RS232 protocol, receive, transmit, clear to send, request to transmit. The converter is powered by 5 V . Fortunately, the input pins of the MCU supports TTL levels.

Figure 5.15: RS232 level transceiver circuit.

(40)

5.3. ACT Commander 27

sub circuit, figure 5.16, is showing two header connectors. The two pin header is used to connect a termination resistor using a jumper. The three pin header gives the ability to choose if the CAN transceiver’s standby mode should be software controlled or not.

Figure 5.16: CAN level transceiver circuit.

The display used is a blue and white display. The display controller com-municates using SPI. To be able to make the intensity of the backlight software controlled, a transistor is connected to ground, see figure 5.17. By using a PWM signal the light intensity could be changed quite simple in software.

Figure 5.17: Display backlight driver and connection.

The main purpose of the SPI EEPROM-Flash memory is to store fonts for the display. Two different types of packages, SO8 and SO16 could be used, see figure 5.18. The reason for this is that it should be possible to use the same memory used in the original hardware. Unfortunately this chip was not available from the supplier, so another memory chip had to be used instead.

(41)

Figure 5.18: SPI Flash EEPROM circuit. The I2

C-bus requires a pull-up resistor, see figure 5.19. There are two de-coupling resistors connected to each line, this to reduce noise.

Figure 5.19: I2

C subcircuit.

A few resistors are used to allow simple buttons to be connected directly to the Commander, see figure 5.20.

Figure 5.20: Pull down resistors for buttons.

To ensure stable operation, decoupling capacitors are placed all around the PCB. The figure 5.21 is showing a number of decoupling capacitors for the 3.3 V and the USB data lines.

(42)

5.3. ACT Commander 29

Figure 5.21: ACT Commander decoupling capacitors.

To be able to program both the EEPROM-Flash and the STM32, a header for a JTAG and SPI programmer is used, see figure 5.22.

Figure 5.22: JTAG connector pinout.

Three IDC connectors are placed at the edge of the PCB, and one is placed in the middle of the PCB, see figure 5.23.

(43)

5.3.2

Layout

As the Commander has to fit in the cover, the mechanical measurements are important, figure 5.24. The measurements are taken from the existing hardware. The major difference between the Commander and the existing hardware is that the Commander has different edge connectors. There are three IDC connectors, one power supply connector, and two for peripheral systems.

Figure 5.24: ACT Commander mechanical measurements.

The layout requires quite a high precision, as the error margin is about 0.2 mm. Therefore, after all the holes have been drilled, the PCB has to be partly milled, the mill layer is shown in figure 5.25. If this would be done later in the manufacturing stage, there is a high risk that the precision is lost resulting in destroying the PCB.

Figure 5.25: CAD layout of the ACT Commander.

5.4

ACT Commander Connector

This PCB is the simplest sub system. In principle, the connector from the Commander is divided into a number of smaller connectors. These connectors are electrically compatible with buttons and knobs used by Whirlpool.

(44)

5.5. ACT Commander Communicator 31

5.4.1

Schematic

In figure 5.26 the entire schematic is shown. The 20 pin IDC, connected with the Commander, is divided into five connectors. Some of the net names may be confusing, but these are only seen as I/O-ports. The connectors could directly be connected with different types of already existing buttons and knobs.

Figure 5.26: ACT Commander Connector schematic.

5.4.2

Layout

The size of this PCB is determined by the size of the connectors, clearly seen in figure 5.27. The PCB is two layered and has, like all the other peripheral subsystems, drilled holes for M-3 screws.

Figure 5.27: ACT Commander Connector design layout.

5.5

ACT Commander Communicator

Basically, this PCB is designed to be placed on a front panel. It consists of SD-memory Card, USB slave connector, a male DSub-9 connector for RS232

(45)

and a header for connecting status LEDs. See figure 5.28. This subsystem is allowing the Commander to communicate with the outside world.

Figure 5.28: ACT Commander Communicator block diagram.

5.5.1

Schematic

The header connector is connected to the Commander and carries signals to the different connectors on the PCB, see figure 5.29. This connector is located at the backside of the Commander.

Figure 5.29: Signal connector pinout.

The SD-memory card supports SPI which makes it suitable for this appli-cation. The card holder has a write protection and card detection. These two could be activated by jumpers, seen as two pin headers in figure 5.30.

(46)

5.5. ACT Commander Communicator 33

The USB-B slave connector has a small subcircuit to detect is the USB is connected. This function is optional using a jumper, figure 5.31. There is also a connector for a LED that is light if the USB is connected.

Figure 5.31: USB connector subcircuit.

The DSub-9 male connector is used for RS232 communication, figure 5.32.

Figure 5.32: DSub-9 connector pinout.

A header for five status LEDs seen in figure 5.33, the LEDs are light by setting the pin to low.

Figure 5.33: Status LED.

5.5.2

Layout

As the PCB should be placed at a front panel, the connectors should be placed side by side. This will determine the size of the PCB, see figure 5.34. It is a two layer PCB 1.6 mm F R4.

(47)

Figure 5.34: ACT Commander Communicator layout.

5.6

ACT Commander Stepper driver

To communicate with the stepper motor drivers, which were bought together with the machine, some sort of interface has to be used. The stepper controller’s I/O-ports input voltage is 5 − 24 V so by using an optocoupler design the Commander drive the I/O-ports directly as it is electrically separated from the stepper motor drivers. This has the advantage that if something goes wrong with the stepper controller, the Commander will be protected. Also, as the stepper driver communicates through USB, this sub system has to support a USB-host. Refer to figure 5.35.

Figure 5.35: ACT Commander Stepper driver block diagram.

5.6.1

Schematic

In figure 5.36, the input connectors are shown. The two power connectors and a 34 pin IDC connector to the Commander. The pins referred to as External will be, indirectly, connected to the stepper drivers.

(48)

5.6. ACT Commander Stepper driver 35

Figure 5.36: Input connectors.

As the current output from the MCU is quite limited, it cannot drive the optocoupler without a buffer circuit. To reduce the current output of the pin, it will drive the base of an ordinary bipolar transistor, see figure 5.37.

Figure 5.37: Buffer circuit for optocouplers.

The stepper motor in Y-axis has a brake that has to be released when the machine is moving. The 10 W brake is released if 24 V is connected to it. The simplest way of controlling the brake is a relay, see figure 5.38. The relay is controlled by the MCU via a buffer circuit and an optocoupler.

(49)

Figure 5.38: Relay subcircuit.

The optocoupler in figure 5.39 is in principle a light source and a photosen-sitive transistor. This means that the input and output of the optocoupler has no galvanic connection.

Figure 5.39: Dual optocoupler pinout.

There is also a buffer circuit connected to the output of the optocoupler, figure 5.40, this because the optocoupler has a limited output.

Figure 5.40: Output buffer circuit.

To communicate with the stepper motor controller USB is used. Instead of using a microcontroller and implement the whole USB host stack, a finished USB host controller is bought. The controller is called VDIP2 and is design to fit a 40 pin DIP socket [19]. Figure 5.41 shows the schematic of the VDIP2, only the 5 V is connected. The reason for this is that the footprint is modified. Refer to the Layout-section.

(50)

5.6. ACT Commander Stepper driver 37

Figure 5.41: VDIP2 pinout.

As the VDIP2 communicates transparently via UART, a RS232 transceiver has to be included as the voltage levels have to be TTL, see figure 5.42.

Figure 5.42: RS232 level transceiver circuit.

Figure 5.43 shows a number of connectors including the connectors intended for the stepper motor driver I/O-ports and the brake for both X and Y axes. There is no brake on the X-axis motor, but it has been included anyway.

(51)

Figure 5.43: Output connectors.

5.6.2

Layout

The layout shows the placements of the components, see figure 5.44. The foot-print has two pairs of pads for each pin on the VDIP2, this because headers could be soldered side by side with VDIP2. The VDIP will then be connected by cables. The reason for this is that the time for designing this PCB is quite limited.

(52)

Chapter 6

Programming

As the work requires some programming this chapter will need to handle the theory behind the code. The reader will get a quick view of what has been done in the thesis in terms of programming.

6.1

Existing software

Quite a large and useful library of different modules is provided by Whirlpool, written in C. As the target processor is in the same STM32 family the code could be used without major alterations. The operating system, which is developed by Whirlpool, is quite easy to adapt - allowing new modules to be included without major issues.

6.1.1

Modules

A module could be seen as an application above the operating system. While the operating system handles the modules, the modules handle hardware functions such as UART, GPIO.

Some of the modules provided by Whirlpool could be used directly, but as the hardware constructed in this thesis is different from the hardware made by Whirlpool, remapping of a few pins is required. Fortunately, this is easily done as alternate pin mapping is already defined in the source code for each module.

6.1.2

Disclaimer

Due to confidentiality reasons, the source code for the modules will not be published in this report.

6.2

Operating system

The operating system is based on the state machine principle [20]. There are, in total, six possible states that the operating system will jump through. The first state, the initialization state, is active when the microcontroller is started. In this state, the different modules are initialized. Once the initialization is

(53)

finished, the operating system jumps to the next state, in figure 6.1 referred to as 1.

Figure 6.1: Principle of the operating system.

There are five slots that the operating will jump between once the modules have been initialized. Each slot will call different functions that the MCU will run through. During a state transition a 5 ms timer is started. When the timer reach 5 ms the system jumps to next state. This means that the cycle time is approximately 25 ms, see table 6.1.

State Type Description

0 Initialization Start various modules

1 Slot 1 Perform tasks between 0 - 5 ms 2 Slot 2 Perform tasks between 5 - 10 ms 3 Slot 3 Perform tasks between 10 - 15 ms 4 Slot 4 Perform tasks between 15 - 20 ms 5 Slot 5 Perform tasks between 20 - 25 ms

Table 6.1: The timed slots.

If no tasks are scheduled in a certain slot, or if the tasks are performed in less than 5 ms, the operating system will enter a free running subslot. The subslot is part of each state and could be occupied with tasks, but they will only be performed if there is time. Therefore, a time critical task has to be performed in a timed slot.

6.3

Stepper controller communication

To be able to send data to the stepper motor driver from the Commander, a USB-host is required as the stepper motor driver is USB-based. By sending

(54)

6.3. Stepper controller communication 41

predefined commands, the controller will enter different modes, such as run the motor or return parameters. Using an ordinary computer this would be quite simple as the computer will emulate the stepper motor driver as a virtual COM-port. The ACT Stepper driver hardware supports a USB-host, but this host has to be reprogrammed in order to work. Another solution is to define a serial protocol and by using the stepper driver’s input and output pins, the Commander is able to communicate with the stepper driver. The stepper driver support JVM (Java Virtual Machine), allowing user defined functionality using Java as programming language. The implementation of the master code is done in C in the ACT Commander, while the slave code is developed in Java for the stepper driver. The manufacturer of the stepper motor driver supplies free development tools for this [21].

6.3.1

Specification

The stepper driver has limitations in terms of general purpose I/Os. There are, in total, six digital inputs, one analogue input and three outputs. This could be seen as an issue if a parallel communication protocol should be used. Basically, there would be two inputs available for this parallel communication protocol, as there are other signals that will occupy the other inputs. Such as, limit switches, start signal and emergency stop signal.

The only reasonable solution to this would be a two wire serial communica-tion protocol.

As the Commander controls the dedicated functions in the ACT system, the stepper motor drives will be configured as slaves and the Commander would be the master unit. In other words, it will not be a multi master serial protocol, which will result in a protocol less complex than if it would be multi master.

For basic functionality, the serial protocol would consist of two wires, clock and data. With this, data transmission in one direction is possible, due to limitations in the stepper drivers as the I/O direction is static to either input or output.

If the protocol ought to have multi master characteristics, the direction of the I/O ports would need to be altered in order to have some sort of sense on the clock signal. Both units would listen to the clock signal, in other words, the ports would need to be configured as input. Both units could then initiate communication by setting the I/O-direction to output and hijack the clock and it would become a sort of multi master serial protocol.

But in this case, as the I/O direction is fixed, the protocol needs to be changed accordingly. Again, the goal is not a multi master protocol, so the master must gather the desired data from an additional data line in the opposite direction, from the slave to the master. The master still handles the clock, but instead of sending, it receives data.

Using this three wire serial protocol, data could be sent in both directions. But the master would not know if the correct data has been received by the slave and if the slave is in the desired state. For example, if the master sends a start condition, it does not know whether or not the slave has responded and is waiting for further data to be received. In some protocols, preferably, a two wire serial protocol, it is assumed that the data has been received.

But in this protocol, this will not be assumed by the simple reason that there are no requirements that the protocol should only use three wires. As there are

(55)

three digital outputs, eight different states could be read by the master. By using this as a state machine, the master could determine if the slave is in the correct state. And take action if it is not. This means that the protocol would support error handling.

If one of these eight states, see table 6.2, indicate that the slave has processed one data bit in the serial data stream and is ready to receive next bit, this could be used to determine the frequency of the clock. It would mean that there would be a type of handshake after each received bit and the baud rate would be determined by how fast the unit respond. Therefore, the baud rate would always be maximized for each instant, as the delay until the unit respond could differ depending on the work load of the unit.

Output Pin 3 Pin 2 Pin 1

Idle state 0 0 0

Busy state 0 0 1

Ready to Receive/Transmit Data 0 1 0

Ready to travel 0 1 1

Overheat 1 0 0

Error Limit Switch 1 0 1

Error Limit Switch (origin) 1 1 0

Error state 1 1 1

Table 6.2: State definition.

To simplify the algorithm further, the communication would be only master to a single slave. So there would be no need for any type of addressing to the slave. Table 6.3 shows the input pin configuration of the stepper motor driver.

Signal identity Input pin

Serial Clock 1

Serial Data 2

Emergency Stop/Reset 3

Start 4

End switch 5

End switch (origin) 6 Table 6.3: Input pin description.

Based on the discussion, the protocol could be visualized, see figure 6.2. In master transmission mode, the master has to tell the slave that the master is going to send data. This is done with the clock signal. When in idle mode, the clock is low, once the clock is switching to high data transmission will commence. The slave will sample the data bit a number of times to determine if the bit is a 0 or 1. This is done in the busy state, and when the slave is ready for next data bit the slave jumps to the state, ready to receive data.

(56)

6.3. Stepper controller communication 43

Figure 6.2: Master transmission.

In reception mode, the master has to ask the slave to send data. Therefore the master will begin with sending an instruction to the slave that tells the slave to send the data that has been asked for. The reception is clocked by the master, see figure 6.3.

Figure 6.3: Master reception.

6.3.2

Data stream

Implementing this serial communication requires that the data must be sent in a certain pattern. The first data set is the instruction that tells the slave what to do next. If the machine is going to be instructed to travel to another position, the data stream will start with an instruction that tells the slave that the following data will be travel speed and position, see figure 6.4.

Figure 6.4: Serial data stream.

The travel speed is calculated so the two axes will reach the destination simultaneously, independent on the last position. This is done by identifying what axis has the longest distance to the new position, then setting the speed

(57)

of this axis to 100 % of max speed, and then calculate the percentage of the distance of the other axis. For example, if the distance is half of the other axis, the speed is set to 50 %.

6.4

Display font

A module for the display is provided by Whirlpool, so no low level routines have to be implemented for the LCD display. Although this code was provided, no fonts were supplied as they are stored in an external EEPROM. During proto-typing, fonts are stored in the MCU instead of programmed into the external memory. The fonts have to be generated, not coded by hand because it would take a lot of time. A simple solution is to store the fonts in a monochrome bitmap picture, import the picture in MATLAB, decode the picture in a certain pattern and generate source code ready to be compiled. The tokens are written in Notepad following the table, so each token correspond to its ASCII-value. The text is then stored as a picture by print screen, opened in MS-Paint, and resized. The height of the picture is 17 pixels, where the bottom pixel row define the width of each token, see figure 6.5.

Figure 6.5: Font bitmap.

The picture is decoded as in figure 6.6. Each column is 8 pixels high. The column will then correspond to a byte value, where a black pixel is 0 and a white pixel is 1. The bottom pixel is the least significant bit.

Figure 6.6: Font decoding. The MATLAB script can be found in Appendix A.1.

(58)

Chapter 7

Results

In this chapter results are presented. The system design and design of the machine will be shown.

7.1

Embedded system design

The prototype system is manufactured and tested to verify that the hardware is functioning as expected. The design of the embedded system is a large part of the thesis, making the work quite hardware oriented.

7.1.1

ACT Power supply

The manufactured PCB, seen in figure 7.1, has been covered with solder mask to protect the copper layer from oxidation. The PCB design is quite simple making the etching less critical as the copper wires are quite thick compared to other subsystems where the wires are thin and where the etching becomes very critical.

Figure 7.1: Finished ACT Power supply.

Before components are soldered, the PCB is electrically verified using a

(59)

simple multi meter. As the design is quite simple with large holes and pads, the copper plating is not an issue. The components are soldered, the finished subsystem is shown in figure 7.2. The finished PCB is connected to 24 V and the voltages are checked. Everything works as expected.

Figure 7.2: ACT Power supply with components.

7.1.2

ACT Commander

The choice of using the same MCU-core paid out well. The Commander schematic is partly based on a schematic provided by Whirlpool, so major flaws in this design could be eliminated on schematic level. The PCB manufacturing process is quite a critical part of the design as the clearance and wire width are small. This require that the etching has to be carried out with caution, as there is quite a large risk that the wires could be etched away as they are thin, destroying the whole PCB. To increase the likelihood that a correct PCB is made is to manufac-ture many PCBs. In total, eight Commander PCBs are manufacmanufac-tured, making three recoverable. None of the PCBs could be used without repair. Mainly, the copper plated vias are etched away, which has to be repaired by solder a small wire through the via connecting the bottom and top copper layer.

Figure 7.3: ACT Commander PCB.

The components are soldered by hand, figure 7.4, this is not recommended as the pads are quite small. The Commander is verified using a multi meter to assure that the soldering has been successful. The pins on the MCU are quite difficult to solder, as the clearance between the pads are so small. Some of the pins on MCU had to be soldered twice as they did not get connected to the pad the first time.

(60)

7.1. Embedded system design 47

Figure 7.4: ACT Commander with components.

To accommodate the edge connectors the plastic cover is modified as some small details needs cutting out. On the back side, the eleven pin programming header is placed, see figure 7.5.

(61)

7.1.3

ACT Peripheral systems

Three subsystems are used to extend the Commander, see figure 7.6. The three PCBs are made in the same way as the PSU and Commander, with two copper layers. The clearances and wire widths are not as small as the Commander, making the etching less critical.

(a) ACT Commander Connector. (b) ACT Commander Communicator.

(c) ACT Commander Stepper driver.

Figure 7.6: ACT Peripheral systems PCB.

The three systems are soldered by hand. As most of the components are through-hole mounted the soldering is quite easy. Again, as the function of these subsystems are defined by software and the thesis will not cover much software design, the systems can only be verified electrically using for example a multi meter. The connector for RS232 has been used to test if UART is working, which it is. The manufactured and soldered PCBs are shown in figure 7.7

References

Related documents

Vzhledem k tomu, že vstupní napětí řídícího obvodu je většinou výrazně vyšší, než je jmenovité napětí vinutí motoru, může být proud, měřený

A microstepping driver such as the A4988 allows higher resolutions by allowing intermediate step locations, which are achieved by energizing the coils with intermediate current

With the phase current table, control of a stepper motor is simply a matter of increasing or decreasing the Step Angle Number to move around the phase diagram of figure 5.. This

46 Konkreta exempel skulle kunna vara främjandeinsatser för affärsänglar/affärsängelnätverk, skapa arenor där aktörer från utbuds- och efterfrågesidan kan mötas eller

The increasing availability of data and attention to services has increased the understanding of the contribution of services to innovation and productivity in

Närmare 90 procent av de statliga medlen (intäkter och utgifter) för näringslivets klimatomställning går till generella styrmedel, det vill säga styrmedel som påverkar

I dag uppgår denna del av befolkningen till knappt 4 200 personer och år 2030 beräknas det finnas drygt 4 800 personer i Gällivare kommun som är 65 år eller äldre i

Detta projekt utvecklar policymixen för strategin Smart industri (Näringsdepartementet, 2016a). En av anledningarna till en stark avgränsning är att analysen bygger på djupa