Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!

These Ornaments Levitate From Their Christmas Tree with Electromagnets

With only two magnets and a microcontroller, Sean Hodgins demonstrates how to levitate objects in mid-air using Christmas ornaments.

Evan Rust
1 year agoSensors / 3D Printing / Lights / Art

Coming up with the concept

The average Christmas tree is normally decorated with lights, a topper, some tinsel, and perhaps most importantly, a plethora of ornaments. Dangling from their branches on tensioned pieces of string, there is not much to them, at least until YouTuber Sean Hodgins decided to take the concept and run with it. He wanted to remove the string element and replace it with an electromagnet, thereby making a "magically" levitating ornament that never gets tangled.

Building an ornament that is dangling mid-air can be accomplished in a couple of ways. The first involves taking two permanent magnets that always attract each other and then adding some electromagnets inside one of the permanent ones to repel the other side if it gets too close. However, the added complexity and component cost led Hodgins to another solution. Here, a pair of one permanent magnet and one electromagnet resist gravity when powered, with gravity pulling downwards when turned off. By rapidly toggling power states, whatever is attached to the permanent magnet can hover.

Hardware and board design

With the design now sketched, Hodgins had to find a suitable electromagnet that would not attract the permanent magnet when unpowered. After settling on a bare coil, he connected it to an older driver PCB and connected a hall effect sensor to one of the microcontroller's analog inputs. This means the MCU can turn the electromagnet on when the sensor's reading is too low and then off when the reading gets above a threshold. The PCB he created keeps many of the same parts from the driver, including a MOSFET, power management circuitry, and a microcontroller.

A setback

After waiting for his PCBs to arrive from the fab, Hodgins realized they would arrive far too late, if at all, for his project, so he had to resort to building an alternative ornament levitation circuit. This new hardware was comprised of an Adafruit Trinket M0 board mounted onto protoboard. 16 now-soldered and assembled boards later, it was finally time to attach the 3D printed mounting hardware onto each protoboard.

Assembling a tree

For the tree, Hodgins eschewed a traditional tree in favor of building one from scratch. It features a wooden base and solid milled aluminum pedestal, eight branches made from clear plastic tubing, and plenty of channels in which to route the wiring internally.

Evan Rust
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles