Mekonik used an Arduino board, solenoid coil, hall effect sensor, and some clever coding to hold a permanent magnet in mid-air –
The device uses a small Hall effect sensor (SS19 from Honeywell, available for $0.50 from AllElectronics) to sense the field of the permanent magnet and uses that information to modulate the magnetic field of the electromagnet. Since the sensor is on the electromagnet,
the reading on it is the sum of the fields of the floating magnet as well as the electromagnet. The greatest challenge was separating these two and getting the floating magnet’s field only. After some theoretical research into inductors and the Amper’s law and experimentation, I achieved pretty good stability of a hovering magnet or a magnetic dart or whatever. The result is not completely perfect, some small oscillations are still noticeable. I think that I achieved the limitations given by the Arduino A/D converter.
As you can see, it’s currently a magnetic pull instead of the familiar push levitation – but research continues. In order to get feedback/response to the sensor fast enough, he made some key changes to the Arduino IDE’s serial library. More info plus discussion in the comments of the relevant project’s blog entry.