Vous êtes sur la page 1sur 3

Electromagnetic Levitation Using MATLAB

Real Time Control Toolbox

Rafael R.GOMES1, Student, Member, IEEE, Daniel C.B.V. da SILVA2, Student,

and José Luiz da SILVA NETO3, Supervisor, Member, IEEE.
UFRJ, Cidade Universitária, Rio de Janeiro, Brazil,
e-mail : (ramos@ieee.org1,dcurvello@hotmail.com2, luizneto@dee.ufrj.br3)

The dynamic behavior is described by Eq.(2):

Abstract – This paper describes an electromagnetic
levitation experience developed at UFRJ using the real- FR = Fdinmag – Pball = m d2 y(t). (2)
time control toolbox available with MATLAB. This
work shows the model used in the position control of a
steel ball, the control design procedure and the
prototype. The main application of this experience was The dynamic magnetic force is the sum of the static
focused in the vertical position control of a maglev train component to compensate the ball weight and the magnetic
system, also researched at UFRJ. force variations, as shown in Eq. (3):

Index Terms – Feedback Control System, FR = Fmag + ∆Fmag – Pball = m d2 y(t). (3)
Electromagnetic Levitation. dt2

I. INTRODUCTION According with Eq.(1), in the static equilibrium state, the

magnetic force is equal to ball weight. So, this two forces
One of the most popular experiences on electromagnetic can be canceled from Eq. (3), resulting in Eq.(4):
levitation is the steel ball levitation experiment, where a
little ball levitates in the air a few millimeters below an FR = ∆Fmag = m d2 y(t). (4)
electromagnetic coil. The electromagnetic field of this coil dt2
is electronically controlled to compensate for the ball
weight and to hold it in a stable position. Appling the Laplace transform in the Eq. (4), the transfer
The main goal of the present work is to describe the use function of the plant can be determined. Thus,
of the MATLAB[1] real time control toolbox in the above
mentioned experiment, using a minimum number of
external components.
Y(s) = H(s) = 1 . (5)
∆Fmag(s) ms2
This transfer function expresses the relationship between
The mathematical model for this system can be the resultant force and the vertical position of the ball. Let’s
represented by an actuator (electromagnetic coil) and the consider the electromagnetic force proportional to the
ball. The function of the actuator is to equilibrate the ball current thought the coil for small variations of current and
weight with the electromagnetic force produced by the coil, ball position.
according to Fig.1.
I(s) ≈ ∆Fmag(s) → I(s) = k1 . (6)
Electromagnetic coil
(actuator) The electromagnetic coil is an RL circuit, where R is the
y(t) wire electrical resistance and L is the coil inductance. Thus
the following differential equation can be written:
Steel Ball
Pba v(t) = L di(t) + Ri(t). (7)
Fig. 1 The ball weight is equilibrated by the magnetic force.
where v(t) is the supply voltage.

In the static equilibrium state, Eq.(1) holds: Applying the Laplace transform,

Fmag = Pball = mg. (1) V(s) = LsI(s) + RI(s) . (8)

0-7803-7912-8/03/$17.00 © 2003 IEEE

Fig. 2 The closed loop root locus of the physical plant. Fig. 4 The closed loop root locus with PD compensator.

Reorganizing the equation terms, the following equation By the root locus diagram, the compensator transfer
can be written: function can be determined as:

T(s) = I(s) = k2 , (9) C(s) = 50(1+ 0.1s). (12)

V(s) τs + 1
where, And the compensator parameters are:
τ = L/R,
k2 = 1/R. Proportional gain (P) = 50,
The complete transfer function of the plant can be Derivative constant (D) = 5 sec.
resolved multiplying Eqs. (6) and (9). Thus,
G(s) = k1 * k2 = k3 . (10) For interfacing with a PC, a PCL-812PG Enhanced
2 2
ms τs + 1 ms (τs + 1) Multi-Lab Card was used. This card contains sixteen digital
input and output 16 bits ports, TTL compatible, sixteen
This equation have a double pole in the origin and a analog inputs with 12 bits resolution, and two analog output
single pole in the real plane at –1/τ. with 12 bits resolution. One analog input and one analog
output were used. The analog input was connected with the
For the present case, position sensor, and the analog output was connected to a
m = 16.35 g = 0.01635 kg, linear power amplifier.
R = 12,8 ohms, The position sensor used in the prototype was an optical
L = 377 mH , sensor of position with linear characteristic [2]. This sensor
τ = 29,5 ms. consists of one pair of infrared LED and one pair of
phototransistors, as shown in the Fig.5. The sensor behavior
Thus, the complete transfer function of the plant is: is linear in the range of 0 to 0.5 mm as shown in Fig.6.
The sensor was positioned below the coil a few
G(s) = k3 . (11) millimeters from the core.
0.01635s2(0.0295s + 1) To supply the sensors circuit, a +5 volts power supply
was used.
The root locus diagram is shown in the Fig. 2, where it The electromagnetic coil has a ferromagnetic core with
can be seen that the system is unstable for any gain value. large number of turns of cooper wire winding. The
electromagnetic field is controlled for the ball position
III. COMPENSATOR DESIGN control. In steady state the current thought the coil is
constant. So, it is not necessary to use a laminated core to
According to the last analysis, the system is unstable for reduce eddy current losses.
a proportional controller. To stabilize the system the root
The PC card analog output does not have enough power
locus must be pushed to the left complex plan side. For this, to supply the electromagnetic coil. Therefore, an external
a PD controller was added to the system, as shown in linear power amplifier was used.
The new root locus can be seen in Fig.4. The zero is
positioned at -10. Step response simulations have shown a
good behavior in closed loop.

Fig. 5 The sensors arrangement.

Fig. 3 The closed loop control system.

The hardware is connected to the PC interface. The steel

ball is positioned between the position sensors and a few
millimeters apart from the electromagnetic coil. The offset
value is changed to compensate the ball weight, on this
moment the steel ball is ready to levity. The scope can be
added to plot the ball position in function of time, as shown
in Fig. 7:

Fig. 6 The position sensors static responses.


For the PD controller implementation with MATLAB,

the real time control workshop was used. This toolbox is a
complete interface from simulation environment to real
world. Once defined the model to be used, this toolbox
transforms the model used to C code for discrete-time,
continuous-time, and hybrid systems. After simulations,
Fig. 7 The experimental gap measurement.
the real time toolbox can be connected with a prototyping
target through the interface card.
The electromagnetic levitation experience using real
The SIMULINK´s model used, is shown in Fig. 7.
time control toolbox was successful and the ball position
hold in a stable position.


The MATLAB’s real time control toolbox represents a

powerful tool for the control of physical systems. In the
electromagnetic levitation experience, the controller
Fig. 7 The Simulink’s model allowed a stable levitating steel ball.

The analog input receives the information of the ball

position. The sensor output varies from –5V to +5V ACKNOWLEDGEMENTS
according to the ball position. In the development
environment this voltage level is normalized. So, the block The authors wish to thank Professor G. B. Rolim for
output range is –1 to +1. The sampling time used is 1msec MATLAB modeling help, to Ocione Machado for to help in
(f=1KHz). the prototype design. A special thanks is due Professor
The next block is the PD controller. The MATLAB PID Richard Stephan for his help on text technical revision and
block was used, but the integral parameter is set to zero. the project design orientation, and to CNPq for financial
The PD controller parameters used in this model was support.
determined from the mathematical analysis developed in
chapter III. The proportional parameter is set to 50, and the
derivative parameter is set to 10. REFERENCES
At the output of the PD controller, a saturation block
was added for output range limitation. [1] MATLAB User’s Manual – Math works, 1996.
The offset point is determined experimentally. The offset [2] R. M. Stephan and J. A. Santisteban, “Sensor Ótico
value is a point when the ball weight is almost equilibrated. com Característica Linear” 11° - Seminário de
This value can vary from 50 to 100. The offset value used Instrumentação do IBP, 1996, pp.10-15.
on the prototype is 80.
Finally, the output block is normalized too. So, a gain
block with 1/250 gain was added. The model output range
is set from 0 to 1. The output sampling time used is the
same used with input port (1msec).