ferrite magnets and neodymium magnets are not only useful when it comes to securing important documents to your whiteboard but are also a ton of fun to play around with as you probably already know such permanent magnets have two magnetic poles worn off and one South Pole which both create a magnetic fields and while the same magnetic polarity is created reports of force opposing magnetic polarity is create an attraction force this on the other hand would mean that if we position one magnets exactly above another magnets with the same polarities facing each other we could suspend an object in midair this phenomenon of suspension in midair happens when we counteract the weight force with an equal opposing force in our case the repulsive force of the magnets now you can try this small experiment at home and we'll always come to the conclusion that such a suspension is only possible for a couple of milliseconds before the magnets falls down to earth the problem of the setup is described in Earnshaw's theorem which states that there is no equilibrium position in a static electric or magnetic fields so in this video we are going to try to work around this theorem and hopefully find out how we can achieve magnetic levitation let's get started this video is sponsored by jlc PCB where many engineers turn designs into reports to make projects more professional order high-quality PCBs for insanely low prices currently even were free shipping the solution to our problem is this metal cylinder with two wires coming out of it by applying its nominal voltage of 12 volts to its wires current flows through its which apparently turned it into a magnets but of course not a permanent magnets by removing its power source the ferromagnetic screws are no longer attracted by it which means this is an electromagnet now if you do not have one of those laying around you can easily build one by winding a lot of enamel copper wire around the ferromagnetic rods like screw and powering the coil afterwards with a voltage source but we are getting off topic here the reason why an electromagnet is the solution to our initial problem is because it's magnetic field is not static we can turn it on / off whenever we like but simply replacing the lower permanent magnets is not a solution either since the repulsive force would still not create a stable system you can think of it as trying to balance an object on the palm of your hands without moving it does not work so instead we should position the electromagnet above the permanent magnets whose attraction forces would now create a more or less natural stability next we need a closed-loop feedback system which tells our electromagnet to turn on or off logically the electromagnets would need to turn on when the permanent magnets falls below a certain threshold value and turn off when the permanent magnets gets too close to the electromagnets a suitable sensor for this task would be this SS 495 a linear Hall effect sensor by connecting it to five volts according to its datasheet pin out and measuring its output voltage with a multimeter we can see that its output voltage decreases or increases from a start value of 2.5 volts depending on which polarity of the magnets gets close to it so by positioning it underneath both of our magnets we could tell the electromagnet to turn on when the which is below 2.5 volts and turn off when the voltage is above 2.5 volts this way the permanent magnets would theoretically oscillates and thus be suspended in midair in order to simplify the required circuit a bit though I got myself that pretty much circuits for my Hall effect sensor this one offers an analog and digital outputs and it's based around an LM 393 comparator C by using the continuity function of my multimeter and thus reverse engineering the circuits I came up with this basic schematic now when the permanent magnets gets too close to the Hall effect sensor its voltage value falls underneath 2.5 volts since the non-inverting input of the comparator is connected to a voltage divider which creates 2.5 volts this input has a higher voltage than the inverting input and thus the output gets put higher to 5 volts through the pull-up resistor this is basically the signal that we need to work with but the circuit also includes a second comparator stage which pretty much only inverts the signal in order to illuminate an LED which we can later use as an indicator to find a just at the threshold value all there was left to add to the circuits was basically a MOSFET driver and MOSFETs to turn on / off the electromagnets according to the Hall effect signal so I gathered all the mandatory components and sold them according to my finalized schematic to warn another on a piece of / port after 30 minute of soldering this circuit was complete but what was still missing was an enclosure for the project for that I simply got myself an old piece of acrylic glass on which I marked to 10 centimeter squares and cut them afterwards with a handsaw once that was done I marked 1 centimeter from the edges in each corner of one acrylic piece a point and used this piece as a template to create four millimeter holes in the corners of the two acrylic pieces the last four millimeter hole I had to create was in the middle of the upper acrylic piece next I got myself an m4 threaded rods and marked four pieces onto it with a length of 14 centimeters after creating them with the same handsaw as before I added a nuts to each end slit them all through the holes of the lower acrylic piece and secured them to its width m4 spacers to finish the enclosure I secured the electromagnets in the middle of the other acrylic piece I did not Stu the upper section of the threaded rods and slits the upper croelick piece onto it this way I can easily adjust the height of the electromagnets which will come in handy later at this point I hooked up the output wire of the Hall effect circuits to the mosfet driver while also creating a common ground connected the electromagnet to the mosfet terminals security sensor circuits to the bottom piece a little bit of glue and powered each circuits with suitable voltage source and after fine adjusting the whole effect threshold value through the potentiometer I started trying to levitate magnets which actually to my surprise did not work very well as you can see it seems like the threshold value for turning on / off the electromagnets are too far apart which results in this rather fun to look at oscillation even by creating my own more powerful electromagnets I could not get rid of this problem which in a nutshell means that my utilized comparator circuits is apparently not optimal for this kind of application the sensor itself should not be the problem though since I've seen others who plays the same sensor type directly underneath the electromagnets and had no problems with their setup so all in all for now I can only offer this rather crude prototype of an upside-down magnetic levitator but we are not at the end of the journey here since the majority of commercial products place the electromagnet only by and not the top but that is a subject for another video until then don't forget to Like share and subscribe stay creative and that we'll see you next time