Arduino 16: Magnetic Levitator Optically Controlled
Here’s the latest project, an optically-controlled magnetic levitator using the Arduino.
The OSEPP Uno clone runs a sketch which senses the position and velocity of the levitated object, and sends a switching signal to a power mosfet which switches a high-current pulse to the electromagnet coil. The program also samples and corrects for changes in ambient light, and allows you to change a stability parameter over the serial line while the system is running. Clever programming from Simon Monk (link below).
I found a bunch of Arduino levitators using Hall Effect sensors, but I didn’t have any in my boxes, so I wanted to see if an optically-sensed system would work well. I searched and found this one which was set up originally with a phototransistor sensor, but mine turned out to be too sensitive so I changed to a CdS photoresistor along with a 10k fixed resistor wired together as a potentiometer and used the voltage output of that to feed to the Arduino.
Here’s where I found the program sketch. I’m using it as-is, except I bumped up the starting value of “B” to 160. I’m still not sure if I’ve got the optimum value but the system as shown is pretty stable.
Thanks, Simon, “dangerouslymad”, whoever you are! The program is pretty clever. I wish I could afford to buy your books….