Build a Levitating Disco Ball

Electromagnetism, feedback, and the power of disco keep things aloft

In 1979, when I was 11 and enthralled by Star Wars, magnetism held a special appeal. It was the closest thing in the real world to “the Force.” So for our fifth-grade science project, a friend and I wrapped my dad’s iron chisel with wire to make an electromagnet. When connected to a lantern battery, it grabbed, repulsed, and spun bar magnets like magic. But when we got curious and plugged it into a wall socket, the resulting pop and puff of smoke produced an unforgettable jolt.

The experience sparked a lasting fascination with magnetism. So when my son Liam, contemplating what to make for his own fifth-grade science fair, suggested making a magnetic levitation gizmo, I was irresistibly drawn to the idea.

The project turned out to be surprisingly challenging. Initially, we envisioned some simple circuitry that would make a miniature space ship from Star Trek (actually a Christmas-tree ornament) hover with no strings attached. How hard could it be?

I found an electromagnet rated for 6 watts at an online store for US \$15; a set of 10 neodymium button magnets was \$10. I figured we’d just hang the electromagnet from a beam, glue one of the rare earth magnets to the center of gravity of the toy ship, and then manually adjust the current flowing to the electromagnet’s coil until the levitating attraction between the magnets exactly balanced the pull of gravity.

While Liam and a friend built a gallows-like support structure out of Lego bricks, I began breadboarding the circuitry. It dawned on me that I ought to do a quick Web search for levitation circuits. And that’s when I bumped my head against Earnshaw’s theorem.

About 175 years ago, Samuel Earnshaw proved that wherever objects are producing static inverse-square forces—as with magnetism—there is no point in space where the forces balance out in a stable way. The tune-it-and-forget-it system I had envisioned would be impossible.

Fortunately, clever electrical engineering has triumphed where brute physics fails. More searching turned up designs for levitation circuits, all of them variations on a theme: Rather than fixing the power to the electromagnet, you use a position sensor to rapidly adjust it. As the hovering magnet nears the coil, the power sags; as it drops away, the electromagnet’s strength is increased.

For our first attempt, we settled on a design that measures the proximity of the permanent magnet to the electromagnet by using Hall effect sensors mounted on the top and bottom of the electromagnet’s coil. The electromagnet is powered by a pulse-width-modulated current. An op-amp chip subtracts the output of the two sensors to obtain a voltage that measures the strength of the field originating from the permanent magnet floating below the coil. A second op-amp compares that signal to a reference voltage that sets the distance at which the magnet should hover. Any difference between the signal and reference voltage is sent as an error signal to a KA7500C pulse-width modulator, which adjusts the power output to the coil at about 10 kilohertz to counter the error.

With the system built, we set up our table at the science fair. The coil was too weak to suspend anything other than the magnet itself (so no Star Trek spaceship), but it worked—almost. If I kept one finger gently touching the side of the permanent magnet, it hovered for a minute at a time. But without that stabilizing touch, tiny wobbles quickly became big wobbles and shook the magnet loose.

Back home, I resolved to make it work sans stabilizing finger—and moreover to make something useful out of it. Other flashes of memory from the 1970s provided inspiration: I would make a far-out, levitating, color-changing, disco night-light. Yeah, baby!

A mini disco ball was easy to find (there seems to be no object that people won’t shrink and hang on a Christmas tree). The mirror tiles are glued onto a Styrofoam sphere; I simply pried off some tiles, drilled out the core, inserted three neodymium magnets, and then replaced the tiles. A multicolored LED, complete with a wireless remote for selecting any of four groovy color-transition programs, was \$4 (including shipping from Hong Kong). I mounted it to a microphone gooseneck and aimed it at the spot where the ball would hover.

None of the home-brew circuits I found online was strong, stable, and efficient enough to keep a 40-gram disco ball suspended all night long without overheating or daily adjustment. But I found success with the Maglev Plus System, a kit sold for \$73 by Zeltom.

Unlike the designs I had built from scratch, Zeltom’s circuit uses only one Hall sensor, and it relies on a preprogrammed PIC microprocessor to dynamically adjust the coil power, rather than tying together a couple of op-amps to a pulse modulator. The PIC has built-in flash memory; a trio of push buttons lets you tune the circuit to the particular mass and distance you want to levitate and then store that setting. I worked through the day and into the night soldering everything onto the circuit board, hooking up the lamp, power supply, and a power switch, and using tin snips to fashion a rough case for the gadget out of thin sheet metal.

Around 2 a.m., I plugged it in and flipped the switch. Holding the mirror ball about 2 centimeters below the coil, I held my breath. I could hear Obi-Wan over my shoulder: “Use the Force, Luke. Let go.” So I did.

It was like flipping on a funk generator. The room filled with swirling splashes of magenta shifting to tangerine and then cerulean. The effect was hypnotic.

When Liam padded into the kitchen, bleary-eyed, the next morning, the ball was still hanging in free space, gently twisting to and fro. Nothing was overheating, but the ugliness of the case bothered me. So I downloaded AutoCAD’s free 123D Design program and sketched out a suitably high-tech- looking case. I uploaded the file to 3-D printing firm Shapeways, and two weeks later a sleek, blue, \$140 plastic enclosure arrived on my doorstep. Like magic.

This article originally appeared in print as “Disco Fever.”