I've been working on a levitating magnet project using a linear hall effect sensor for feedback to the nano to turn on and off an electromagnet.
The nano and hall effect sensor use 5v and the electromagnet and mosfet circuit uses 12v supplied by a wall-wart.
The levitation "works" when the nano is plugged into the PC's USB port or when connected (5v) and powered by a Heath or BK bench power supply. It is very fussy on the 5v power supply.
I soldered up a voltage regulator using a LM7805 (with in and out caps) to supply the nano circuit that measures 5.01v out using the 12v wall-wart for the power in. This way I don't need to be tethered to a PC or bench power supply. Also, I did not want to use the nano's built-in 5v regulator because it might not dissipate the heat since it's so small and the voltage difference is large 12v to 5v. (even though the current draw is very low, maybe 20-30 mAmps) I did not measure but looking at the current gauge on the bench power supply, it looks to be in that range.
After trying the levitation, magnet would oscillate increasingly over a short time and levitate for approx. 10 - 20 seconds.
Later-on:
I measured the actual voltage from the USB port (~4.78v) and dialed in my power supply to 4.58v to achieve the smoothest levitation.
Using the PC's USB port, the levitation is a little wobbly but will levitate indefinitely if not disturbed.
Using the bench power supply, the levitation is pretty smooth and will levitate indefinitely. You can even spin the levitating magnets.
Using the LM7805, as stated above, levitation for approx. 10 - 20 seconds.
I then soldered up an LM317 (with in and out caps) to put out 4.6v (4.59v measured) to try again.
Same thing: levitation for approx. 10 - 20 seconds. Starts to oscillate out of control.
Baffled, I looked at the LM317 output on an older analog oscilloscope. Voltage looked about right and no ripple at all. I checked the output on the range of time bases down to .1 uSec and flat. I then checked my bench power supply for comparison and it looked the same through the time base ranges.
At this point I'm baffled, what am I missing? Why does the bench and USB power supply work and the LM317 not "work". I forgot to mention, the grounds are all connected between the 12v and 5v.
Any feedback would be appreciated.
Thank you.





