Why is my magnetic levitation experiment not working?

In summary: The problem is that the ring magnet I bought (of unknown strength) was too weak and would fly off the object within 0.001 seconds.Second ExperimentUsed the same schematic as the first experiment, but with a ferrite core instead of a ring magnet. The ferrite core made the electromagnet alot stronger and it suspended the object without any problems, however it was quite violent and crashed a few times.Third ExperimentUsed the schematic as the second experiment, but with the hall sensor below the electromagnet. The problem is that the hall sensor is too slow to detect the movement of the ring magnet, and the system would fail every time because
  • #1
Woomir
11
2
[Mentor Note -- Two similar thread starts merged into one]

Hey all,

I have been working on this project for a while now, which features suspending an object midair through the use of magnetic levitation principles. Cool right? And so I have been researching and trying, even finding ground breaking information on this forum (describing how the set up should be) but yet I cannot for some reason get it to work.

The parts I have are:
- Arduino Nano
- Op Amp
- 2 Hall Sensors
- Resistors
- Neodymium magnets (N38) 8X3mm
- Hall Effect Sensor (SS496)
- Dual H Bridge
- Power Plug 12V 2A
- Four solenoids (420 turns) taken from a DIY Magnetic Levitation Kit
- Ferrite Ring Magnet (Unknown Strength) also taken from DIY Levitation Kit
(I took both of them because they worked when initially testing them whilst still attached to the original product.
- *Alt Experiment: Ferrite Core (10mm height, 100mm diameter, 60mm diameter of internal ring void) & 120m copper wire (unknown number of turns, 59mm height, 56mm diameter)
- MOSFET N Channel IRF620 Transistor
- TC4420 MOSFET Driver

I mostly used the set up shown on this article: (https://www.instructables.com/Arduino-Air-Bonsai-Levitation/) but when coming to the actual testing, no repulsion was happening, but instead was the burning of the plastic on the jumper cable occurred as it was connected to one of the copper coils. Unlike when the parts were attached to its original products, there was no suspension happening, and instead violent crashes and/or nothing.

I even tried doing it with one copper coil (120m, turns number unknown) with a ferrite core. The set up for this test was just one copper coil inside a ferrite ring magnet with a ferrite core (10mm diameter, 50mm height) using the schematics shown in this video (I did not use a Diode though) (https://gyazo.com/6f4fc0b56f6245a03af7b6761fd177af)
Arduino Code:
C:
int set_point = 457;  // settings
int sensorPin = A0;
int ENA = 2;
int IN1 = 3;
int IN2 = 4;
int sensorValue = 0;

void setup() {
  pinMode(ENA, OUTPUT);
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  sensorValue = analogRead(sensorPin);
  Serial.println(sensorValue);
  analogWrite(ENA, 255);
  if ( sensorValue <= set_point){
    digitalWrite(IN1, LOW);
    digitalWrite(IN2, HIGH);
  }
  else {
    digitalWrite(IN1, HIGH);
    digitalWrite(IN2, LOW);
}
}

Lastly, I tried the final experiment, being to suspend the object below the electromagnet. With the same schematics as the previous paragraph excluding the ring magnet and having the hall sensor below the electromagnet, I was fairly confident that this experiment would suffice. Unfortunately, by the time I started, the system showed instability and would, as previously, be too weak or levitate for 0.001 second before flying off into oblivion.

What exactly am I doing wrong here? Why is the electromagnet so weak and too slow to levitate the magnet? Have I missed something?
One thing to note about the first experiment is that I did not do any proper calculations for it, and instead went ahead and just tried it after setting everything up. I thought everything would work as it did in the old kit, but that just was not the case. Same for the levitation below the electromagnet, my thought pattern was that as the copper wire was long enough (being 120m long) it would suffice and be strong enough to work. Therefore, I am not sure if this mistake is the only one causing me problems, or if there is more to it.

I also see most people going the analogue route by just using raw components such as not gates, transistors, capacitors, op amps, etc, and have it successfully working, and I'm not sure if this is the way it is actually supposed to be done, as I was trying to achieve such Digitally through the Arduino.

If I have missed any details, please let me know. I appreciate any and all help!
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Hey all,

So I have recently been working with Magnetic Levitation, which is basically levitating an object in mid-air through the use of electromagnets. I have been researching ways and means to do it and have found three different methods of doing it:

Levitation by suspending object below electromagnet
Levitation by suspending object above one electromagnet
Levitation by suspending object above four electromagnets

All three in which I have tried and failed horribly.

My equipment:
- Dual H Bridge L298N
- 8x3mm N38 Magnet
- Four (420 turns) coil solenoids (taken from some magnetic levitation kit online) 21mm Diameter and 15mm height
- Ring magnet of internal diameter 60mm, external diameter 100mm and height 10mm
- LM324 Op Amp
- Resistors
- 120m (unknown turns) coil electromagnet with no core. Specs: 59mm Height, 56mm Diameter
- Ferrite Rod, 10mm Diameter, 50mm Height (core for above electromagnet)
- MOSFET N Channel IRF620 Transistor
- TC4420 MOSFET Driver
- Arduino Nano (Output 5v)
- DC 12v 2A plug
- SS496A Hall Sensor

First Experiment
Followed a tutorial revolving the four solenoid idea, basically it requires a ring magnet and four solenoids inside to basically "balance" and add extra strength to the solenoids. Hall Sensors are facing opposite each other as in one sensor facing the X axis of the solenoids and one hall sensor facing Y. Schematic basically follows this tutorial including the Arduino code named FAE attached (https://www.instructables.com/Arduino-Air-Bonsai-Levitation/)
Status? Fail. Jumper cable connected to the copper cable of the solenoid started to melt, nothing was happening and solenoids were just becoming an induction cooker.
Though I admit, I did not calculate for anything properly here, as I assumed everything would work perfectly based on the fact that the kit I had ripped this from worked perfectly.

Second Experiment
Followed another tutorial similar to the first, attachment named "Maglev Pic" but I used this without a Diode (as I was lacking one at the time and thought it would be unnecessary) revolved around using just one electromagnet, tutorial found here
()

Code:
int set_point = 457; // settings int sensorPin = A0; int ENA = 2; int IN1 = 3; int IN2 = 4; int sensorValue = 0; void setup() { pinMode(ENA, OUTPUT); pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); Serial.begin(9600); } void loop() { sensorValue = analogRead(sensorPin); Serial.println(sensorValue); analogWrite(ENA, 255); if ( sensorValue <= set_point){ digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); } else { digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); } }

I used a MOSFET Driver paired with a MOSFET and did another test but with an H bridge. The result you ask? Fail; the power of the magnet was too weak, getting close to the sensor would vibrate the magnet alright but that was it. Nothing else would happen. Any nail, bolt, screw I found I would test and it would just fail.

Third Experiment
Third experiment would just be the electromagnet but levitating the object below the solenoid. The core, as before, would be a ferrite core(as for some reason, Iron rods have disappeared from the market completely). The electromagnet would basically be on top of my desk, with the hall effect sensor being below the desk looking something like this:
HallEffectSensorPaintPicasso.jpg

The Hall sensor would be connected to my Arduino, sending information of how close a magnet would be to itself and having the magnet apply repulsive or attractive strength depending on the distance of the magnet(basically similar concept to previous experiments) I was fairly confident that something like this would be simple enough as hanging systems often tend to be more stable, what also boosted my confidence was the current being given to the system through the 12V 2A input, as 2A being applied to a 120m (unknown turns) coil would generate a lot of attractive force. I used the same code as the single electromagnet one, but yeah I underestimated the difficulty of the project and got it wrong, again.

What I want to know is, where did I go wrong on this? I know for a fact that during my H Bridge tests I did not account for the current draw going inside the electromagnet, along with not properly calculating the magnetic force generated and total weight that could be sustained for the initial experiments as I thought it would work regardless of calculation. What else did I miss? Should I just have added more current into the mix somehow? Did I miss a component or few? Can it not be done digitally (Arduino wise)? I have been trying to work around this for days, researching for more answers but I always end up nowhere, and I would just appreciate pointers, advice from ANYONE that has done this before. Please correct me on my mistakes, and let me know if I have missed any other details in my experiment explanation.
 

Attachments

  • Maglev Pic.JPG
    Maglev Pic.JPG
    55.6 KB · Views: 77
  • #3
There are several possible reasons why your experiments are not working, so the recommended approach is to simplify the problem. I suggest starting with a simpler setup - an electromagnet, a variable power supply, and means of measuring both voltage across the coil and current through the coil. Set the object at various distances from the electromagnet. The closest distance will almost touching the electromagnet, the farthest distance will be the farthest distance at which you want the electromagnet to pick it up. Then find the minimum voltage and current that picks up your object. You can use either AC or DC power, but realize that the voltage will be different for AC vs DC power. Plot the voltage and current required vs distance because you will need that for the next step.

Variable power supplies can be very affordable. This one is adjustable from 0 to 30 volts and 0 to 5 amps, and costs about $100 US. I have no experience with this particular supply, it was a random choice from a random supplier.
Power supply.jpg

Power supplies are available from Digikey, Mouser, Newark and other suppliers.
 
  • #4
You will also be dealing with enormous "flyback" voltages in the control loop; i.e., the power supply has to be well protected.
 
  • #5
I would definitely put a diode in the circuit in the direction of A0 or a LPF before A0.
 
  • #6
Hey guys
I appreciate all your responses and apologise for the late response myself, as I had put this project on hold to get all the other parts. Given the nature of this guy's video, I have moved on to try and achieve levitation through suspending an object below the solenoid.

I got the diode as requested because yes, you guys are correct there are always flyback voltages with inductors, so I needed to get one in order to not cause problems on the circuit.
I also got a soft iron rod to act as the core of the electromagnet. This gave it a new inductance value of 49.0mH. Calculated its strength value to be at 1-3Newtons.

An IRF620 Mosfet was used with a MOSFET driver. Mosfet driver was connected to the mosfet by having 12V connected to the VDD of the MOSFET driver, input of the gate driver connected to an arduino digital pin, ground connected to ground of 12V and the other side's output connected to the "Gate" of the mosfet. When testing it out, it did not operate as needed. No high speed switching occurred. This was the same schematic followed by the guy's video I just linked. Did I mess up in wiring my gate driver to my mosfet?

Furthermore, are there any additional calculations I need to do?
 
  • #7
Since the object has a tendency to fly off if things are not just right I recommend using something not sharp or pointed so you don't poke your eye out. Had to say it... Or just wear safety glasses.
 
  • #8
bob012345 said:
Since the object has a tendency to fly off if things are not just right I recommend using something not sharp or pointed so you don't poke your eye out. Had to say it... Or just wear safety glasses.
Yeah they are a must when it comes to these experiments so I always wear them. Thank you for your concern. Furthermore the object that has to be levitated, does it matter what material it is? Because I just use small cylinder neodymium magnets
 
  • #9
Woomir said:
Yeah they are a must when it comes to these experiments so I always wear them. Thank you for your concern. Furthermore the object that has to be levitated, does it matter what material it is? Because I just use small cylinder neodymium magnets
It seemed from the video what is actually being levitated is another small magnet which then holds some other object but that object should probably be non-magnetic.
 
  • #10
bob012345 said:
It seemed from the video what is actually being levitated is another small magnet which then holds some other object but that object should probably be non-magnetic.
Are there any more advanced tutorials with Arduino's regarding magnetic levitation that you know of? Because I have been working at this for days and I'm still struggling with this. Furthermore which is viable? Levitating above or below? I'm interested in also doing the four solenoid levitation, but for some reason even though I have calculated it to lift 1kg of weight, it can't even hold anything up. How am I supposed to wire it up? I'm just confused!

The four core experiment I tried was based on this: https://www.instructables.com/Arduino-Air-Bonsai-Levitation/
Please help me out here guys.
 
  • #11
Woomir said:
Are there any more advanced tutorials with Arduino's regarding magnetic levitation that you know of? Because I have been working at this for days and I'm still struggling with this.Furthermore which is viable? Levitating above or below? I'm interested in also doing the four solenoid levitation, but for some reason even though I have calculated it to lift 1kg of weight, it can't even hold anything up. How am I supposed to wire it up? I'm just confused!

The four core experiment I tried was based on this: https://www.instructables.com/Arduino-Air-Bonsai-Levitation/
Please help me out here guys.
https://getyarn.io/yarn-clip/5f23503d-54b3-4ebc-b8f3-d8796db562b5
 
  • #12
  • #13
Woomir said:
Hi thanks for your response, are you able to explain why papers around magnetic levitations often have the f(x,t) = i^2/2 dL(x)/dx ? Furthermore, how does C(i/x)^2 come about?

Reference papers:
Design and Implementation of a Controller for a Magnetic Levitation System YING-SHING SHIAO
https://gyazo.com/7e2d5863e0c164cc8949476dd8f92c37
https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=5570565
I don't know the details of the derivation for this setup in the paper but in general, if you look at the Feynman Lectures of Physics Vol 2 chapter 17 page 13 you will see in the case of two coils carrying currents ##I_1## and ##I_2## the force between them is of the form ##F \Delta{x} = I_1 I_2 \Delta{M}## where ##\Delta{M}## is the change in mutual inductance. That is the same form as the equation you quoted above. In the paper ##L(x) = L + \frac{L_0X_0}{ x} ## so they set ##C=\frac{L_0X_0}{ 2}## for convenience.
 
Last edited:
  • #14
bob012345 said:
I don't know the details of the derivation for this setup in the paper but in general, if you look at the Feynman Lectures of Physics Vol 2 chapter 17 page 13 you will see in the case of two coils carrying currents ##I_1## and ##I_2## the force between them is of the form ##F \Delta{x} = I_1 I_2 \Delta{M}## where ##\Delta{M}## is the change in mutual inductance. That is the same form as the equation you quoted above. In the paper ##L(x) = L + \frac{L_0X_0}{ x} ## so they set ##C=\frac{L_0X_0}{ 2}## for convenience.
Okay so I checked the book out along with an Electric Machinery book and yeah it makes a lot of sense now. However, C is still bugging me, but for a different reason now.

You know for a fact that C=\frac{L_0X_0}{2}, which is clearly apparent as there are textbooks and guides both on the paper and the books you linked showing that this is the case, yet tell me how each of the authors of these papers later obtained values for C? It's Units are in N*m^2/A^2 and I'm genuinely confused as to how I'm supposed to actually get these values for my project. The papers don't explain how you get them, other than mentioning the words "inductance" and nothing else other than straight up showing that the C that was formerly C=\frac{L_0X_0}{ 2} somehow has a value of its own now.

Examples:
1648201893774.png

[Figure 1] Taken from T.H. Wong's paper: Design of a Magnetic Levitation Control System?An Undergraduate Project. https://ieeexplore.ieee.org/document/5570565

1648201932929.png


[Figure 2] Taken from Juan Sebastián Lafuente Larrañaga's paper: Design and Development of a Digitally Controlled Magnetic Levitation System https://addi.ehu.es/bitstream/handle/10810/36694/MasterThesis.pdf?sequence=1&isAllowed=y

The below papers are conflicting in a sense that they have different methods of obtaining C and the Inductance L(x) = L + \frac{L_0X_0}{ x}, but overall the same in units, as each of them always get the units of N * m^2/A^2
where:
N must be Newton
m = ??
A is Area
Bibliography (Other papers which basically do the same thing):
  1. https://ieeexplore.ieee.org/document/5570565
  2. https://addi.ehu.es/bitstream/handle/10810/36694/MasterThesis.pdf?sequence=1&isAllowed=y
  3. https://ieeexplore.ieee.org/document/8986710
  4. https://www.sciencedirect.com/science/article/pii/S2405896316301513
  5. - I tried to leave this as a link but idk man.
  6. https://www.sciencedirect.com/science/article/pii/S1474667016430399?via=ihub
 
  • Like
Likes bob012345
  • #15
I think ##m## is meters and ##A## is Amps.
 
  • #16
bob012345 said:
I think ##m## is meters and ##A## is Amps.
How do i determine/calculate this "magnetic constant" though?
 
  • #17
Woomir said:
How do i determine/calculate this "magnetic constant" though?
I have to look into it...
 
  • Like
Likes Woomir
  • #18
bob012345 said:
I have to look into it...
Ok, let me correct myself. If you were referring to formula 11 in your figure

$$k_c = \frac{\mu_0 A N^2}{4}$$

then ##N## is the number of turns of wire in their setup, ##A## is area in ##m^2## and ##\mu_0## is the magnetic permeability in units of ##\frac{N}{A^2}## where here ##N## is Newtons and ##A## is Amperes.
 
  • #19
I just came back with a fresher mind on things, and I just realized this.

It's true that each author of the paper have their own experimental calculations for determining the inductance change over distance with a ferromagnetic object. This, when combined with the Faraday inductance energy stored, create an equation of the electromagnet's force in respect to distance and current.
1648232566195.png

You basically get the above result when combining the inductive equation for energy, inductance depending on distance and application of Taylor Series.

Since the system is not linear, Taylor's Series had to be applied as you can see the results above. An assumption had to be made(like other papers) that $$C\frac{i_0^2}{x_0^2}$$ was the force required to first lift the electromagnet, along with what you see as f1 being the linear dynamics required to keep the levitated object stationary. This would make $$f_0$$ as shown in the above figure, equal to mg, as mg is basically the weight of the ball.

Then it hit me, why don't I just equate the two? Surely if $$mg = C\frac{i_0^2}{x_0^2}$$ then would it not be logical to say that $$C=mg\frac{x_0^2}{i_0^2}$$ when rearranged? I was shocked when I missed that, because it made sense to remove it the first time, but did not even hit me when I realized I could actually equate C to mg(weird).

But my issue now is finding the distance and current. What am i supposed to do for them? Is that just the amount of current needed to lift a weight of mg over x distance?
 
  • #20
Woomir said:
I just came back with a fresher mind on things, and I just realized this.

It's true that each author of the paper have their own experimental calculations for determining the inductance change over distance with a ferromagnetic object. This, when combined with the Faraday inductance energy stored, create an equation of the electromagnet's force in respect to distance and current.
View attachment 298931
You basically get the above result when combining the inductive equation for energy, inductance depending on distance and application of Taylor Series.

Since the system is not linear, Taylor's Series had to be applied as you can see the results above. An assumption had to be made(like other papers) that $$C\frac{i_0^2}{x_0^2}$$ was the force required to first lift the electromagnet, along with what you see as f1 being the linear dynamics required to keep the levitated object stationary. This would make $$f_0$$ as shown in the above figure, equal to mg, as mg is basically the weight of the ball.

Then it hit me, why don't I just equate the two? Surely if $$mg = C\frac{i_0^2}{x_0^2}$$ then would it not be logical to say that $$C=mg\frac{x_0^2}{i_0^2}$$ when rearranged? I was shocked when I missed that, because it made sense to remove it the first time, but did not even hit me when I realized I could actually equate C to mg(weird).

But my issue now is finding the distance and current. What am i supposed to do for them? Is that just the amount of current needed to lift a weight of mg over x distance?
You will have to examine the setup in the paper to determine what ##x_0## is. Or you can experiment with different distances and currents that are in the same ballpark as in the paper.
 
  • #21
bob012345 said:
You will have to examine the setup in the paper to determine what ##x_0## is. Or you can experiment with different distances and currents that are in the same ballpark as in the paper.
I guess that may be the case, so overall I can just use any distance and current right? For example since I am working with a Power Supply of 12V 1A, I will use 1A as the current and some other random distance as x. Wow, it all clicks now 🤣🤣🤣

I have decided to use a distance of 8mm and a current of 1A from the Power Supply, now when I initially measured the current in my inductor, I just got 2A(??) so I may have to do that again.

Overall, this is it right?
 
  • #22
Woomir said:
I guess that may be the case, so overall I can just use any distance and current right? For example since I am working with a Power Supply of 12V 1A, I will use 1A as the current and some other random distance as x. Wow, it all clicks now 🤣🤣🤣

I have decided to use a distance of 8mm and a current of 1A from the Power Supply, now when I initially measured the current in my inductor, I just got 2A(??) so I may have to do that again.

Overall, this is it right?
Is it right? I am not an expert on this experiment and just offered the best advice I could so you will have to see what works to raise the weight you want regarding distance and current. The distance and current required obviously depend on what weight you are trying to lift and the details of the setup. So basically my advice is to start with what seem close to the paper and tweat things till it works. But you now have a better understanding of what's involved.
 
  • Like
Likes Woomir
  • #23
bob012345 said:
Is it right? I am not an expert on this experiment and just offered the best advice I could so you will have to see what works to raise the weight you want regarding distance and current. The distance and current required obviously depend on what weight you are trying to lift and the details of the setup. So basically my advice is to start with what seem close to the paper and tweat things till it works. But you now have a better understanding of what's involved.
Got it, nevertheless I really appreciate the guidance you gave me man, learned a lot in such a short time.

I hope this thread helps someone else in the future too.
 
  • Like
Likes bob012345

1. How does magnetic levitation work?

Magnetic levitation, also known as maglev, works by using magnetic forces to lift and suspend an object in the air. This is achieved by using two sets of magnets - one set on the object and one set on a base or track. The magnets on the object have the same polarity as the magnets on the base, causing repulsion and allowing the object to float.

2. What are the benefits of using magnetic levitation?

Magnetic levitation has several benefits, including reduced friction and wear, increased speed and efficiency, and decreased noise pollution. It also eliminates the need for physical contact between the object and the base, making it ideal for transporting delicate or sensitive materials.

3. What are the main challenges or issues with magnetic levitation?

One of the main challenges with magnetic levitation is the high cost of implementing and maintaining the technology. It also requires a stable power source and precise control systems to maintain the levitation. Additionally, maglev trains may face resistance from traditional transportation systems and face regulatory hurdles.

4. What are some real-world applications of magnetic levitation?

Magnetic levitation has been successfully used in transportation systems, such as maglev trains and high-speed rail. It is also used in various industrial processes, such as material handling and sorting. In the medical field, magnetic levitation is used in magnetic resonance imaging (MRI) machines.

5. Are there any safety concerns with magnetic levitation?

While magnetic levitation is generally considered safe, there are some potential safety concerns to consider. Strong magnetic fields can interfere with electronic devices, so precautions must be taken in sensitive environments. There is also a risk of accidents or malfunctions, which could result in the object falling or colliding with other objects.

Back
Top