Sunteți pe pagina 1din 6

Low-Cost Magnetic Levitation System for

Electronics Learning
J.I. Artigas1, L.A. Barragán1, S. Llorente2, A. Marco1 and O. Lucía1
1
Dept. Ingeniería Electrónica y Comunicaciones, Universidad de Zaragoza
María de Luna 1, 50018-Zaragoza, Spain
e-mail: jiartigas@unizar.es
2
Department of Induction Technology, Bosch and Siemens Home Appliances
Group, Zaragoza, Spain.

Abstract-This work presents a low-cost magnetic levitation The cost of the systems published so far, including [3] and
system that can be very easily built by undergraduate or master [4] that claim to be low cost, is not acceptable to be taken by
degree students, in order to learn several control and electronics students in a subject of few credits. An effort has been made
topics. The whole design process proposed in the classroom, and
to locate low-cost electronic components, in addition to make
the resulting electronics circuits are described. Three different
approaches to implement the control system are shown: analog, the coil with small commercial enameled wire reels. The
digital with microcontroller, and digital with FPGA. result is a system whose cost is less than $12 in components,
plus the cost of the printed circuit board and the mechanical
support that each group builds.
I. INTRODUCTION The main novelties of this paper are to propose a really
very low cost system, and to adopt an electronics approach.
Magnetic levitation of ferromagnetic objects is a very The need to control the system is the excuse for students to
impressive and motivating application to be worked out by develop a complete electronic design process, starting from
engineering students. Several magnetic levitation systems the specifications, including the study of some electronic
have been reported in the literature for control engineering stages, their simulation, the design of schematics and printed
education. In 1986 Wong proposed a circuit with an circuit boards, and ending with assembly, soldering and
operational amplifier and bipolar transistors to keep a metal prototype testing.
ball floating in the air [1]. Position feedback was achieved The course is developed from a top-down design
optically and the sphere was attracted by the magnetic field of methodology [5] using the following steps:
a coil mounted on a structure over the sphere. Since then, − Specifications.
several systems have been described ([2]-[4]), where a − High-level design.
metallic object is maintained floating by compensating the − Detailed design.
object weight with the magnetic attraction force created by − Assembly and testing.
the current circulating through a coil. The next sections will describe each of these design stages,
All these systems can be classified into two types: those as they have been implemented in the classroom.
which levitate a ferromagnetic object such as a small iron ball
([1], [2]), and those which levitate a magnet ([3], [4]). In the
first case, position detection is performed by optical means, II. SPECIFICATIONS AND HIGH-LEVEL DESIGN
using a light source and light-dependent resistors (LDR) or The design performed must be able to keep floating in the
photodiodes. In the second case, a hall sensor performs an air a small object of about 10 g of weight with levitation
indirect position measurement, by detecting the magnetic height adjustable by the user. In order to take it home, the
field generated by the levitated magnet. power will be a 9 V battery that should last several hours, or a
In both cases, the resulting system is unstable and highly small power supply (9 V, 0.5 A). The design should be as
nonlinear. All these works have been developed for inexpensive as possible.
laboratory classes of control systems, where there is one or With these specifications, the block diagram shown in Fig.
two prototypes in the lab that students must compensate to 1 is proposed. Simplicity and low cost conditions lead us to
achieve certain specifications. select the option of using a hall sensor to get the position of
This work aims to go further, proposing the design of a the levitating object, which is cheaper and easier to
simpler and lower cost system, so that each group of two or implement than optical systems. This implies that the
three students can build its own prototype and take it home, in levitating object must be a strong magnet, so that its magnetic
the context of basic electronics courses (3-credits) or more field is clearly higher than the one generated by the coil. A
advanced ones, designing a digital control. neodymium disc-shaped magnet of 5 x 10 mm, weighting 3 g,

978-1-4244-7252-9/10/$26.00 ©2010 IEEE 55


Fig. 1. Levitation system block-diagram.

has been selected. To improve stability, a small M8 nut of integrated circuit, a full-bridge driver with the following
about 5 g, or any other light object, is fixed to the magnet. characteristics:
The proposed coil is a standard reel of 67 m long, − It can be controlled with only a single pin (PHASE).
∅ 0.40 mm enameled copper wire. Its dc resistance is about − Maximum dc current: 1.3 A.
9 Ω. − Maximum output voltage: 50 V.
To achieve low power consumption, an iron core is − Logic supply voltage: 3 V to 5.5 V.
introduced into the coil; for example, an M10 screw is a − Maximum frequency: 70 kHz.
cheap and widely available core. Thus, if we adjust the These parameters combined with the low cost of this
reference in order that the magnetic attraction force between driver, make it highly suitable for our application. Note that
the magnet and the screw equals the weight of the levitated the cost of the driver used in [3] and [4] is six times greater
object, only a small current through the coil is required to than the one proposed in this paper.
compensate for small disturbances, thus increasing the With regard to sensing, we have also selected a low-cost
duration of the battery. linear hall sensor, the A1301, which costs about 5 times lower
than the used in other works (SS495A). The cost relations
III. DETAILED DESIGN listed above are approximately valid for a single unit as well
as for 100, in the same electronic component vendor.
To propose a detailed design of the system, the most
appropriate technology for each of the blocks in Fig. 1 should B. Advanced Course
be selected. This selection depends on the course goals. Let In the case of advanced courses, where students are already
us consider two cases. familiar with digital design using microcontrollers or FPGAs,
we may consider a digital control. That approach requires
A. Basic Course managing an analog-to-digital (A/D) converter and
In the case of the subject Basic Electronics of the degree of implementing in fixed-point the compensator that has been
Electrical Engineering, students have only previously previously designed with tools such as Matlab.
completed a 6-credit subject in electronics, where A digital control of the levitation system has been proposed
semiconductor devices and operational amplifiers (op-amp) in the subject Advanced Electronic Systems of the Master of
are introduced. In parallel, they are also studying the subject Electronics Engineering in the University of Zaragoza.
Theory of Systems, which introduces the principles of Some students have used the MSP430F2013 Texas
automatic regulation. Instruments microcontroller, which includes A/D converter
For this context we propose the circuit in Fig. 2. This is a and PWM generator. One of the most important reasons to
completely analog design, where the PWM signal generator is select this microcontroller has been the availability of a very-
based on a triangular signal generator with comparator and low-cost ($20) development tool, the eZ430-F2013. It is a
op-amp (IC1A, IC1B), and a comparator IC2B. The circuit complete MSP430 development tool including all the
around IC2A performs the subtraction of the reference and hardware and software to evaluate the MSP430F2013 and
the hall sensor feedback signal, besides implementing a develop a complete project in a convenient USB stick form
phase-lead compensator. The reference is set by means of a factor. The eZ430-F2013 supports several Integrated
potentiometer. Resistors R4, R5, and R6 form a duty-cycle Development Environments to provide full emulation with
limiter to avoid reaching 0% or 100%, with the excessive coil the option of designing with a stand-alone system or
current resulting. detaching the removable target board to integrate it into an
The selection of the power driver is an opportunity to existing design.
discuss with students the difference between switched and Other students have used a NEXYS2 board from Digilent,
linear circuits. The most common types of dc-ac switched it includes a Spartan 3E FPGA from Xilinx. In this case, an
topologies (half-bridge and full-bridge) can be easily external serial A/D converter (ADCS7476) has been included
introduced. In our case we selected the Allegro A3953 and properly controlled by the FPGA.

56
Fig. 2. Analog implementation of the levitation system.

It must be noted that implementing a digital control, the coil voltage generated by the power driver.
especially with FPGA, requires much more effort from the The most questionable equation is the magnetic one, which
students than the analog controller, so it is necessary to have represents the force F of the magnet on the inductor, where I
more credits to this option, or doing the work in larger is the inductor current and Z is the distance between the
groups. magnet and the inductor core. It was obtained by adding the
term k0 to the model used in [1]. The parameter k0 models the
IV. COMPENSATOR DESIGN force exerted by the magnet on iron in the absence of current
through the coil. This simple equation does not take into
Whatever the chosen technology, an important task is to account the magnetic hysteresis, but it has shown to be
design the appropriate controller to stabilize the system. The adequate for the design of the compensator.
classical control theory of linear time-invariant systems has Constants k0 and k1 can be easily obtained in the laboratory
been used in the subjects mentioned above. The design by measuring, at different distances, the current needed for
process consist of linearizing the differential equations the magnet to be attracted by the coil.
governing the temporal behavior of the system around a Fig. 3 shows the block diagram of the closed loop system,
preselected operating point, to obtain the system transfer together with the values of the parameters for the bias point
function using the Laplace transform and then calculating the (Zo = 20 mm, Io = 50 mA). Gc represents the transfer function
adequate compensator. Table I shows the mechanical, of the compensator to be designed; Glim is the gain given by
magnetic, and electric equations in three versions: large the duty-cycle limiter R4, R5, and R6; Gpwm is the cycle-
signal, small signal, and Laplace transform. average gain of the PWM and power driver; dFdi and dFdz
In Table I, m represents the mass of the object to levitate; Z represent the corresponding partial-derivatives shown in
is the distance of the magnet to the iron core; R and L Table I; and dVhdz represents the small-signal gain
represent the equivalent resistance and inductance of the coil, experimentally measured for the hall sensor. The units are in
easily measured by using an LCR meter; and VL represents the International System.
TABLE I
ELECTROMECHANICAL SYSTEM EQUATIONS
System Equations Small Signal Equations Laplace Equations

d 2Z d 2z
Mechanic mg − F =
m −f =m −f =ms 2 z
dt 2 dt 2

 I + k=
0 
2
∂F ∂F ∂F ∂F
Magnetic F = k1  f z+ i
= f z+ i
 ∂Z ∂I ∂Z ∂I
 Z  ( Zo , Io ) ( Zo , Io ) ( Zo , Io ) ( Zo , Io )

dI di
Electric V=
L RI + L v=
L Ri + L v=
L ( R + Ls ) i
dt dt

57
From Fig. 3, it is straightforward to get the system loop Gc(z) obtained by using the bilinear transformation from the
gain excluding the compensator: former continuous-time compensator is:

vh GlimG pwm  -dFdi  69.01z − 68.79 (4)


Tu (s)= =  dVh dz (1) Gc ( z ) =
v2 Ls + R  ms 2+dFdz  z − 0.9685

Substituting in (1) the parameters of Fig. 3, we obtain the The transfer-function in z is implemented in a direct-form
following loop gain: realization, which results in the difference equation

134746 d (=
k ) 0.9685 ⋅ d ( k − 1) + 69.01 ⋅ e ( k ) − 68.79 ⋅ e ( k − 1) , (5)
Tu (s)= (2)
( s + 450 )( s + 31)( s - 31)
where d is the 10-bit duty command, e is the 9-bit error, and k
The right half-plane pole in (2) represents an unstable pole denotes the current sampling cycle. Equation (5) can be
in the transfer function. A suitable compensator Gc must be directly implemented on a microcontroller using C language,
added in order to get a closed-loop stable system. or it can be implemented on an FPGA using a hardware
description language such as VHDL.
A. Analog Compensator When obtaining the z-transform of the compensator, the
The unstable pole in (2) can be compensated by adding a resulting coefficients are real numbers, but low cost
phase-lead compensator, whose transfer function is: microcontrollers do not work efficiently with floating-point
numbers. They are usually optimized for integer arithmetic.
1 + s / ωz (3) The simplest way to get an integer implementation is to
Gc ( s ) = k
1+ s / ωp multiply all of the coefficients by a power of 2 and to round
the results to the nearest integer. It is advisable to check the
The compensator can be calculated as described in [1]: stability of the resulting system, because the discretization
− The zero ωz is placed between 0 and –31 rad/s, but close
to –31 rad/s (the unstable pole). vcon v1 v2 vL 1 i f -1 z
Gc
− The pole ωp is placed at 10 to 20 times ωz. Ls+R ms 2

Glim Gpwm dFdi


− The gain k is chosen according to the desired phase-
PARAMETERS:
margin (40 - 50°), by using a tool like sisotool in Matlab. L = 20m
Fig. 4 shows the root locus and bode diagram obtained by R=9
dFdi = 0.129 dFdz
using sisotool for the following compensator: ωz = 25 rad/s; dFdz = -7.71 (Z0=20 mm, I0=50 mA)
dV dz = -76.6
ωp = 450 rad/s, k = 13. h
Glim = 1/2.5

The analog implementation of this compensator is Gpwm = 9/1.65


m = 0.008
vh
straightforward by using the circuit of Fig. 2.
dVhdz
B. Digital Compensator
To design a digital implementation, we can make a digital Fig. 3. Laplace block diagram of the levitation system.
redesign of the analog compensator. To do this, an adequate
sampling frequency fs must be selected, at least ten times the
cutoff frequency of the system. In our case, a sampling
frequency equal to the power driver switching frequency has
been selected (7812.5 Hz). Moreover, the gain of the digital
PWM is introduced in the transfer-function (Gpwm = 18/1024
for a 10-bit PWM), the gain of the A/D converter is added
(Gadc = 512/5 for a 9-bit ADC with 5 V full-scale range), and
the continuous-time controller is discretized, obtaining its z
transform. An easy way to discretize the analog controller is
to use the c2d function in Matlab. We have reduced the gain
of the compensator in the digital implementation, in order to
get smaller coefficients and do not saturate the PWM signal
resulting from the multiplications and additions of any noise
present in the A/D converter signal. To achieve the same
phase margin it is also necessary to reduce the distance
between the compensator pole and zero, obtaining the
continuous-time compensator defined by ωz = 25 rad/s,
ωp = 250 rad/s, and k = 7. The discrete-time compensator Fig. 4. Root locus and Bode diagram of the compensated system.

58
and rounding of the coefficients shift the system poles and vector type, and arithmetic and comparison operations
zeros. between objects of this type. The designer is in charge of
For example, the MSP430 is a 16-bit fixed-point selecting the word-length, aligning the binary points in
microcontroller. Therefore, the coefficients are declared as additions, and managing the bit growth in multiplications.
integers of 16 bits. Then, (5) is transformed into:
V. CONSTRUCTION AND TESTING
d (k ) = ( 31⋅ d ( k − 1) + 2208 ⋅ e ( k ) − 2201⋅ e ( k − 1) ) / 32 , (6)
Fig. 6 shows a detail of a possible assembly of the
levitation system support. The hall sensor is sandwiched
where all coefficients have been multiplied by 32 and mounted in between the bottom side of the support and two
rounded to the nearest integer. The final division by 32 is cardboard templates of 1 mm thick. This assures that the
performed by shifting five bits to the right. sensor is fixed aligned with the axis of the inductor core. The
Fig. 5 shows the C language program for implementing the screw is threaded into a nylon nut that is attached to the
controller given by (6) in a MSP430F2013. support. That allows to easily adjusting the gap between the
When using FPGAs, the designer is not constrained to core and the hall sensor.
work with 16-bit (integer variables) or 32-bit (long integer Fig. 7, 8, and 9 show pictures of the analog,
variables) to represent data as in Fig. 5. The digital controller microcontroller and FPGA levitation systems respectively.
is implemented in fixed-point using the VHDL numeric_std The eZ430-F2013 removable target board has been used in
or std_logic_arith packages. Both packages define the signed the microcontroller implementation.
// Control loop at fs = 8 MHz/(8*128) = 7.8 kHz
// ADC and PWM at the same frequency
#include <msp430x20x3.h>
signed int ref = 385; // Reference 0 to 511
void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog
BCSCTL1 = CALBC1_8MHZ; // Clock Calibration constants
DCOCTL = CALDCO_8MHZ; // Clock Calibration constants
P1DIR |= 0x04; // Set P1.2 to output direction
P1SEL |= 0x04; // Set P1.2 to TA1
// PWM
TACCR0 = 1023; // PWM Period
TACCTL1 = OUTMOD_7; // CCR1 reset/set
TACCR1 = 512; // PWM duty cycle
TACTL = TASSEL_2 | MC_1; // SMCLK, UP
// ADC: 1.2V ref, MCLK, CLK /8 CLK /1
SD16CTL = SD16REFON + SD16SSEL_0 + SD16DIV_3 + SD16XDIV_0;
SD16INCTL0 = SD16INCH_0; // Input Ch. A0, Preamp. Gain x1
// unipolar, 128 OSR, cont. mode, interrupt enable
SD16CCTL0 = SD16UNI + SD16OSR_128 + SD16IE;
SD16AE = SD16AE0; // P1.0 A0+
SD16CCTL0 |= SD16SC; // Set bit to start conversion
__enable_interrupt();
while (1);
}
#pragma vector = SD16_VECTOR
__interrupt void SD16ISR(void) {
const signed int b1 = 2208;
const signed int b0 = -2201;
const signed int a0 = -31;
const unsigned short shift = 5; // Divide by 2^shift
static signed long err, pwm;
signed long err_act, pwm_out;
unsigned int vh_act;
vh_act = SD16MEM0 >> 7; // Use the 9 MSB
err_act = ref - (signed) vh_act;
pwm = (b1*err_act + b0*err - a0*pwm) >> shift;
err = err_act;
pwm_out = pwm + 538; // Add bias point
// D limitation (0.1 - 0.9)
if (pwm_out > 922)
TACCR1 = 922;
else if (pwm_out < 102)
TACCR1 = 102;
else
TACCR1 = pwm_out;
}

Fig. 5. C listing of the digital controller implementation for the MSP430F2013.

59
Fig. 7. Levitation system with analog controller.

Fig. 6. Assembly of the support for the levitation system.

VI. CONCLUSIONS
The experience of proposing the construction of the analog
version of this system, for two academic courses, in the
elective subject Basic Electronics (fifth semester of the
Degree of Electrical Engineering), has been very positive.
Surveys of students show a high degree of motivation on this
subject, both in classroom, and especially in the lab sessions
devoted to design, assembly and verification. The evolution Fig. 8. Levitation system with microcontroller digital controller.
of the number of students demonstrates the success of this
approach. The enrollment in this subject has increased, while
the total number of students in the degree has fallen.
The digital versions of the levitation system have been
successfully used in a subject of the Master of Electronic
Engineering.

REFERENCES
[1] Wong, T.H., “Design of a magnetic levitation control system-An
undergraduate project,” IEEE Tran. Education, vol. E-29, nº 4, pp.
196–200, Nov. 1986.
[2] Campos, R. et al., “Predictive control of a magnetic levitation system
with explicit treatment of operational constraints,” ABCM Symposium
Series in Mechatronics, vol. 2, pp. 01–08, 2006.
[3] Lilienkamp K. A., Lundberg K.H., “Low-cost magnetic levitation
project kits for teaching feedback system design,” Proc. 2004 American
Control Conference, vol. 2, pp. 1308 –1313, 2004.
[4] Lundberg, K.H., Lilienkamp, K.A., Marsden, G., “Low-cost magnetic
levitation project kits,” IEEE Control Systems Magazine, vol. 24, issue
5, pp. 65–69, 2004.
[5] Storey, N., Electrónica. De los sistemas a los componentes, Addison- Fig. 9. Levitation system with FPGA digital controller.
Wesley, 1995, Chapter 1.

60

S-ar putea să vă placă și