ME 344 Dynamic Systems & Control · Fall 2025
Maglev PID Controller
A class lab project on the Feedback Instruments 33-210 magnetic levitation rig: model the nonlinear ball-magnet dynamics, linearize about the equilibrium point, design a PID controller in LabVIEW, and tune it well enough to hold a hover and track sine, square, and random reference inputs.
Team of three (Desmond Boateng, Pierre Gathy, Alex Citardi). Modelling, VI design, and tuning were shared across the team — no individual ownership of any one part.
What it is
A steel ball levitating below an electromagnet is the textbook unstable plant: a small drift in either direction is reinforced rather than corrected by the magnetic force. The lab gives you a single-input single-output rig — coil current in, photo-array sensor voltage out — and asks you to turn that into something that holds the ball steady and tracks a reference. We did the modelling on paper, the controller in LabVIEW, and the tuning by hand on the live rig.
How it works
The magnetic force scales as k·i² / x², so the equation of motion m·ẍ = k·i²/x² − mg is nonlinear in both current and position. We took small deviations Δi, Δx around the equilibrium (I₀, x₀), used a Taylor expansion to drop the second-order terms, and pulled out the linearized plant transfer function G(s) = η / (s² − ω₀²), with one pole in the right-half plane — the analytic confirmation that the open loop is unstable.
Equilibrium constants were measured directly on the rig: x₀ with a clamped ruler against the device's built-in scale (the zero point being where the photo-array sensor reads 0 V), I₀ ≈ 0.6 A from the measured 13.4–14 V across the 22 Ω coil, and the sensor gain γ ≈ 5.5 V/in from a ±10 mm sweep around equilibrium.
Controller is a PID implemented inside a LabVIEW VI: the photo-array voltage is translated and gamma-scaled to a position, compared against a user-set reference, run through proportional, integral, and derivative gains, then sign-flipped to feed the current controller. We tuned manually (rather than Ziegler–Nichols) because the plant is unstable enough that aggressive auto-tuning will drop the ball or saturate the amplifier. The procedure: ramp K_P until the ball feels weightless in the hand near equilibrium, add T_D to damp the oscillations, then increase T_I until the steady-state error vanishes without making the overshoot unmanageable.
Where it ended up
A constant 0.5-inch hover holds with essentially zero steady-state error. With ±0.15-inch random reference inputs the response is well-damped with small steady-state errors. Sine tracking stays accurate with small phase lag up to roughly 2 Hz, and square waves come out with rounded transitions and moderate overshoot but stable behaviour at every frequency we tested. The controller handles everything the lab asks for; the obvious next move would be feedforward control with an inverse model to reduce the residual nonlinear effects at the edges of the operating range.