Levitation is intriguing all of us, isn’t it? I guess that’s no surprise I built a levitation device!
How it works
[Sorry for the vertical video :D]
Both the hardware and software are simple: we have a scavenged electromagnet, an IR analog barrier and an 8-bit microcontroller acting as the regulator.
IR analog barrier
The tape on the left is holding 5 IR LEDs (in black behind the globe) oriented diagonally, towards a single IR photodiode. The higher the sphere is, the less light the photodiodes receive, the less current flows through them. By combining them in parallel, we can increase the detection area. This homemade position sensor has multiple advantages. Surprisingly enough, the linearity is pretty good! It does not require accurate positioning (tape!). If the globe moves sideways, the sensor will interpret this as the globe being too low and it will still stabilize it.
The electromagnet is powered by a 12V DC power supply, switched around 20kHz with a power IGBT. The IGBT is commanded by a PWM pin from the microcontroller, after being amplified by an opamp. (I could have use discrete transistor for this, but, well… I just didn’t think about it I guess) I can increase or decrease its pull force by varying the duty cycle which indirectly varies the current flowing through the coil.
I added a simple RC low-pass filter to visualize the duty cycle easily while tuning the control loop.
This project has also been for me an initiation to the world of systems and control, and maybe the reason why I love it so much!
The microcontroller is a PIC16F690 running at 4MHz. The position of the globe is read with the 10-bit ADC and the PWM module is configured at maximum frequency (20kHz). With this simple MCU, I implemented a Proportional Derivative (PD) regulator that loops at 1kHz.
It’s a project I really enjoyed doing even though I was completely lost at first, but that’s also why I learned so much! It’s the perfect example of making things to understand how they work and I’d encourage people to do the same. Be part of the Maker movement and don’t be satisfied by what you learn(ed) in class/at work!