The answer is yes. You can make a magnetic levitator out of digital electronics. They were traditionally made with op-amps & tongue angles. Unfortunately, despite being stable enough to suspend objects in mid air, they're too unstable to translate the objects over time. What's necessary is faster feedback, which isn't possible without a lot of money.

The cheapest method is by sensing the position of a permanent magnet floating in air with a hall effect sensor mounted below the electromagnet. The electromagnet constantly adjusts its power to keep the permanent magnet floating.

The levitators on the internet are all expensive and analog because #1 most people aren't very good at writing software & designing hardware, #2 it's hard to justify getting a microcontroller working for something so simple and #3 magnetic levitation is more stable with a constant field strength, rather than PWM. Unfortunately, it costs a lot to have a dedicated set of analog components for every gadget. The digital circuit is a single circuit that does everything.

The limit with the levitator is no matter how hard you try, the feedback always lags. The solution for levitators is to predict the object position ahead of time, "lead compensation".

This schematic shows specific parts in the simplest digital levitator with a common micro of the time. The key is spudger diodes to prevent blowing out the MOSFET. It also needs a current limiting power supply & a lot of care to program.

A large BJT can be more forgiving than the MOSFET but less efficient. It has enough resilience to not need spudger diodes. Small BJT's won't do it because the current is too high. A full H-bridge can increase margins by providing some pushing force if the object gets too high, but isn't necessary either.

The hall effect sensor is very fragile. One got destroyed by the USPS. The more sensitive the hall effect sensor is, the better.

Not much to see in the real thing. Here's the source code for an early levitator.



The source code is useless unless you use gpasm, exactly the same programmer, and exactly the same bootloader we use, but it gives you an idea how the algorithm is done in PIC18F1320 assembly language. This source code only damps based on falling speed, not rising speed.

A $2 magnet from Radioshack is lifted.

The electromagnet retains a lot of flux when it's off and it saturates the hall effect sensor when it's on. The solution is to pulse the electromagnet and take height readings after a certain amount of time when it's off.

38 MB

A dream application of levitation was manipulating objects in mid air. Have a movie of different objects being levitated by different algorithms. One of the levitations was an algorithm that changed height periodically, but only the tiniest amount, and it eventually failed.

Here we have a method for winding very large electromagnets with a hand drill. The trick is to use balsa as temporary end pieces and tape the wire to the balsa. The drill must be capable of very slow RPM. The magnet wire doesn't need to be wound perfectly, just evenly enough to look like a cylinder. The balsa can be ripped off when finished.

Removing the bolt head does nothing unless you use the H-bridge to repell. Coreless electromagnets don't work.

Early contact lens washing machine

Shaking stuff in mid air is very hard. For shaking, the least sensitive hall effect sensor was better because the gap under the electromagnet needed to be as small as possible.

1280x720 8 MB movie

(C) 1997-2017 Starving, flat broke Programmers
Hosted all these years by Sourceforge