“There’s a super article in Popular Electronics, May 1996, pp 48-52, 78, titled “Build a Magnetic Ball Levitator”, by James Cicon. It describes how to build an electromagnet with an optical sensor which will keep a hollow steel ball floating in the air about 1/4″ below the electromagnet. This is like the globe of the earth which is suspended in air under an electromagnet that can be purchased for about $125. The material costs for this project is only about $20.” Link.
Build a Magnetic Ball Levitator for $20