A MAGNETIC LEVITATION project with no special but only standard components – including a modified cheap standard relay as the electromagnet – powered with only 5V@50mA from a USB-Powerbank
A floating object is always a fascinating eye-catcher, which I like to place on my desk. Many conversations at this table had a nice smalltalk beginning with it.
So in the last years I have recreated some „magnetic levitation“ projects from various publications.
But I was never really satisfied with the results.: Too big, too unstable, gigantic power consumption(;-), the flight stability was not very good and especially the necessary electromagnet always had to be somehow winded around a screw by myself. The results were often not very nice to look at, but above all only hardly reproducible.
So I had gained a lot of experience over the time and a simple mechanical construction and a simple electrical circuit was created, which proved itself in all test setups:
Here you can see a video of the final setup: https://vimeo.com/430336526
Some important results of my experiments:
# The HALL magnetic sensor used is an A1302 or its successor A1308 – the cheaper and widely used SS49 or similar types are NOT suitable.
# The necessary comparator (not an OP-Amp) is a LM311
# The magnetic coil is a cheap modified 5V standard relay (tested: HW-482 /JQC-3FF-S-Z or JQC3F-05VDC) with built-in switching transistor from the world of microcontroller actuators. The coil starts anti-clockwise at the PLUS-contact.
# The permanent magnet has to be as strong as possible. At least two but better more stacked NeoDym magnets work best.
# The relay has a U-shaped iron core. That core has to be changed to a J-shape by shortening the part that holds the middle-contact of the relay. Thus now only one magnetic pole points towards the „payload“
The next pictures show the steps of modification regarding the relay:
- Remove the screw-contacts on the PCB.
- Carefully remove the relay housing with a cutter starting at the corners.
- Remove the movable relay middle-contact and shorten the upper static contact.
- Cut off the magnetic counter pole and rest of the movable contact with a dremel or a metal saw. That modifies the U-shaped core to a J-shaped avoiding the former magnetic shortcut
- Position the Hall sensor with its flat side centered on the coil core.
- Connect the three contacts of the Hall sensor to the rests of the three old relay contacts.
The three relay-contacts are modified to connect the three pins of the A1302/A1308 HALL-sensor to the PCB:
- HALL-Vcc-pin1>> relay-NO;
- Hall-Vout-pin3>>relay-middle contact
# Two neodymium permanent magnets in disc form with 10mm (or 12mm) diameter and 2mm (or 3mm) height are used to make a LEGO man, a screw or a table tennis ball (with extra payload of a screw) float.
# VOut of U1 increases if the magnet comes near – if it decreases turn the magnets around!!!
# Same behavior, if the electromagnet is switched on: Hall-sensor output rises about 0.2V. Else twist the two contacts of the coil!
# The power supply should not be very expensive. In the end it worked very well with only 5V and only about 50mA. So a very simple USB power bank can be used as power supply – and can also be used as a safe stand.
# As a positioning aid, the relay’s original flyback diode has been replaced by a white LED with 220R series resistor – this LED only lights up when the object is at the right height and hovers. I found two good positions for this LED: Next to the Hall-sensor (= a bit tricky) or pointing from the side towards the magnets (= easy)
# An opaque plastic shield protects the HALL-Sensor against shortcut and mechanical stress.
# A PC slot bracket is used to keep the electromagnet at the correct height of about 8cm above the power bank without vibration. The downside end of the plate gets angled and glued to the power bank with double-sided mounting tape.
Calibration of the circuit:
Important! The payload is mainly carried by the strong permanent magnets at a distance of about 15mm under the core. The weak electromagnet only takes control in a very small range of an additional 1 to 2 mm. I have achieved the best results with at least two, better three strong stacked magnets.
The HALL sensor measures the sum of the magnetic field strength of the permanent magnet and the electromagnet. As the magnets approach, the voltage increases at Vout of the HALL sensor. The comparator U1 compares this voltage with the adjustable voltage (RV1) and switches off the electromagnet if the field strength becomes too high.
The permanent magnets including the LEGO man’s load „hang“ at the point where their own weight corresponds exactly to the force with which the magnets and the iron core of the coil attract each other. This force is first increased a little bit by the electromagnet when it is switched on. However, as soon as the Hall sensor measures a magnetic field that is too strong, the electromagnet switches off and the object „falls“ briefly until the Hall sensor again measures a magnetic field that is too weak and the electromagnet briefly lifts the object again. There is a hysteresis created by R3, which influences the created minimal puls width.
At this floating point the elektromagnet switches at about 400 times per second. The induction voltage generated when the electromagnet is switched off is no more only limited by the build in flyback-diode but now it causes LED D6 to light up precisely and only at the hover point.
For adjustment, this floating point must be found. To do this, place a stack of small Post-It sheets about 20mm thick between the magnet and the coil core while the circuit is not powered. The number of sheets is now chosen so that the magnet just begins to be pulled up only a little bit when the stack of paper is in between.
Hold this position, switch the circuit on and adjust RV1 so that there is a voltage of 0 mV between pin2 and pin3 of U1 and LED D2 just gets dark.
Then the floating object is brought to this point without the stack of paper and RV1 is readjusted a little bit until the object „hangs“ and D6 lights up.
I modified three 5V-relais and at all my three test-circuits I had to adjust a voltage of 3.45V +-50mV between GRND and U1/Pin2 without a near magnet.
This procedure of calibration is a bit tricky and depends strong on the weight of the „payload“ but especially on the given strength of the (at least two ! ) strong permanent magnets. Don’t give up!!
I had a lot of fun with this and hope this description will make it easy for someone else to build such a „levitation project“.