You are on page 1of 35

Marwan K.

Advisor: Dr. Winfred Anakwa
• Introduction
– Problem definition
– Objectives
• Functional Description
• System Block Diagram
• System Identification
• Control Algorithm
• Software Implementation
• Hardware Interface
• Results
• Conclusions
• Future work
• What are Magnetic levitation systems?
Maglev. are devices that suspend
ferromagnetic materials with the aid of
electromagnetism. It has wide number
of applications such as high-speed
trains, aerospace shuttles, magnetic
bearings and high-precision platforms.

• Problem definition

Maglev. systems based on electromagnetic attraction

are characterized by non-linear and unstable open-loop
dynamics which suggests the need of stabilizing
Project Objectives

• Obtain a good model for the magnetic levitation system,

maglev model 33-210 from Feedback Inc. Limited.

• Design and implement a microcontroller-based digital

controller to stabilize a 21 gram steel ball at a desired
vertical position. The overall system should track applied
reference input signals.
Functional Description
• Inputs:
– Set point (Constant 1.50 [V] ), corresponds to a distance of 22.5mm
between the ball and the electromagnet.
– Reference signal (±0.4 Vpp)
– Disturbances such as power supply fluctuation, coil temperature
variations and external forces applied to the ball.

• Output
Actual ball position
System Block Diagram
S e t p ot I ni n t e l m i c r c o n t
+ T s
R e f e r I e n n t e c re f a D c ei g z i t I a n l t e M r af ag c n
i n p + u E t ( C s )i r c u i C t o o n t Cr o i rl L l c e e u r v i ti t
E * ( s )h U S ( sy )s t

M a g l e v F r o n t P a n e l

A c t u a l B a l l p o s i
System Identification
• Importance of modeling the system.

• There are two approaches to identify the plant:

a) Analytical model- Using differential


b) Experimental model- Bode frequency

response data fitting.

To obtain a good model for the system, both models were

obtained for comparison.
System Identification Coil Resistance

Current= i

• Analytical model Coil inductance= L

e Input Voltage

There are two sets of equations that

describe magnetic levitation Photo-

This is the general
1) Electrical: electrical circuit for

δi i δx magnetic levitation

e = R ⋅ i + L − L0 ⋅ x0 2 systems. However, this

maglev. system is driven

δt x δt by an active circuit for the
coil that adds further non-
e = Coil input voltage R= Coil resistance linearity since I is a non-
linear function of e.
i = Coil current L= Coil inductance
t = Time L0= Nominal point inductance
x0= Nominal point pos.
System Identification
2) Mechanical equation Electromagnetic
Using Newton 2nd law of force
motion: EF= C (i/x)2

F = GF − EF = m⋅ g − C ⋅  
 x
F= Resultant force Gravitation forc
m= Mass of the steel ball= 0.021 Kg GF = m*g
g= gravitational acceleration = 9.82 m/s2
C= Magnetic plant constant
System Identification
• The previous equation contained non-linear elements, so
linearization is needed.

• Taylor series expansion is used to approximate the equations

near the operating point of x0=22.5 mm from electromagnet.

• Operating region= 18 − 27 mm from electromagnet.

• Magnetic plant constant, C= 1.477x10-4 N.m2.A-2

System Identification Coil Inductance vs Ball Distance y = 0.001x
- 0.0761x + 298.12
R = 0.9958

• Coil inductance L was 298

Coil Inductance (mH)

approximated as a

Poly. (Se

constant = 296.74mH. 296.5

















• Sensor gain Ks was
Ball distance fromthe coil (mm)

determined to be
450.3 volts/meter.
System Identification
• Combining the previous equations:
Gp( s ) analytical =
(s + 1)( s − 1)( s + 1)
29.14 29.14 70.15
System Identification
• The analog controller of the manufacturer
was connected to the plant to obtain
frequency response data.

• The data was obtained at the nominal

operating point x=x0=22.5 mm

• The reference input frequency was swept

from 0 to 20 Hz.
System Identification
• The experimental 1.60
G p _ exp (s) =
model of the plant is: (s + 1)(s − 1)
30.5 30.5
System Identification
• The experimental model was used instead of the
analytical model, since the analytical model did not
account for the non-linearity of the active coil driver.

• The high-frequency pole at -70.15 rad/s was

omitted in the practical model approximation.
System Identification
• Frequency response data for controller from the
System Identification
• Controller from manufacturer:
Gc _ man (s) = 15π
s s
( + 1)( + 1)2
900π 4000π
• Approximating to a first order:
Gc _ man (s) = 15π
( + 1)

• Pole at -2827 rad/s and zero at -47 rad/s

System Identification
• SIMULINK vs. experimental system response to
0.6V step input
System Identification

PM=30.5 degrees
System Identification
• The analog controller from manufacturer was
converted to discrete domain using bilinear
(Tustin) transformation with Ts= 5 ms.
+1 1 − 0.7904 ⋅ z −1
Gc _ man (s) = 15π Gc (z) = 8.3
+ 1) 1 − 0.7521 ⋅ z −1
Software Implementation
• The digital controller was implemented
using assembly language program on an
Intel-80515 microcontroller.

• The software code:

– Samples the error signal via the A/D.
– Computes the control signal.
– Sends the control signal to the plant via the D/A.
Software Implementation
• The 8051 microcontroller does not handle floating
point arithmetic.
• The controller transfer function was approximated
for fixed point implementation.
• The approximated transfer function: 11 −1
1 − ⋅z
1 − 0.7904 ⋅ z −1
Gc _ emac (z) = 14 * 8.3
Gc (z) = 8.3 10 −1
1 − 0.7521 ⋅ z −1
1 + ⋅z
Note: 11 10 implemented in
= 0.7857 = 0.7143 hardware
14 14
Software Implementation
I n t i a l i z a t i o n s
8 0 5 1 5 , S t a c k , T i m e r 0 i n t e r r r u p t ,

T i m e r 0
S - a m p l e A / D i n
C a l l C o n t r o l l e r
P r o d u c e v i a D /
U p d a t e v a r i a b l e s
e ( n ) , e ( n - 1 ) , u ( n - 1 )

P r e p a r e PE r ( en p) a r e U P ( r n e - p 1 a) r e E ( n - 1 )
- S e t s ig n b i t - i f S - ev et s i g n b i t -i f S - v e e t . s i g n b i t i f - v e
- M u l t ip ly b y c- o M e u f f l i t c i p i e l y n t b y c - o M e fu f il ct i ip e l ny t b y c o e f f ic i e n t

M u l t ip le x o p e r a t i o n 1

M u l t ip le x o p e r a t i o n 2
Hardware Interface
• Hardware interface circuitry is needed to
level shift and scale the error to the range
of the microcontroller A/D.

• Furthermore, the control signal generated

via the D/A must be readjusted back to the
full scale and multiplied by the controller
Hardware Interface
E1(t) = 0 ~ -5V

E2(t) = 0 ~ +5V Antialiasing
Ready to be filter
interfaced to the

Error signal E(t) = ±5V EMAC

Error to A/D
Hardware Interface
Shifted signal -2.5 ~ 2.5V

Controller gain


1 3
D/A signal 0 ~ 5V Control signal

D/A to Maglev
• The ball was stabilized at the equilibrium point however
it was oscillating due to:

– Quantization errors of the 8-bit A/D and D/A.

– Truncation errors of coefficients stated in controller transfer


– Computational truncation errors.

Stabilization of steel ball at the nominal equilibrium point

Control signal

Ball position

Figure displaying the quantization effects

Tracking of sinusoidal reference input:
- The steel ball tracked reference sinusoidal and
square waveform inputs.
• Mathematical modeling of an unstable system is a challenging
control engineering problem. Some examples are inverted
pendulums and aerospace vehicles.

• Implementation of controller algorithm on 8-bit microcontroller using

fixed point arithmetic generates quantization and truncation errors.

• These errors, that depend on sampling period and controller gain,

cause small oscillations in system response.

• The ball tracked reference input signals. Better tracking

performance can be achieved using higher resolution A/D and D/A,
longer word-length microcontroller and a higher order controller.
Future work
• A user-friendly interface can be developed using
the keypad and LCD.

• Possible user inputs include sampling period,

poles and zeroes locations, settling time etc.

• Once implemented, the system will serve as a

good apparatus for teaching undergraduate
controls students the effect of varying different
parameters on overall system response.
Questions and answers

Thank you

For more information: visit