This is an Arduino based electromagnetic levitation system.
It levitates a small magnet (with stabiliser) above a electromagnet (a large solenoid).
A hall effect sensor is below the solenoid, providing measurements of the magnetic fields. Here is the process on how it works:
The electromagnet is turned on, the magnet lifts up. The hall effect sensor is 'triggered' and the electromagnet is turned off. The magnet drops and 'un-triggers' the hall effect sensor, which then turns the electromagnet back on.
This happens very quickly which gives the appearance of a levitating magnet, and it is fairly stable - there are no noticeable oscillations.
The Arduino loop is running without any delays, and simply checks the hall effect sensor value and switches the transistor driving the coil directly. There is no PWM / PID controllers as it oscillates naturally.
If you have any questions please send me a message / comment.