Magnetic levitation

Thanks much for sharing. I have a very similar project, but I'm driving the magnet through a D/A and then an opamp instead of with a PWM signal. I'm wondering if you ran into problems with the hall effect picking up both the field of the electromagnet and the field of the levitated magnet. I was planning on using two hall effect sensors (one at each pole of the electromagnet) and looking at the difference in the signals. This should give a good reading on the levitated magnet.

Also, how did you come up with your PID values? Did you model the system in Matlab or something similar? Or did you just experimentally come up with the values?

-Patrick