Magnetic levitation with Arduino

Arduino Science
Magnetic levitation with Arduino


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.

6 thoughts on “Magnetic levitation with Arduino

  1. Eric says:

    Oscillation in such a control system is generic if you’re only using proportional control. Using proportional-integral control (the PI in PID) should damp the oscillations.

  2. Anonymous says:

    “We’re sorry, this video is no longer available.” :-(

  3. Norbert Pozar says:

    Thanks for writing about my project!
    I’ve finally posted a detailed description of it on my blog:


Comments are closed.

Discuss this article with the rest of the community on our Discord server!
Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).