Levitate a magnet with an Arduino

Watch this Maker suspend a neodymium magnet in midair with the help of an Arduino Mega.

If you went to enginering school, you probably remember a class called “Control of Dynamic Systems” or something similar. One of the most common concepts that you likely forgot the math behind was the “PID,” or proportional-integral-deriviatave, loop. This crazy-sounding name basically means that it takes three mathematical concepts, factors them into an equation, and outputs the correct amount of power to, say, a heating element on an oven.


If you have forgotten the math behind this, you can conveniently just buy a box called a “PID controller,” tune it, and forget all about Laplace transforms. On the other hand, as shown in this Instructables piece, you can make your own PID controller using an Arduino Mega.

As if controlling one power source wasn’t challenging enough, the setup shown below can balance four electromagnets’ power outputs to keep a neodymium “floater” suspended between them. The suspended disk wobbles slightly in the video, so it’s possible that a more developed setup or different tuning values could cut down on these vibrations. Maybe this could even be perfected to the point where these oscillations are nearly imperceptible.

Oscillations or not, it’s really an amazing project, and showcases what can be done with a firm grasp on PID-mathematics and a low-cost microcontroller setup! Mesmerized? You can check out the entire build here.

1 thought on “Levitate a magnet with an Arduino

  1. Pingback: Take a trip down ‘Memory Lane’ with this artistic project | Atmel | Bits & Pieces

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s