Levitating A Magnet
Now that we understand how the comparator is going to control the inductor, let's try and levitate a magnet. Op-amps are good at controlling signals, but for larger current applications like this, we'll need to use a mosfet. Turn off power to the circuit we built in the last section and and wire up the following circuit. Make sure not to skip the diode! When an inductor switches off, the magnetic field it created collapses, which can cause a large voltage spike, and may damage the mosfet. The schematic lists a 1N4007 diode, but the 1N5401 diode should work better with flyback current spikes.
With the power still off, turn the potentiometers's knob all the way to one side, such that the reference voltage is set to 5V. Next, turn the power on and verify that the output of the op-amp is reading 0V. Position the magnets between your thumb and middle finger, as shown below. Your thumb will be able to catch the magnet if it gets pulled up to the inductor, and your middle finger is there to balance the magnets and catch them if the magnets fall.
With your other hand, slowly decrease the reference voltage. As you get close to the transition point from the Building the Control Circuit, the magnets should start to levitate. If the magnets jump up to your thumb, increase the voltage again, and then try again. With some practice and small but precise movements, the magnets should be able to levitate.
Being able to read the current from the 12V power supply is a good way to see where the levitation point is. When the magnet is too close, the current should be less than 10mA. With the magnets I'm using, the amount of current being used is around 80mA and I'm able to levitate in a window of 2-3cm from the inductor. With a little bit of practice you should be able to get your magnets to levitate too!