Here’s a great magnetic levitator build. [Scott Harden] dug up the link after seeing that awesome rotating globe this morning. This version hangs objects below an electromagnet but it has a sensor system to provide a constant distance between magnet and object even if the payloads are a different weight. This is done with a couple of infrared sensors. One acts as a reference detector, always viewing an IR LED in order to get a baseline measurement. That measurement is compared to a second detector mounted slightly lower. The circuit adjusts the electromagnetic field, making sure the object is always breaking the lower beam but never interrupting the reference beam. No microcontroller needed, this is handled with a couple of OpAmps. See it in action after the break.