Electromagnetic Levitation (Part 1): Sensor Feedback

I have been working with superconducting levitation for a while, which is vastly superior to conventional methods of electromagnetic levitation, and this project was part of my effort to wrap my head around what it would take to reproduce the levitation performance of superconductors using conventional materials & components. This post will be followed up by Part 2, a project that further simplifies the circuitry (sensorless) as well as replicating even more of the nice properties of superconducting levitation.

Here is an example of superconducting levitation. Note how it works just as easily as regular magnets do: as I approach the superconducting material with a magnet, it leaps up to meet the magnet, as another magnet would, except it stops a certain distance away, instead of slamming into it. Likewise, I can daisy chain superconductors together, just like I can attach a bunch of magnets back-to-back:

There are many webpages out there that show how to build electromagnetic levitators. However, the results are usually not as magical as are attained with superconductors, because:

  1. They require careful placement of the object to let the levitator “grab” it
  2. The object is prone to falling or unstable runaway oscillation when disturbed

As can be seen in the video below, my levitator will “grab” a magnet out of your hand, without any careful placement, and it’s stable enough to move the magnet around freely and smoothly. This replicates a bit of the performance of superconductors for levitation:

This post has three more parts:

A. Theory of electromagnetic levitation. 

B. Description of my simple hall sensor based levitator. 

C. What makes my levitator work so smoothly. 

A. Theory of electromagnetic levitation

So, before getting into the project, I figure it is worthwhile to explain briefly what problem is being solved. Why is levitation hard? Magnets can lift things, so can’t you just place magnet A at the right height above magnet B, so that magnet A doesn’t fall, and hangs in air? After all, since gravity’s force is constant, and the force between the magnets varies inversely with the square of the distance between them, there must be a point where they are equal. For example, with the magnitude of the magnetic attraction in blue, and the gravitational force in red, and the distance along the X axis:

Screenshot from 2017-03-23 21:55:08.png

f(x)=1
f(x)=1/(x^2)

There’s a point there around x=3 where the net force is zero! Showing the net force, that is gravity (pulling down) vs magnetic force (pulling up) makes it even clearer:

Screenshot from 2017-03-23 21:55:19.png

f(x)=Screenshot from 2017-03-25 19:35:52.png

So why won’t the magnet actually sit still if it’s positioned at that zero-crossing point? Well, nothing in nature is perfect, and so we won’t place the magnet perfectly at that point of zero force. And, even if we do, any small disturbance, such as an air molecule striking the magnet, will push it away from that point. What happens then? Well, here’s an illustration:

asdfarr.png

Our point of zero force is marked with the blue X. If the magnet drifts a little bit up (to the left in the graph), following the blue arrow, the magnet’s force gets even stronger. That means it moves moves up even more, which makes it stronger yet, and so on, until the magnets slam together, in familiar fashion. Likewise, if the magnet drifts a little bit down, the force from the magnet pulling up diminishes, following the green arrow, and now is less than that of gravity pulling down. That means the magnet falls down some more, which makes the magnet’s force even less, and so on, so that the bottom magnet falls endlessly away from the top magnet (hitting the floor).

This point is not stable, it is a knife-edge of instability, as anyone who has tried this with magnets in their hands can tell you (be careful of your fingers if you do!).

It turns out that there is a theorem in physics, called Earnshaw’s Theorem, that shows this is impossible in all cases. You can’t add more permanent magnets to create more stability, in any configuration. Essentially, Earnshaw’s Theorem implies that you always must control at least one degree of freedom in some way other than static, permanent magnets. That’s why old-school magnetic levitation toys always had the levitated object touching something, to provide stability:

So how is free-floating magnetic levitation possible? Some time-varying force must be introduced to the system to create a zone of stability, where movement away from the balance point produces net force back toward it. One very simple way to achieve this is with diamagnetic materials, for example Bismuth. This is explained very nicely on this page . To put it in the terms we’ve been using here, Bismuth is repelled by magnets, but it doesn’t just repel like a magnet, with force inversely proportional to the square of the distance from the magnet, instead it becomes stronger as the magnet approaches. The Bismuth also provides stability to the magnet’s tilt, because as one side of the magnet approaches it more closely, the repulsion force is also stronger on that side, righting the magnet. Two magnets repelling want to flip over, and so destabilize each other’s tilt, creating yet another barrier to stable levitation.

Here is a video of an experiment I did with Bismuth demonstrating this property. The height is varied by varying the current thru a coil up above the top piece of bismuth, out of view.

However, Bismuth’s diamagnetic repulsion is very small. Superconductors are far more diamagnetic, and this is one of the properties that makes them so useful for levitation.

If we don’t have something very diamagnetic at our disposal, we can create a time-varying force through feedback, such as through active sensor feedback as in Section B below.

B. Explanation of my simple hall sensor based levitator

The basic design is shown in this schematic. Note that, physically, the hall effect sensor is placed in the center of the coil, and so there are 5 wires running from the “head”, the part you see me moving with my hand in the video, to the breadboard (VCC, GND, and VHALL, as well as two for the coil):

HallSensorLevitation (6).png

As you can see, there’s nothing special about the circuit. The basic operation is:

  1. When no magnet is present, the hall effect sensor’s value is low, so VHALL is lower than the HEIGHT_ADJUST voltage. Thus the coil is fully energized, which creates a magnetic field.
  2. When a magnet approaches, it is attracted by this field, and begins to move toward the coil.
  3. As the magnet moves toward the coil, its field* is sensed by the hall effect sensor, raising VHALL.
  4. As VHALL approaches the height adjustment potentiometer’s voltage, the coil is partially de-energized, the magnet’s approach slows (counteracted by gravity), and the system eventually reaches equilibrium** with the magnet at some distance from the coil.

*  Note that the coil’s field also influences VHALL. The sum of these two actually determines the HEIGHT_ADJUST voltage threshold required for a given levitation height. I just figured it out experimentally using a voltmeter. 

** The voltage at the MOSFET gate actually looks like a PWM signal. This is likely caused by a hysteresis effect involving the coil’s own magnetic field. When the coil is energized, it will be de-energized when the magnet is a bit above threshold height, since the magnet’s field must cancel out the negative influence of the coil on the hall sensor. This may actually be a source of efficiency in the design, largely avoiding running the transistor in the active region, at the expense of a small mechanical oscillation. 

Returning to our equations and graphs from the previous section, the force on the magnet vs distance from the coil in this system looks like this:

gimp_levitator_eq.png

f(x)=gimp_levitator_eq.png

The meanings of each of the parts of this equation are:

  • 1: gravity is constant
  • Screenshot from 2017-03-25 19:09:54.png:The hall voltage sensed goes with the inverse square of the distance between the magnet and the coil, as it is linear with field strength at the hall sensor. At a certain threshold (the reason for the -1), set by the HEIGHT_ADJUST voltage, the coil begins to energize, and the current through this coil modulates the field strength. The coil only energizes in one direction, thus the min(0, …).  Note that, in reality, the transition in coil current tends to be quite a bit sharper than this, due to the behavior of the op amp, but this is not important for basic understanding of the system.
  • Screenshot from 2017-03-25 19:12:06.png: The magnetic force varies inversely with the square of the distance between the magnet and the coil.

This seems really straightforward, but if you’ve worked with control systems before, you’ll probably have noted the potential for oscillations to build up in this system. While it does turn out to be possible to use just this circuit to levitate a magnet, it’s very sensitive, and just gently blowing air on the magnet can cause it to enter wild gyrations, ending up with it falling down. While active damping / compensation could help in terms of stabilizing distance from the coil, there’s still no tilt stabilization at all in the system, so moving the coil around will still set up long-lived oscillations.

This video shows the “long lived oscillations” common in even well damped single-axis levitators. There’s simply nowhere for the energy to go (except into the finger at 1:12):

C. What makes this levitator so smooth

Some levitators actively dampen this oscillation: the “executive levitator” desktop style ones even incorporate multiple hall sensors and coils, which achieve damping in multiple degrees of freedom, but my solution was much easier.

A large part of the robustness of superconducting levitation is actually provided by superconducting materials’ AC Losses. Superconductors are able to conduct DC with zero resistance, but whenever the current changes, a there is loss of energy to heat. So, if one imagines a magnet levitated over a superconductor statically, there should be no loss of energy, and thus it can stay levitating indefinitely. However, if the magnet is disturbed, it begins to oscillate back and forth, as its movement induces currents in the superconductor that create magnetic fields that oppose its movement and send it back in the other direction. This might continue forever, except for the superconductor’s AC Losses: each time the current changes, some amount of energy is dissipated as heat. This causes the magnet to return to rest in a static position again.

Following the same principle, for stability I put a plate of aluminium between the coil and the magnet. Being an imperfect conductor, the aluminium dissipates energy and slows down the magnet every time the magnet moves, because a moving magnet induces currents in the aluminium which then create a magnetic field that “pushes back” against the magnet’s motion, and these currents encounter resistance flowing in the aluminium. This replicates the stabilizing effect of the superconductor’s AC losses, dampening every possible degree of freedom, even allowing the coil to move around without dropping the magnet. Given that aluminium is not a perfect conductor of DC, however, the active control circuit is still necessary to control the height of the magnet, as the eddy currents in the aluminium die out quickly when the magnet stays still.

Here is a video that illustrates the stabilizing effect of the aluminium well: