Skip to content

fsantagostinobietti/mymaglev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyMagLev

Yet another magnetic levitation project. This is my implementation!

LEVITATIO NON DISPUTANDUM EST!

As you can see the main difference between mine and similar projects is the position of hall sensor.

Usually it is placed just below electromagnet with its sensing face pointing down. It would be the best solution, but it didn't work for me! Magnetic field generated by electromagnet was detected by hall sensor, so that it was not able to measure levitating magnet position correctly. For this reason I finally came with the idea to place sensor under levitating magnet (with sensing face pointing up). This way hall sensor is free from electromagnet interference.

Demo

1_PID_with_delay.mp4
ufo.mp4

Circuit schema

Note

Diode in parallel with electromagnet it's very important since it works as a flyback diode.

If you want to deep dive in the role of resistor R2 used in pair with flyback diode have a look here.

Resistor R1 is used as a pull-down resistor for MOSFET gate input pin.

Bill of materials

  • Electromagnet ZYE1-P50/27 (DC=12V, R=22ohm, L=30mH (?))
  • Neodymium magnets N52 (12x3 mm)
  • Hall sensor 49E (TO-92 package)
  • Arduino Uno R3 (compatible clone)
  • Transistor N-channel MOSFET IRF1404 (TO-220 package)
  • Diode 1N4007
  • Resistors - 100k ohm, 330 ohm
  • Power supply 12V DC

Control algorithm

To obtain levitation even for a small permanent magnet a closed control loop is needed.

Simplest algoritm is a switch on/off near the equilibrium position. Sometimes it is called the easy way. I was not able to implement this control in my project, since it was too instable.

I had to implement a more sofisticated PID control algorithm. In this scenario Arduino controls electromagnet power in a nearly continuous way from 0 (off) to maximum strength. This is achieved using a PWM signal outputted by one of Arduino digital pins.

Stability improvements

Small changes in design (hardware or software) can affect stability a lot. For example:

  • Intruducing a small delay (less than a millisecond) between changes of electromagnet power, improved stability in my project.

    This is due to PWM implementation behaviuor: every time a change in PWM value occurs, its pin output is reset to ON value. This produces a spike in the output power. To mitigate this issue a dalay needs to be introduced to avoid too frequent changes.

Next steps

  • Improve stability even further
  • Understand why hall sensor placed just below electromagnet doesn't work for me
  • Understand why simple "switch on/switch off" control algorithm is not enough to maintain stable levitation in my project

Related projects

About

Magnetic levitation project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published