You are on page 1of 46

King Fahd Universit y of Pet roleum & Minerals

Syst ems Engineering Depart ment












CI SE 412: Mechat ronics

Lab Manual

( Term 092)




Dr. Samir Al- Amer







2010
Table of Cont ent s
Lab # 1: Component Information Gathering ................................................................. 3
Lab # 2: Modeling and Controller Design of Magnetic Levitation System .................. 6
Lab # 3-4: Modeling and Controller Design of Magnetic Levitation System ............ 18
Lab # 5: Design and Implementation of Operational Amplifier Circuits .................... 29
Lab # 6: Introduction to Boe-Bot ................................................................................. 41
Lab # 7: Servomotors for the Boe-Bot ........................................................................ 42
Lab # 8: Assembling and Testing the Boe-Bot ........................................................... 43
Lab # 9: Basic Boe-Bot Navigation ............................................................................ 44
Lab # 10: Boe-Bot Navigation with Whiskers ............................................................. 45
Lab # 11: Boe-Bot Navigation with Photoresistors ..................................................... 46

CI SE 412: Mechat ronics
Term 092

LAB # 1: Component I nf or mat i on Gat her i ng
Obj ect i v e:
The obj ect ive of t his lab is t o pract ice gat hering t echnical
informat ion about different t ypes of component s used in
Mechat ronic Syst ems.

I nt r oduct i on:
An import ant st ep in t he design of mechat ronic syst ems is t o gat her
t echnical informat ion about component s t hat can be used in design
of a syst em. I n t his lab session you will pract ice collect ing
informat ion and select ing component s t o sat isfy some const raint s.
This involves reading dat a sheet s and ext ract ing informat ion from
t hem.

Part 1:
Using I nt ernet search, obt ain t he dat a sheet s for t he following
component s. Use t he dat a sheet t o provide t he required dat a.




1. Provide t he following informat ion about TTL 7400 ( or 74ACT00)

The purpose of t his I C
Sket ch t he I C pin- out ( DI P if available)
Temperat ure operat ing range
Supply volt age ( min max)
I nput Volt age level for OFF ( low)
I nput Volt age Level for ON ( high)
Out put Volt age level for OFF ( low)
Out put Volt age Level for ON ( high)
High level input current
Low level input current
Typical propagat ion delay
A company t hat produce such I C. ( Name- address)

2. Provide a CMOS I C t o do t he funct ion similar t o t he TTL 7400 and
provide t he same informat ion asked for in ( 1) .














Par t 2
I n t he following, you need t o search for and provide informat ion
about several component s. I n some cases a specific name
( component number) is provided. I n ot her cases a general name
indicat ing t he funct ion of t he component is provided. You are asked
t o do a search on t he int ernet t o get more det ails about t hose
component s.
There could be many component s t o do t he required j ob. Provide
informat ion about one such component .

Required informat ion include t he company providing t he
component , URL locat ion for specificat ion sheet if available , Pin-
out diagram, component number
How does it work? How much does it cost ?



1. 4- digit LED display unit t hat can be used t o display 0,1, 2, .. 9.
2. SN7490 Decay Count er
3. LM7414 Schmit t Trigger ( How does i t w or k ?)
4. NE555 t imer. ( How does i t w or k ?)
5. Opt ical I solat or TTL, DI P format
6. 0. 25 W resist ors DI P resist or ( 8 resist ors, 10 M ohm if
available)
7. Pot ent iomet er ( rot ary t ype , power rat ing < 5 W, Rot at ion
Angle> 200 degrees)
8. 12- bit DAC
9. Toggle Swit ches ( lower power, volt age < 20V, small size,
ON- OFF)
10. Keypads ( 4X4 , small size)
11. Speed and posit ion t ransducer ( Shaft Encoder) ( < 100
pulse/ rev)








Groups of 2 can work on t his lab proj ect
Soft copy of t he report can be submit t ed t hrough webCT.
Due dat e for submission is t he beginning of t he next lab.


CI SE 412: MECHATRONI CS
( Term 092)
Lab # 2: Model i ng and Cont r ol l er Desi gn of
Magnet i c Levi t at i on Sy st em

Equi pment Needed
+ PC w i t h MATLAB and SI MULI NK

I nt r oduct i on:
Magnet ic levit at ion syst em finds applicat ions in engineering
including aerospace, high speed t ransport at ion syst em, levit at ed
micro- robot ics, magnet ic levit at ed aut omot ive engine valves,
magnet ic bearings. Cont rol and ident ificat ion of magnet ic levit at ion
syst em physical syst em is challenging research problem as t he
syst em is nonlinear and unst able [ 1- 4] . From educat ional point of
view t he magnet ic levit at ion provides a t est bed for learning
cont roller design as it is unst able and nonlinear and must be
operat ed in a closed loop [ 1] . There are a number of ot her physical
syst ems which are unst able and must be operat ed in closed loop
such as an aircraft , helicopt er, invert ed pendulum ( e. g. Segway) ,
posit ion cont rol syst em, liquid level process cont rol. However t he
maglev syst em has poles st rict ly in t he right half plane syst em
whereas t he above st at ed syst ems have poles at t he origin ( each
behaves as an int egrat or) and hence poses difficult ies in t he design
of a robust cont roller and it s implement at ion.
Obj ect i ve:
The obj ect ive of t his lab is as follows:
- Model t he maglev syst em using t he physical laws governing
t he elect ro- magnet ic circuit s, and Newt on laws laws of
mot ion.
- Design an analog/ digit al cont roller.
- Evaluat e t he performance of t he closed loop cont rol syst em in
t ime domain ( set t ling t ime, overshoot and cont rol input
magnit ude, and in frequency domain including t he
bandwidt h, resonance frequency and resonance peak.
- I t erat e t he design t ill t he cont roller performance is accept able
for implement at ion

Model i ng of a Magnet i c Levi t at i on Sy st em
We will use physical laws governing t he at t ract ive force generat ed
by t he int eract ion of t he elect romagnet ic field and an iron ball, and
t he result ing mot ion by t he Newt ons Law. Consider a magnet ic
levit at ion shown in Fig. 1. I t consist s of an elect romagnet which
produces a magnet ic field t hat at t ract s an iron ball. The vert ical
mot ion of t he ball is measured by an opt ical syst em.


Fig. 1. MAGLEV syst em
Elect romagnet ic force

A magnet ic mat erial such as an iron ball placed in t he magnet ic field
will experience a force, f, due t o at t ract ion bet ween t he magnet ic
poles, one in t he elect romagnet ic and t he ot her induced in t he
magnet ic mat erial as shown in t he Fig. 2.


Fig. 2. Force in t he magnet ic mat erial placed in a magnet ic field

The at t ract ive force on t he iron ball, F, is
( )
2 2
2
0
2
N Ai
F
X

=
+

where N is t he number of t urn of t he coil, A is t he area of t he
elect romagnet ic, i is current in t he coil which creat es t he magnet ic
field,
0
X = + is t he lengt h of t he magnet ic pat h, X is t he dist ance
bet ween t he iron ball and t he elect romagnet and
0
is t he lengt h of
t he magnet ic pat h in t he magnet ic mat erials of t he elect ro- magnet ic
and t he iron ball.
The direct ion of t his force is vert ically upwards.
Comment s: Applicat ions of t he force bet ween t he flux and a
magnet ic mat erial include t he following:
- Magnet ic levit at ion t rain ( t he t rain levit at es t hanks t o t he
force experience by t he elect romagnet at t ached t o t he t rain
and t he ferrous rail) .
- magnet ic bearing ( rot at ing shaft is suspended in a circular
magnet ic field so t hat t he rot at ing shaft does not t ouch any
component t hereby eliminat ing frict ion)
- Elect romagnet ic swit ches, e. g. solenoids , relays. Solenoids
are inexpensive and are used in lat ching, locking. Examples
include aut omobile door lat ches and st art er solenoids,
opening and closing of valves in washing machines, relays in
power syst ems. I t has advant age over semiconduct or
swit ches as it can handle very large current s, and t he circuit
cont rolling t he elect romagnet ic swit ches is isolat ed
- St epper mot or and reluct ance mot ors

x
magnet
ic
magnet ic
flux
coil
current ,
Model of t he coil: curr ent I and t he volt age V
=


Fig. 3 RL circuit
Consider t he coil of t he elect romagnet shown in Fig. 3. Let R be t he
resist ance and L be t he induct ance.
Ver i f y t hat t he different ial equat ion governing applied volt age t o
t he coil and t he current t hrough t he coil is
di
L Ri V
dt
+ =

Ver i f y t hat t he t ransfer funct ion relat ing V and i is given by
( ) 1 1/
( ) 1
i s R L
where
V s Ls R s R
t
t
= = =
+ +

The elect romagnet ic coil is generally designed t o have very low
resist ance t o reduce t he power loss
2
i R and t hereby reduce t he heat
generat ed. I n pract ical syst ems such as magnet ron part icle
accelerat ors and magnet ic levit at ion syst ems very low t emperat ure
( cryogenic) is creat ed t o reduce t he resist ance and hence t he heat
loss.
As / L R is negligible t he induct ance may be neglect ed, and t hus t he
relat ion bet ween t he volt age and t he resist ance, R is a simple st at ic
equat ion
V
i
R
=

R
L
i
+

V

_
+
V
_
Comment : The model of a RL circuit of an elect romagnet is a first
order syst em wit h a t ime const ant
L
R
t = since t he t ime const ant t is
very small, it is neglect ed. I n modeling of syst ems and in cont roller
design, neglect ing very low t ime const ant syst ems is t ermed as
unmodelled dynamics or model reduct ion. I n ot her words t he
t ransfer funct ion of t he coil is approximat ed:
( ) 1/ 1
( ) 1
i s R
V s s R t
= ~
+

I n pract ice it is common t o neglect fast dynamics and an
approximat e reduced order model so as t o simplify t he design of
cont roller wit hout affect ing t he performance.

Wit h t his approximat ion, t he vert ical force on t he iron ball becomes

( )
2 2
2 2
0
2
N A V
F
R
X

=
+


Model of t he maglev syst em using Newt ons law of mot ion
Consider t he iron ball. Let m be t he mass of t he ball. Using
Newt ons law of mot ion ( mass t imes t he accelerat ion equals t he net
force) , t he force and t he dist ance are relat ed by t he following
different ial equat ion
mX F mg =


Subst it ut ing for t he force F and simplifying we get
( )
2
2
0
V
X k g
X
=
+


where
2
2
2
N A
k
mR

=


Equilibrium point

There is a upward force, F, on t he iron ball and t here is a downward
force due t o gravit y, mg. The quest ion arises as t o where will t he
iron ball go. Will it fall down, will it be at t ract ed upwards and crash
on t he elect romagnet or it will remain at some locat ion where t he
upward force will balance t he downward force. The answer t o t his
quest ion will depend upon t he equi l i br i um poi nt also t ermed t he
si ngul ar poi nt of t he different ial equat ion. The equilibrium point is
obt ained by set t ing all t he derivat ives, first order, second and
higher order derivat ives t o zero. I n t his case we only have second
order derivat ive. Set t ing it t o zero yields t he equilibrium point ,
0
X ,
is obt ained from
( )
2
0
2
0 0
0
V
k g
X
=
+

where
0
V is t he volt age applied.
( )
2
0
2
0
0
V
k g
X
=
+

The equilibrium point ,
0
X , is given by
0 0
k
X L V
g
+ =
Subst it ut ing for k we get
0
2
VR A
X L
N mg

+ =

Linearizat ion of t he Differ ent ial Equat ion
Consider t he different ial equat ion model
( , ) X f X V g =


where
2
2
( , )
V
f X V k
X
=
I t is second order nonlinear syst em. For designing a cont roller, a
linear approximat e model is employed as it is very difficult t o design
a cont roller for a nonlinear syst em. A linear approximat ion is
obt ained by linearizing t he nonlinear funct ion, ( , ) f X V about t he
equilibrium point ,
0
x and t he nominal volt age input ,
0
V , using
Taylors series
( ) ( )
0 0 0
0 0 0 0
, ,
( , ) ( , )
o
X X V V X X V V
df df
f X V f X V X X V V
dX dV
= = = =
~ + +
This approximat ion is valid for small variat ions of X about
0
X ,
0
X X se, and V V se.
Ver i f y t hat t he expression for linear approximat ion
of ( , ) f X V becomes
( ) ( )
( )
( )
( )
2 2 2
0 0 0
0 0 2 3
0
0 0
2
( , ) 2
kV V kV
f X V k X X V V
X L
X L X L
= +
+
+ +


Let us define
0
x X X = and
0
u V V = ,. Using t his definit ion we get
( ) ( ) ( )
2 2
0 0 0
2 3 2
0 0 0
2
( , ) 2
kV V kV
f X V k x u
X L X L X L
= +
+ + +

Since
( )
2
0
2
0
V
g k
X L
=
+
we get
( , ) f X V g x u o | = +
where
( ) ( )
2
0 0
2 2
0 0
2
2 ,
V kV
k
X L X L
o | = =
+ +

Subst it ut ing t he nonlinear funct ion by it s linear approximat ion in
( , ) X g f X V =


we get
x x u o | =
The above is a linear approximat ion model of t he nonlinear maglev
syst em. This approximat ion is valid for excursion in t he
neighborhood of
0
X and
0
V ,
x se and u se
Taking t he Laplace t ransform, t he t ransfer funct ion relat ing x and u
becomes
2
( )
( )
( )
x s
G s
u s s
|
o
= =


The syst em is unst able as t here is pole in t he right half of t he s-
plane. The poles, p, of t he plant are real and are symmet rically
locat ed about t he imaginary axis
p o =

Analysis of t he open loop syst em
St abilit y analysis
The syst em is unst able as t here is pole in t he right half of t he s-
plane. The poles, p, of t he plant are real and are symmet rically
locat ed about t he imaginary axis
p o =
The poles are symmet rically locat ed about t he imaginary axis in t he
s- plane.
St ep response
Ver i f y t hat t he st ep response will be unbounded and is given by
( )
1 1
( ) 1
2
t t
x t e e
o o
o

(
= +
(


The st ep response is unbounded.
=

) ( lim t x
t

Frequency response
Consider t he t ransfer funct ion, ( ) G s . Set t ing s je = t he frequency
response becomes
2
( ) 1
( )
( )
x j
G j
u j
e
e
e e o
= =
+

The frequency response is real and posit ive for all frequencies
t hanks t o t he symmet ric locat ion of t he poles.

This shows t hat one can analyze t he maglev syst em using
frequency response and not st ep response.
Design of cont r oller

Cont roller st ruct ure and cont roller design approach
There are a number of choices of cont roller st ruct ures including,
proport ional int egral derivat ive ( PI D) cont roller, lead- lag
compensat or, and st at e feedback cont roller and number of
approaches for designing a cont roller.

The maglev syst em in t he laborat ory has lead- lag compensat or.
Hence we will choose a lead- lag compensat or. As for t he design
approach we will choose a simple approach based on pole-
placement .
The lead- lag compensat or, C( s) , t akes t he general form
( )
s b
C s k
s a
+ | |
=
|
+
\ .

Closed loop syst em
Since t he plant , G( s) is unst able it must be operat ed in a closed
loop configurat ion formed of t he plant G( s) and t he cont roller, C( s)
as shown in Fig. 4 below.

e u x r
C( s G( s
Fig. 4. Closed loop syst em formed of t he plant G( s) and t he
cont roller, C( s)

The close loop t ransfer funct ion relat ing t he reference input , r and
t he plant out put , x is given by
( ) ( ) ( )
( ) 1 ( ) ( )
x s G s C s
r s G s C s
=
+

Subst it ut ing for G( s) and C( s) t he closed loop numerat or
polynomial, N( s) and denominat or polynomial ( also t ermed
charact erist ic polynomial) , D( s) become
( ) ( ) N s k s b | = +
( )( ) ( )
2
( ) D s s a s k s b o | = + +
Consider t he charact erist ic polynomial, D( s) . Simplifying yields
3 2
( ) ( ) D s s as s k a k b o | o | = + +
Design using pole- placement approach
We will use pole- placement approach t o design t he cont roller, C( s) ,
t hat is obt ain t he cont roller paramet ers, k, a and b.
- Choice of desired pole locat ion
The closed loop syst em is of t hird order. Let us choose for
convenience all poles t o be equal t o p.
Ver i f y t hat t he desired charact erist ic polynomial, ( ) s
becomes
( )
3
3 2 2 3
( ) 3 3 s s p s s p sp p = + = + + +
- Equat e t he act ual charact erist ic polynomial and t he desired
charact erist ic polynomial
( ) ( ) D s s =
Subst it ut ing for D( s) and ( ) s yields
3 2 3 2 2 3
( ) 3 3 s as s k a k b s s p sp p o | o | + + = + + +
- Solve for t he unknown cont roller paramet ers, k, a, and b by
equat ing t he coefficient s of t he equal powers of s.
Ver i f y t hat t he solut ion of t he equat ions yields
3
2
2
3
3
3
a p
p p
b
p
p
k
o
o
o
|
=
+
=
+
+
=


Del i ver abl es

Each st udent should submit a word file cont aining t he following:
- Verificat ion of marked expressions.
- The mat hemat ical model of maglev syst em
- Analysis of t he linear approximat ion model of t he Maglev
syst em in t ime and frequency domain using SI MULI NK.
- Evaluat ion of t he performance

REFERENCES
[ 1] Galvo, R. K. H. , Yoneyama, T. , Araj o, F. M. U., Machado, R.
G. A Simple Technique for I dent ifying a Linearized Model for a
Didact ic Magnet ic Levit at ion Syst em . I EEE Transact ions on
Educat ion, v. 46, n. 1, p. 22- 25, 2003.
[ 2] K. Pet erson, J. W.Grizzle, and A.G. St efanpolou, Nonlinear
magnet ic levit at ion of aut omot ive engine valves
[ 3] David Craig and Mir Behrad Khamesee, Black box model
ident ificat ion of a magnet ically levit at ed microrobot ic syst em Smart
Mat erials and St ruct ures, 16, 2007, pp. 739- 747

CI SE 412: MECHATRONI CS ( Term 082)
Lab # 3: Model i ng and Cont r ol l er Desi gn of
Magnet i c Levi t at i on Sy st em


I nt r oduct i on:
Magnet ic levit at ion syst em finds applicat ions in engineering
including aerospace, high speed t ransport at ion syst em, levit at ed
micro- robot ics, magnet ic levit at ed aut omot ive engine valves,
magnet ic bearings. Cont rol and ident ificat ion of magnet ic levit at ion
syst em physical syst em is challenging research problem as t he
syst em is nonlinear and unst able [ 1- 4] . From educat ional point of
view t he magnet ic levit at ion provides a t est bed for learning
cont roller design as it is unst able and nonlinear and must be
operat ed in a closed loop [ 1] . There are a number of ot her physical
syst ems which are unst able and must be operat ed in closed loop
such as an aircraft , helicopt er, invert ed pendulum ( e. g. Segway) ,
posit ion cont rol syst em, liquid level process cont rol. However t he
maglev syst em has poles st rict ly in t he right half plane syst em
whereas t he above st at ed syst ems have poles at t he origin ( each
behaves as an int egrat or) and hence poses difficult ies in t he design
of a robust cont roller and it s implement at ion.

Obj ect i ve:
The obj ect ive of t his lab is as follows:
- Model t he maglev syst em using t he physical laws governing
t he elect ro- magnet ic circuit s, and Newt on laws laws of
mot ion.
- Design an analog/ digit al cont roller.
- Evaluat e t he performance of t he closed loop cont rol syst em in
t ime domain ( set t ling t ime and overshoot , cont rol input
magnit ude, and in frequency domain including t he
bandwidt h, resonance frequency and resonance peak.
- I t erat e t he design t ill t he cont roller performance is accept able
for implement at ion

Model i ng of a Magnet i c Levi t at i on Sy st em
We will use physical laws governing t he at t ract ive force generat ed
by t he int eract ion of t he elect romagnet ic field and an iron ball, and
t he result ing mot ion by t he Newt ons Law. Consider a magnet ic
levit at ion shown in Fig. 1. I t consist s of an elect romagnet which
produces a magnet ic field t hat at t ract s an iron ball. The vert ical
mot ion of t he ball is measured by an opt ical syst em.


Fig. 1. MAGLEV syst em
Elect romagnet ic force

A magnet ic mat erial such as an iron ball placed in t he magnet ic field
will experience a force, f, due t o at t ract ion bet ween t he magnet ic
poles, one in t he elect romagnet ic and t he ot her induced in t he
magnet ic mat erial as shown in t he Fig. 2.


Fig. 2. Force in t he magnet ic mat erial placed in a magnet ic field

The at t ract ive force on t he iron ball, F, is
( )
2 2
2
0
2
N Ai
F
X

=
+

where N is t he number of t urn of t he coil, A is t he area of t he
elect romagnet ic, i is current in t he coil which creat es t he magnet ic
field,
0
X = + is t he lengt h of t he magnet ic pat h, X is t he dist ance
bet ween t he iron ball and t he elect romagnet and
0
is t he lengt h of
t he magnet ic pat h in t he magnet ic mat erials of t he elect ro- magnet ic
and t he iron ball.
The direct ion of t his force is vert ically upwards.
Comment s: Applicat ions of t he force bet ween t he flux and a
magnet ic mat erial include t he following:
- Magnet ic levit at ion t rain ( t he t rain levit at es t hanks t o t he
force experience by t he elect romagnet at t ached t o t he t rain
and t he ferrous rail) .
- magnet ic bearing ( rot at ing shaft is suspended in a circular
magnet ic field so t hat t he rot at ing shaft does not t ouch any
component t hereby eliminat ing frict ion)
- Elect romagnet ic swit ches, e. g. solenoids , relays. Solenoids
are inexpensive and are used in lat ching, locking. Examples
include aut omobile door lat ches and st art er solenoids,
opening and closing of valves in washing machines, relays in
power syst ems. I t has advant age over semiconduct or
swit ches as it can handle very large current s, and t he circuit
cont rolling t he elect romagnet ic swit ches is isolat ed
- St epper mot or and reluct ance mot ors

x
magnet
ic
magnet ic
flux
coil
current ,
Model of t he coil: current I and t he volt age V
V
i
R
L

Fig. 3 RL circuit

Consider t he coil of t he elect romagnet shown in Fig. 3. Let R be t he
resist ance and L be t he induct ance. The different ial equat ion
governing applied volt age t o t he coil and t he current t hrough t he
coil is
di
L Ri V
dt
+ =
The t ransfer funct ion relat ing V and i is given by
( ) 1 1/
( ) 1
i s R L
where
V s Ls R s R
t
t
= = =
+ +

The elect romagnet ic coil is generally designed t o have very low
resist ance t o reduce t he power loss
2
i R and t hereby reduce t he heat
generat ed. I n pract ical syst ems such as magnet ron part icle
accelerat ors and magnet ic levit at ion syst ems very low t emperat ure
( cryogenic) is creat ed t o reduce t he resist ance and hence t he heat
loss.
As / L R is negligible t he induct ance may be neglect ed, and t hus t he
relat ion bet ween t he volt age and t he resist ance, R is a simple st at ic
equat ion
V
i
R
=

Comment : The model of a RL circuit of an elect romagnet is a first
order syst em wit h a t ime const ant
L
R
t = since t he t ime const ant t is
very small is very small, it is neglect ed. I n modeling of syst ems and
in cont roller design, neglect ing very low t ime const ant syst ems is
t ermed as unmodelled dynamics or model reduct ion. I n ot her
words t he t ransfer funct ion of t he coil is approximat ed:
( ) 1/ 1
( ) 1
i s R
V s s R t
= ~
+

I n pract ice it is common t o neglect fast dynamics and an
approximat e reduced order model so as t o simplify t he design of
cont roller wit hout affect ing t he performance.

Wit h t his approximat ion, t he vert ical force on t he iron ball becomes

( )
2 2
2 2
0
2
N A V
F
R
X

=
+


Model of t he maglev syst em using Newt ons law of mot ion
Consider t he iron ball. Let m be t he mass of t he ball. Using
Newt ons law of mot ion ( mass t imes t he accelerat ion equals t he net
force) , t he force and t he dist ance are relat ed by t he following
different ial equat ion
mX F mg =


Subst it ut ing for t he force F and simplifying we get
( )
2
2
0
V
X k g
X
=
+


where
2
2
2
N A
k
mR

=


Equilibrium point

There is a upward force, F, on t he iron ball and t here is a downward
force due t o gravit y, mg. The quest ion arises as t o where will t he
iron ball go. Will it fall down, will it be at t ract ed upwards and crash
on t he elect romagnet or it will remain at some locat ion where t he
upward force will balance t he downward force. The answer t o t his
quest ion will depend upon t he equilibrium point also t ermed t he
singular point of t he different ial equat ion. The equilibrium point is
obt ained by set t ing all t he derivat ives, first order, and second and
higher order derivat ives t o zero. I n t his case we only have second
order derivat ive. Set t ing it t o zero yields t he equilibrium point ,
0
X ,
is obt ained from
( )
2
0
2
0 0
0
V
k g
X
=
+

where
0
V is t he volt age applied.
( )
2
0
2
0
0
V
k g
X
=
+

The equilibrium point ,
0
X , is given by
0 0
k
X L V
g
+ =
Subst it ut ing for k we get
0
2
VR A
X L
N mg

+ =

Linearizat ion of t he Differ ent ial Equat ion
Consider t he different ial equat ion model
( , ) X f X V g =


where
2
2
( , )
V
f X V k
X
=
I t is second order nonlinear syst em. For designing a cont roller, a
linear approximat e model is employed as it is very difficult t o design
a cont roller for a nonlinear syst em. A linear approximat ion is
obt ained by linearizing t he nonlinear funct ion, ( , ) f X V about t he
equilibrium point ,
0
x and t he nominal volt age input ,
0
V , using
Taylors series
( ) ( )
0 0 0
0 0 0 0
, ,
( , ) ( , )
o
X X V V X X V V
df df
f X V f X V X X V V
dX dV
= = = =
~ + +
This approximat ion is valid for small variat ions of X about
0
X ,
0
X X se, and V V se. Using t he expression for linear
approximat ion of ( , ) f X V becomes
( ) ( )
( )
( )
( )
2 2 2
0 0 0
0 0 2 3
0
0 0
2
( , ) 2
kV V kV
f X V k X X V V
X L
X L X L
= +
+
+ +


Let us define
0
x X X = and
0
u V V = ,. Using t his definit ion we get
( ) ( ) ( )
2 2
0 0 0
2 3 2
0 0 0
2
( , ) 2
kV V kV
f X V k x u
X L X L X L
= +
+ + +

Since
( )
2
0
2
0
V
g k
X L
=
+
we get
( , ) f X V g x u o | = +
where
( ) ( )
2
0 0
2 2
0 0
2
2 ,
V kV
k
X L X L
o | = =
+ +

Subst it ut ing t he nonlinear funct ion by it s linear approximat ion in
( , ) X g f X V =


we get
x x u o | =
The above is a linear approximat ion model of t he nonlinear maglev
syst em. This approximat ion is valid for excursion in t he
neighborhood of
0
X and
0
V ,
x se and u se
Taking t he Laplace t ransform, t he t ransfer funct ion relat ing x and u
becomes
2
( )
( )
( )
x s
G s
u s s
|
o
= =


The syst em is unst able as t here is pole in t he right half of t he s-
plane. The poles, p, of t he plant are real and are symmet rically
locat ed about t he imaginary axis
p o =

Analysis of t he open loop syst em
St abilit y analysis
The syst em is unst able as t here is pole in t he right half of t he s-
plane. The poles, p, of t he plant are real and are symmet rically
locat ed about t he imaginary axis
p o =
The poles are symmet rically locat ed about t he imaginary axis in t he
s- plane.
St ep response
The st ep response will be unbounded and is given by
( )
1 1
( ) 1
2
t t
x t e e
o o
o

(
= +
(


The st ep response is unbounded.
=

) ( lim t x
t

Frequency response
Consider t he t ransfer funct ion, ( ) G s . Set t ing s je = t he frequency
response becomes
2
( ) 1
( )
( )
x j
G j
u j
e
e
e e o
= =
+

The frequency response is real and posit ive for all frequencies
t hanks t o t he symmet ric locat ion of t he poles.

This shows t hat one can analyze t he maglev syst em using
frequency response and not st ep response.
Design of cont r oller

Cont roller st ruct ure and cont roller design approach
There are a number of choices of cont roller st ruct ures including,
proport ional int egral derivat ive ( PI D) cont roller, lead- lag
compensat or, and st at e feedback cont roller and number of
approaches for designing a cont roller.

The maglev syst em in t he laborat ory has lead- lag compensat or.
Hence we will choose a lead- lag compensat or. As for t he design
approach we will choose a simple approach based on pole-
placement .
The lead- lag compensat or, C( s) , t akes t he general form
( )
s b
C s k
s a
+ | |
=
|
+
\ .

Closed loop syst em
Since t he plant , G( s) is unst able it must be operat ed in a closed
loop configurat ion formed of t he plant G( s) and t he cont roller, C( s)
as shown in Fig. 4 below.

Fig. 4. Closed loop syst em formed of t he plant G( s) and t he
cont roller, C( s)

The close loop t ransfer funct ion relat ing t he reference input , r and
t he plant out put , x is given by
e u x r
C( s G( s
( ) ( ) ( )
( ) 1 ( ) ( )
x s G s C s
r s G s C s
=
+

Subst it ut ing for G( s) and C( s) t he closed loop numerat or
polynomial, N( s) and denominat or polynomial ( also t ermed
charact erist ic polynomial) , D( s) become
( ) ( ) N s k s b | = +
( )( ) ( )
2
( ) D s s a s k s b o | = + +
Consider t he charact erist ic polynomial, D( s) . Simplifying yields
3 2
( ) ( ) D s s as s k a k b o | o | = + +
Design using pole- placement approach
We will use pole- placement approach t o design t he cont roller, C( s) ,
t hat is obt ain t he cont roller paramet ers, k, a and b.
- Choice of desired pole locat ion
The closed loop syst em is of t hird order. Let us choose for
convenience all poles t o be equal t o p. The desired
charact erist ic polynomial, ( ) s becomes
( )
3
3 2 2 3
( ) 3 3 s s p s s p sp p = + = + + +
- Equat e t he act ual charact erist ic polynomial and t he desired
charact erist ic polynomial
( ) ( ) D s s =
Subst it ut ing for D( s) and ( ) s yields
3 2 3 2 2 3
( ) 3 3 s as s k a k b s s p sp p o | o | + + = + + +
- Solve for t he unknown cont roller paramet ers, k, a, and b by
equat ing t he coefficient s of t he equal powers of s
2
3
3
3
a p
k p
a k b p
o |
o |
=
+ =
=

Solving t he above equat ions yields
3
2
2
3
3
3
a p
p p
b
p
p
k
o
o
o
|
=
+
=
+
+
=






Del i ver abl es

Each st udent should submit a word file cont aining t he following:
- The mat hemat ical model of maglev syst em
- Analysis of t he linear approximat ion model of t he Maglev
syst em in t ime and frequency domain using SI MULI NK.
- Design of a lead- lag compensat or
- Evaluat ion of t he performance

CI SE 412: MECHATRONI CS
( Term 092)
Lab # 5:
Desi gn and I mpl ement at i on of Oper at i onal
Ampl i f i er Ci r cui t s

Equi pment Needed
+ Oper at i onal Ampl i f i er s ( LM 741, LM 311, or equi v al ent )
+ Resi st or s ( 500 O, 1k O, 1M O, )
+ Var i abl e Resi st or
+ Capaci t or s ( 22 pF, 33 pF, )
+ Mul t i - met er
+ Osci l l oscope
+ Si gnal Gener at or
+ Pow er Suppl y

I nt r oduct i on:
Operat ional Amplifiers ar e import ant devices t hat can be used for
signal condit ioning and int erfacing sensor s and act uat ors. I n t his lab,
you will pract ice using t he op- amp in different ways. LM 741 in a
classical oper at ional amplifier t hat is widely used. I t comes in DI P or
met allic package. The one used in t his lab is an 8- Pin DI P package.


Pr el ab Act i v i t y 0:
Dow n l oad t he Op- Amp dat a sheet s f r om t he
manuf act ur e' s w eb si t e.
I dent i f y t he mai n char act er i st i cs of t he LM 741.


St ep 1:

Par t 1: How t o connect t he LM
741

I f you have not already done so, wire t he bus st rips on
your breadboard t o provide posit ive power, negat ive
power and ground buses. What ever color scheme you
have chosen for your wires, you should use t he green
binding post for ground, t he black for - 15 V, and t he red
for + 15 V.

St ep 2:

Connect a 0. 1F capacit or bet ween t he + 15 V power bus
and ground. Connect anot her 0. 1F capacit or bet ween
t he - 15 V power bus and ground. The power buses for
your board should look like t his:

These capacitors are the first of several bits of "magic" we will employ
to try to avoid amomolous behavior. As we will see when we study
control systems, feedback also has a dark side. In particular, feedback
which becomes positive at some frequency can cause instabilities.
Although we have not deliberately introduced any positive feedback,
feedback can occur where we don't intend it. The purpose of these
capacitors is to prevent it from occurring via the power supply, which at
high frequencies is not a very ideal voltage source.

St ep 3:

Plug an op- amp int o t he breadboard so t hat it st raddles
t he gap bet ween t he t op and bot t om sect ions of t he
socket st rip. I f you have wired t he power buses as
suggest ed above, Pin 1 should be t o t he left .

War ni ng
Do not t ry t o unplug t he op- amp wit h your
t humb and forefinger. Use I C puller.


St ep 4:
Connect Pin 4 ( Vcc- ) t o t he negat ive power supply bus ( -
15 V) . Connect Pin 7 ( Vcc+ ) t o t he posit ive power supply
bus ( + 15 V) .



St ep 5:

Set t he METER SELECTOR on t he power supply t o +20V. Wit h
t he power supply disconnect ed from t he breadboard,
t urn on t he supply and adj ust t he left - hand volt age
cont rol unt il t he met er reads 15 volt s.

St ep 6:

Turn off t he supply and connect t he supply t o t he
breadboard wit h banana plug pat ch cables. Connect t he 0
to -20V t erminal ( black) t o t he black binding post on your
breadboard, t he 0 to +20V t erminal ( red) t o t he red
breadboard binding post , and t he COMMON t erminal ( light
blue) t o t he green breadboard binding post . Not e t hat
none of t he power supply out put t erminals are connect ed
t o ground. I f we want t he power supply zero volt
reference connect ed t o ground, we must make t he
connect ion ourselves.

Par t 2: Non- i nv er t i ng Ampl i f i er
Pr e- l ab Act i v i t y 2 :
Design a non- invert ing Amplifier circuit . The closed loop gain of t he
amplifier is required t o be 2.

Lab Act i v i t y 2:
1. Select t he resist ors needed t o implement t he designed non-
invert ing amplifier.
2. Connect t he circuit
3. Use t he signal generat or t o provide t he input t o t he amplifier.
Use sine wave wit h Peak t o peak value of 2Volt s. Use
Frequencies of 1 Hz, 100 Hz and 1000Hz.
4. Use t he oscillat or t o display t he out put of t he amplifier
Observat ions and Comment s:












Part 3: I nvert ing Amplifier
Pr e- l ab Act i v i t y 3 :
Design an I nvert ing Amplifier circuit . The closed loop gain of t he
amplifier is required t o be 2.

Lab Act i v i t y 3:
5. Select t he resist ors needed t o implement t he designed
invert ing amplifier.
6. Connect t he circuit
7. Use t he signal generat or t o provide t he input t o t he amplifier.
Use sine wave wit h Peak t o peak value of 2Volt s. Use
Frequencies of 1 Hz, 100 Hz and 1000Hz
8. Use t he oscillat or t o display t he out put of t he amplifier
Observat ions and Comment s:















St ep 1:

Par t 3: The Op Amp as a Compar at or
Wit h t he power t urned off, wire t he following circuit . This
will compare t he funct ion generat or out put wit h an
adj ust able t hreshold proficed by t he 0- 6V supply.



St ep 2:
Set t he funct ion generat or t o produce a 4 V p- p, 100 Hz
t riangle wave.

St ep 3:

Pull out t he DC OFFSET cont rol and adj ust it so t hat t he
waveform has an average value of 2. 5 V ( i. e. t he
negat ive peaks have a value of + 0. 5 V) .

St ep 4:

Connect t he funct ion generat or out put t o Vi n of t he
circuit above. Connect CH1 of t he scope t o Vi n and CH2 t o
Vout . Set t he CH2 VOLTS/DIV t o 5. Make sure bot h
channels of t he scope are on DC.

St ep 5:
Turn on t he power supply and set t he 0-6V out put t o
zero.

St ep 6:
Slowly increase t he 0-6V cont rol unt il Vout begins t o
change. Sket ch t he waveform.

St ep 7:

I ncrease V
2
in st eps of 0. 4 V unt il Vout st ops changing.
At each st ep sket ch Vout , not ing t he posit ive and
negat ive peak values and t he durat ion of t he high and
low st at es.

St ep 8:

Set V
2
t o zero and push t he DC OFFSET cont rol back in.
Vout should be approximat ely a square wave. I s t his
what you expect ?

Quest ion
Explain t he waveforms observed in t his Part . Develop an
expression for t he dut y cycle ( t he percent age of t he t ime
t hat t he waveform is in t he "high" st at e) as a funct ion of
1:
V
2
.


Balancing the Input Offset
I nt roduct ion
In the previous experiment (The Basic Op Amp Inverter), we learned that there are at
least three basic limitations on the accuracy of an op amp circuit: the tolerance of the
resistors, input offset voltage and current, and output saturation. We can't do anything
about output saturation, and we can only deal with resistor tolerances by selecting
resistors of the degree of precision required for a specific application. However, in
those cases where it is necessary, we can make use of a feature of the basic 741 op
amp to balance out the input offsets and thus remove their influence on the output
voltage.
Fortunately, in most applications this is not necessary. This permits the construction
of dual- and quad-op amp packages, where the offset adjustment connections are not
available outside the package. However, there are some cases where the input offset
must be balanced as closely as possible. Therefore, we will examine the required
method in this experiment.



Schemat ic Diagram

The recommended circuit for balancing out the input offset is quite simple, as shown
here. The offset null pins (1 and 5) give direct access to the 1K emitter resistors in the
input stage, and the offset null circuit is simply a 10K potentiometer connected
between them, with its slider connected to the negative power supply. This is
equivalent to putting a 5K resistance in parallel with each of the 1K resistors inside
the IC. The difference is that we can vary the external resistances by adjusting the
potentiometer, until the voltage offset becomes zero.
Since we're dealing with the input stage of a high-gain amplifier, the output voltage
will be very sensitive to potentiometer changes. Therefore, we'll use a 15-turn trimpot
here.
So how do we tell when we have exactly balanced out the offset? After all, the input
offset is internal to the IC, and is rated to be no more than 6.0 millivolts (0.006 V) and
0.2 milliamps (0.0002 A). These require very accurate and sensitive measuring
equipment, and are inaccessible in any case.
What we can do is select R
in
and R
f
to amplify an input voltage of zero. We'll make
R
in
= 1K and R
f
= 100K, and connect the input end of R
in
to ground. This will give the
overall circuit a gain of 100, and assure us that the correct output voltage should
nevertheless be 0.000 volt. Any output voltage will be due to offsets in the op amp
itself, and we will use the 10K trimpot to balance them out as closely as possible.

Part s List
To construct and test the offset balancing circuit on your breadboard, you will need
the following experimental parts:
- ( 2) 1K, 1% resist ors ( brown- black- black- brown) .


- ( 1) 100K, 1% resist or ( brown- black- black- orange) .


- ( 1) 10K t rimmer pot ent iomet er.





Performing t he Experiment
Turn on your voltmeter and set it to measure voltages in the range of 20 volts, and
connect it to monitor the output voltage of the 741 op amp at pin 6 (the top end of the
100K resistor). Turn on power to your experimental circuit, and note the output
voltage of this circuit. If the trimpot is still at one end of its range from the last
experiment, the output voltage may well be quite high. This is not a problem; simply
note it for now.
Adjust the trimpot over its range and note the effect on the output voltage. Then,
readjust the trimpot to reduce the output voltage to below 1.00 volt.
Reduce the range on your voltmeter to measure voltages up to 2 volts, and then
continue to adjust the trimpot to reduce the output voltage to zero.
If your voltmeter has a 200 mV range, switch down to that and use the trimpot to
adjust the output voltage to as close to zero as you can. By now the adjustment will be
very sensitive to slight changes, so you may have difficulty balancing out the last
millivolt. If so, don't worry about it; just do the best you can.
When you have reduced the output voltage as closely as possible to zero, leave the
trimpot alone and simply observe the output voltage for a few minutes. What does this
observation show you?
Finally, remove the trimpot from the breadboard socket and set it aside. What is the
output voltage now? Keeping in mind the op amp gain of 100, what was the effective
initial input offset voltage?
When you have made your determinations, turn off the power to your experimental
circuit and voltmeter and compare your results with the discussion below.



Discussion
1. Why balancing is needed?
2. How can we balance t he LM 741 op- amp?



Part 5: Design and implement a summing amplifier.
The required equation is
) 2 (
2 1
V V Vout + =
The inputs are two constant voltages
+ Draw the circuit diagram
+ Connect the circuit
+ Turn on the power supply
+ Check the result and comment on it.








Part 6: Design and implement a low pass first order active
filter. The required equation is

The input is a sign wave with frequencies 10Hz, 100Hz and 10000Hz.
+ Draw the circuit diagram
+ Connect the circuit
+ Turn on the power supply
+ Check the result and comment on it.
+
When you have completed this experiment, make sure power to your experimental
circuit and voltmeter is turned off. Remove all of your experimental components from
the breadboard socket and put them aside for use in later experiments.






















Tur n t he pow er suppl y of f dur i ng t he
connect i on of t he ci r cui t

Lab # 6: I nt r oduct i on t o Boe- Bot

Obj ect ives:
Get t ing and inst alling t he BASI C STAMP Edit or
Set t ing up hardware and t est ing t he syst em
Writ ing t he first program for t he Boe- Bot

Lab act ivit ies:
I n t his lab session, st udent s are expect ed t o do t he following six
act ivit ies. Det ails of t he act ivit ies are available in Chapt er 1 of t he
Boe- Bot manual
1. Get t i ng t he sof t w ar e: The inst ruct or will provide t he CD t o
be used in inst alling t he BASI C STAMP Edit or. You can follow
t he st eps in pages 4- 8 t o download most recent version of
t he soft ware.
2. Sof t w ar e I nst al l at i on: t o inst all t he BASI C STAMP Edit or,
you need t o follow t he procedure in pages 10- 12.
3. Set t i ng up Har dw ar e and Test i ng t he Sy st em: Follow
t he det ails given in page 13- 20.
4. Wr i t i ng t he Fi r st Pr ogr am: Follow t he det ails given in
page 22- 36.
5. Pr oj ect s: Each st udent group must do Proj ect s 1 and 2.


The inst ruct or need t o check t hat all act ivit ies are done correct ly.

Del i ver abl es:
Lab report summarizing what was done in t he lab.
Short descript ion and program list ings for Proj ect s 1 and 2.

Lab # 7: Ser vomot or s f or t he Boe- Bot

Obj ect ives:
Connect , adj ust and t est ing t he servomot ors

Lab act ivit ies:
I n t his lab session, st udent s are expect ed t o do t he following six
act ivit ies. Det ails of t he act ivit ies are available in Chapt er 2 of t he
Boe- Bot manual
1. Ti me Tr ack i ng and Repeat Act i ons: To pract ice soft ware
inst ruct ions for t ime t racking and t imed loops.
2. Test i ng LEDs: Pract ice inst ruct ions of t he microcont roller t o
send out put s. Do t he st eps in page 48 t o connect t he LEDs
and writ e a program t o t urn t he LEDs ON and OFF.
3. Usi ng Pul seout and Pause Follow t he det ails given in
page 52- 58 t o generat e specific t iming diagrams.
4. Connect i ng Ser vomot or s: Follow t he det ails given in page
58- 66.
5. Cent er i ng t he Ser vos: Follow t he det ails given in page 66-
70.
6. Test i ng t he Ser vos:
7. Pr oj ect s: Each st udent group must do Proj ect s 1 and 2
given in page 87


The inst ruct or need t o check t hat all act ivit ies are done correct ly.

Del i ver abl es:
Lab report summarizing what was done in t he lab.
Short descript ion and program list ings for Proj ect s 1 and 2.

Lab # 8: Assembl i ng and Test i ng t he Boe- Bot

Obj ect ives:
Build t he Boe- Bot
Test t he servomot ors
Connect t he speaker and t est it
Use Debug t o cont rol and t est t he servo speed

Lab act ivit ies:
I n t his lab session, st udent s are expect ed t o do t he following six
act ivit ies. Det ails of t he act ivit ies are available in Chapt er 2 of t he
Boe- Bot manual
1. Assembl i ng t he Boe- Bot : Follow t he st eps in 91- 100 t o
assemble t he Boe- Bot .
2. Re- Test i ng t he Ser vos: t o t est t he servos, Follow t he st eps
in 101- 105.
3. St ar t / Rest I ndi cat or and pr ogr am
4. Test i ng Speed Cont r ol
5. Pr oj ect s: Each st udent group must do Proj ect s 1 and 2
given in page 119.


The inst ruct or need t o check t hat all act ivit ies are done correct ly.

Del i ver abl es:
Lab report summarizing what was done in t he lab.
Short descript ion and program list ings for Proj ect s 1 and 2.

Lab # 9: Basi c Boe- Bot Navi gat i on

Obj ect ives:
Program t he Boe- Bot t o do t he basic maneuvers: Move forward,
backward, rot at e left , rot at e right , pivot t urn
Calculat e required t ime t o move Boe- bot precise dist ances.
Program Boe- Bot t o accelerat e and decelerat e


Lab act ivit ies:
I n t his lab session, st udent s are expect ed t o do t he following seven
act ivit ies. Det ails of t he act ivit ies are available in Chapt er 4 of t he
Boe- Bot manual
1. Basi c Boe- Bot Maneuv er s
2. Tuni ng t he basi c maneuver s
3. Cal cul at i ng di st ances
4. Rampi ng maneuv er s
5. Subr out i nes f or maneuv er s
6. Bui l di ng compl ex maneuver s i n t he EEPROMS
7. Pr oj ect s: Each st udent group must do Proj ect s 1 and 2
given in page 159.


The inst ruct or need t o check t hat all act ivit ies are done correct ly.

Del i ver abl es:
Lab report summarizing what was done in t he lab.
Short descript ion and program list ings for Proj ect s 1 and 2.

Lab # 10: Boe- Bot Navi gat i on w i t h Whi sk er s

Obj ect ives:
Build Tact ile swit ches using whiskers
Program Boe- Bot t o use t he t act ile swit ches in navigat ion


Lab act ivit ies:
I n t his lab session, st udent s are expect ed t o do t he following seven
act ivit ies. Det ails of t he act ivit ies are available in Chapt er 5 of t he
Boe- Bot manual
1. Bui l di ng and Test i ng t he Whi sk er s
2. Test i ng t he Whi sk er s
3. Navi gat i on w i t h Whi sk er s
4. Pr oj ect s: Each st udent group must do Proj ect s 1 and 2
given in page 189.


The inst ruct or need t o check t hat all act ivit ies are done correct ly.

Del i ver abl es:
Lab report summarizing what was done in t he lab.
Short descript ion and program list ings for Proj ect s 1 and 2.

Lab # 11: Boe- Bot Navi gat i on w i t h
Phot or esi st or s

Obj ect ives:
Build and t est phot oresist or circuit
Program Boe- Bot t o use t he phot oresist or in navigat ion


Lab act ivit ies:
I n t his lab session, st udent s are expect ed t o do t he following seven
act ivit ies. Det ails of t he act ivit ies are available in Chapt er 6 of t he
Boe- Bot manual
5. Bui l di ng and Test i ng phot or esi st or ci r cui t
6. Avoi di ng Shadow s
7. Navi gat i on w i t h phot or esi st or
8. Roami ng t ow ar d t he l i ght
9. Pr oj ect s: Each st udent group must do Proj ect 1 given in
page 228.


The inst ruct or need t o check t hat all act ivit ies are done correct ly.

Del i ver abl es:
Lab report summarizing what was done in t he lab.
Short descript ion and program list ings for Proj ect 1.

You might also like