Magic On Your Desk Via MagLev Toy

Diagram showing the structure of the base.

Magnets aren’t magic, but sometimes you can do things with them to fool the uninitiated — like levitating. [Jonathan Lock] does that with his new maglev desk toy, that looks like at least a level 2 enchantment.

This levitator is USB-powered, and typically draws 1 W to 3 W to levitate masses between 10 g and 500 g. The base can provide 3 V to 5 V inductive power to the levitator to the tune of 10 mA to 50 mA, which is enough for some interesting possibilities, starting with the lights and motors [Jonathan] has tried.

In construction it is much like the commercial units you’ve seen: four permanent magnets that repel another magnet in the levitator. Since such an arrangement is about as stable as balancing a basketball on a piece of spaghetti, the permanent magnets are wrapped in control coils that pull the levitator back to the center on a 1 kHz loop. This is accomplished by way of a hall sensor and an STM32 microcontroller running a PID loop. The custom PCB also has an onboard ESP32, but it’s used as a very overpowered USB/UART converter to talk to the STM32 for tuning in the current firmware.

If you think one of these would be nice to have on your desk, check it out on [Jonathan]’s GitLab. It’s all there, from a detailed build guide (with easy-to-follow animated GIF instructions) to CAD files and firmware. Kudos to [Jonathan] for the quality write-up; sometimes documenting is the hardest part of a project, and it’s worth acknowledging that as well as the technical aspects.

We’ve written about magnetic levitation before, but it doesn’t always go as well as this project. Other times, it very much does. There are also other ways to accomplish the same feat, some of which can lift quite a bit more.

9 thoughts on “Magic On Your Desk Via MagLev Toy

  1. Thanks for the write-up Tyler! It’ll be fun to see if anyone either builds one of their own or extends on this, e.g. doing something useful with the ESP32 or something more interesting than just lighting LEDs on the levitator.

      1. Thanks Daniel! Hmm, after (an admittedly very brief glance) it looks like setting up a Tindie sellers account would basically mean that I would source assembled boards from somewhere, and then repackage/sell them to buyers from Tindie? To be fully honest I’m sorry to say my day job takes time enough as is without adding additional demands 😅 That said, if you want to get a hold of some assembled boards I’ve personally ordered fully-assembled boards from PCBway and had a good experience, and all the files needed for ordering are available in the repository. I assume any EMS would be more than capable of assembling the boards, as there’s nothing particularly demanding. It might also be helpful to set up a page where others (like yourself) can discuss/contribute/etc, do you have any suggestions for what would be a suitable place for something like that?

  2. I’ve had a rotating 9″ Earth in the corner of the room for years and still love seeing it spin. I’m not sure about trying to make something from scratch though.

    1. This is partly due to me starting with an STM32 and adding the ESP32 towards the end of the project (after some friends suggested that an ESP32 could allow for eg. WiFi support), and partly due to me being more well-versed in the STM32 ecosystem. In principle I don’t think there’s anything that would preclude a similar setup using only an ESP32.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.