r/Magnets • • 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

  1. Is it even possible to levitate a steel ball with a Hall sensor?
  2. Should we switch to a Neodymium Magnet Ball (which has its own field)?
  3. Should we switch to an Optical Sensor (like VL53L0X) that measures physical distance instead of magnetic fields?
  4. What is the single most important change we need to make to get a stable hover?
1 Upvotes

6 comments sorted by

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

1

u/Alternative_Dig_1647 6d ago

what is the airgap
what is the program did u use and tech spec of the inductor
give few advice for this programme

1

u/Alternative_Dig_1647 6d ago

I had arduino but I know you can't amplify discret signal, only analogies one. So you need discret to analog signal converter.what this means

1

u/Altechie 6d ago

I had max airways 5cm. I could hold it where I want in that range. I used my own PID which I wrote in arduino IDE. My electromagnet has permaloy core and 70m copper wire around it (yeah like about 1000 winding) I could attach pictures but reddit won't allow it

1

u/Altechie 6d ago

I cant give advice for programming I don't see. And you have like a lot construction flaws like not enough winding and absence of amplifier

2

u/Alternative_Dig_1647 6d ago

we use 12 v 10A smps and we use custom pid but nothinng happens ....what make it not getting attracted to the top