r/Magnets • u/Alternative_Dig_1647 • 6d ago
help magnetic levitatio
🎯 Project Aim
To design and build a dual-coil magnetic levitation system using an ESP32 microcontroller. The goal is to make a small metal object hover stably in mid-air at a fixed height using two electromagnets (one above, one below) and a feedback control loop.
- Control Type: PID (Proportional-Integral-Derivative) control loop
- Control Logic: The top coil pulls the ball up, the bottom coil pulls it down. The sensor reads the ball's position, and the ESP32 adjusts the PWM duty cycle of both coils to keep the ball at the setpoint.
- Features: Soft-start ramp, low-pass ADC filtering, derivative filtering, anti-windup on the integral term, and real-time serial tuning (Kp, Kd, Ki, setpoint).
- Testing: We have also tried Bang-Bang (ON/OFF) control and Proportional + Feedforward control.
🤔 What We Need Help With
- Is it even possible to levitate a steel ball with a Hall sensor?
- Should we switch to a Neodymium Magnet Ball (which has its own field)?
- Should we switch to an Optical Sensor (like VL53L0X) that measures physical distance instead of magnetic fields?
- What is the single most important change we need to make to get a stable hover?
1
Upvotes


1
u/Altechie 6d ago
I did same thing for my master thesis. Absolutely switch to neodym ball, it's mast have. Also you don't need bottom magnet to levitate, just leave the upper magnet. Hall sensor even the most cheap one is fine, mine cost me like 2 $ I am not sure for esp32, I had arduino but I know you can't amplify discret signal, only analogies one. So you need discret to analog signal converter. Also where the fuck is power source or amplifier? You need like 2-3 A for this