I use a coil (450 r-0.5 mm) a hall sensor inside the coil and a mosfet as a switch for the current to the coil. The diode protects the mosfet from the back emf of the coil. A resistance controls the current to the base of the mosfet. The coil attracts the magnet , then when the supply stops the magnet begin to fall , the supply to the coil begin again and attracts the magnet again .This happens many times per second and the magnet seems to stay in the same place.
I try to find a shematic for the opposite effect. The object that levitates to be up and the electromagnet to be down.I' ve seen a system of 4 coils and 2 hall sensor but I cannot find it's shematic .Doew anyone can help? Thank you. You can watch this experiment here: