Very stable magnetic levitator

Introduction

There are different types of levitators where either a metal object or a magnet is kept floating in the air. Some work by repelling the magnet that is floating above the electromagnet and some auxiliary magnets. Some work by attracting a magnet that is floating below the electromagnet. The magnetic field of the electromagnet is controlled using a sensor that detects the position of the floating magnet. This sensor can be an optical sensor, a hall sensor or anything else that can detect the position of the floating object and is fast enough so there is no dead time between the feedback signal and the controlling signal.

The levitator shown in this project uses linear hall sensors (not the switching type of hall sensor) as a sensor to detect the position of the magnet.
Most of the levitator designs using a hall sensor, have 1 linear hall sensor located at the bottom of the electromagnet. This kind of design is difficult to stabilize, since the hall sensor does not only "feel" the magnetic field of the magnet, but also the magnetic field of the electromagnet that is trying to keep the magnet floating in the air. So your feedback signal is disturbed by the magnetic field of the electromagnet and is not a good representation of the position of the floating magnet. This leads to difficulties in maintaining and stabilizing the position of the floating magnet.

Why using a very strong magnet as the floating object and not just a small less strong magnet ?
The stronger the magnet, the less magnetic force you need to keep the magnet floating in the air. With a less strong magnet, you would need higher currents through the electromagnet or more windings on the electromagnet to keep the magnet floating. More windings give more inductance, which also makes the electromagnet respond slower when fast changes in the magnetic field are required to keep the magnet floating.
Using a non-magnetic metal object instead of a magnet as the floating object is not possible with this kind of levitator, since we are using hall sensor
. A hall sensor can not detect the position of a metal object unless there is a magnetic field involved.
The levitator described here is able to keep a strong magnet floating as long as it is powered without going into oscillation after a while. It can really keep it floating for hours and hours without getting overheated.
The strong floating magnet is attached to a weight (the ball). The weight of the ball keeps the magnet from vibrating or wiggling too much.

Note:
The weight of the ball + magnet used for this project is about 70 grams.
T
he magnet is a 1.33 to 1.37 Tesla N45 ring magnet with outer diameter 20mm, a hole diameter of 10mm and a height of 10mm.
TRU COMPONENTS type 506012 bought from Conrad


The project described here is a very stable magnetic levitator that is designed using 2 linear hall sensors (not hall switches, but hall sensors with an analog output). This levitator is capable of keeping a strong magnet + balance weight (ball) floating at a distance of 1.0 to 1.5cm under the electromagnet for an indefinite period of time without the coil heating up significantly.
A bigger floating distance would be possible but then the electromagnet would need a lot more current to keep the magnet floating and would heat up a lot more . The magnetic field falls off at the square of distance, so doubling the distance would not require twice the current, but the square of the current.

One hall sensor is mounted on top of the lifting coil and one hall sensor at the bottom of the lifting coil. The levitator lifts a magnet using the magnetic force created by the electromagnet. In other levitator designs, where the position of the levitated object is detected using a light sensor, the object doesn't have to be a magnet but any metal that can be attracted by a magnet (ferromagnetic metals).
For this project we need to use a magnet as the object we want to lift, because we are using hall sensors. Hall sensors can only detect a magnetic field.

But why do we need 2 halls sensors ?
When you use only 1 hall sensor f.e. under the lifting coil, the hall sensor will not only pick up the magnetic field of the magnet that you want to levitate, but also the magnetic field of the lifting coil. So the magnetic field that you are measuring is not just due to the magnetic object but also coming from the lifting coil. This causes undesired extra positive feedback that is added to the position feedback and will make the levitator less stable (more tendency to oscillate).
It is difficult to stabilize a single hall sensor levitator, but it can be done. Damping can be added to damp the tendency to oscillate by f.e. putting a thick aluminum block just below the floating magnet. The eddy currents produced in this aluminum block will dampen the movement of the magnet so oscillatory behavior is suppressed.
By using 2 hall sensors, one above the lifting coil and one below the lifting coil, both hall sensors will pick up the magnetic field of the lifting coil, but only the lower hall sensor picks up the magnetic field of the magnet that you want to levitate. So when you subtract the 2 hall sensor signals from each other, you eliminate the common mode magnetic signal that is caused by the lifting coil and affects both hall sensors simultaneous. The result of the subtraction is that you end up with a feedback signal that is only determined by the magnetic field of the magnet and not by the magnetic field of the lifting coil.
This gives a much more stable levitation that is comparable with the levitation using a light sensor.
You still need to tune the control loop properly by adjusting the proportional gain (P) and you need a differentiator (D) to stabilize the control loop, but it is much easier to do this with a proper feedback signal.

Note:
The 2 hall sensors are hot-glued on top and on the bottom of the lifting coil with some millimeters of distance between the hall sensor and the metal inside the electromagnet coil so the hall sensors don't saturate completely due to the strong magnetic field of the coil.


The levitator is tuned in a compromise between maximum floating distance and maximum stability without drawing too much power or heating up the coil.
It takes some iterations in tuning the position and gain to get the optimum stability. With too much gain, the magnet will jump up and stick to the electromagnet when adding disturbance f.e. by moving the setup or pushing the magnet a bit out of it's comfortable position. Too much gain also gives the levitator more tendency to oscillate. Not enough gain will make the levitator drop the magnet when adding disturbance. So tuning is all about finding the sweet spot where you can add some disturbance without the magnet dropping or get stuck to the electromagnet.


The control loop is implemented using a proportional gain stage (OPAMP U10), followed by a filter around OPAMP U11. The amplification of U11 changes with frequency going from 2 times at 0Hz to a maximum where the gain gets limited by the gain bandwidth product of the OPAMP.
The levitator is a control system without friction, where a high speed of reaction to changes in the position of the magnet is required. Because we don't need to overcome friction, there is no need for an integrating filter that would eliminate a steady-state error. We need a fast reaction to any slight change in the position of the magnet, because the magnetic field drops quite fast with distance and gravity pulls the magnet down. When the magnet drops a bit, this causes a fast drop of the magnetic field that needs to be counteracted immediately by the electromagnet.
Gravitation pulls at the magnet with a force = m * a (m = mass, a = acceleration in m/s^2), so there is a square relation with time.
Magnetic force drops with the square of the distance. So here there is also a square relation. This asks for a differentiator (D-action) that speeds up the response of the system to small changes in the error signal so the magnet does not drop out of range. The error signal is the measured position of the magnet minus the position set by the position potmeter (setpoint).

The ball will rotate automatically because of the very small fan (using a micro-motor and the tail-propeller of a small helicopter), that is blowing against the side of the floating ball. The LED is added to give some light reflection effects due to the reflective surface of the ball.

Circuit

Pictures

Video