Magnetic Levitation – The VERY Easy Way

A very simple analog circuit for levitating small objects, which is the essence of many enlightening discussions and experiments with some modified prototypes. The electronics now even fit in the housing of a modified “Finder”-relay!

I wrote <here> and at Elektor Labs about my experiments with my magnetic levitation circuits.
In the helpful discussions with Luc Lemmens of the Elektor team about magnetic levitation some thoughts came up, which I followed up. The result was another strong simplification of the “old” analog circuit that allows to levitate small (magnetic) objects.
Despite the much simpler design, the functionality is very good.

Simplified circuitry:
A realization from the previous circuit was that only a very small additional controlled magnetic field must be generated to keep the levitation object in position. The actual heavy work is done by the permanent force between the permanent magnet in the levitation object and the iron core.
The comparator LM311 can provide the small pulsed control current of maximum 90mA@5V without an additional external driver transistor. This simplifies the circuit considerably.

The now used components are very common and easily available:
– LM311 comparator
– SS49E Hall sensor
– 5V relay “Finder 40.52.7.005.0000” as electromagnet

the new circuit
The simplified schematic circuit

Keep an eye on the LED and the 470 Ohm resistor in parallel with the coil. The intention of this is to limit the flyback voltage to a harmless level of below 50V at pin 7 of the LM311. But the more current the LED+R combination will draw from the charged coil, the more flight destabilizing effects will occurre, because the magnetic field can’t fully collapse in the puls pauses.

Just to compare … This is the “old” schematic circuit :

How to get the right relay … and how to modify it
My original thought was to use a cheap breadboardable 5V relay module with easy to modify relay mechanics and an integrated driver transistor. These modules from China usually do what they have to do – BUT they are not very reliable regarding the internal parts used.

So I looked around for a relay that could be my reliable modification victim ;-). The electromagnet now consists of the solenoid of a 5V relay from “Finder” with part number “40.52.7.005.0000”, which is very easily available and much easier to modify – but still in the under 4€ range.


The transparent “Finder” relay housing is a good shelter for the electromagnet – but it is often glued to its base. However, it can be easily opened by heating the adhesive joint with a hair dryer. A cutter, also slightly heated, then helps to separate it.

The core of the solenoid must be changed again from its U-shape to a J- or better I-shape to avoid a magnetic short. This is quite easy because the round core and the rectangular flat extension are only clamped together. This rough clamping can be loosened with a small cutting disc or a milling head.
Finally, the freed iron core can be turned to obtain a slightly larger and also flat pole face for gluing on the HALL sensor.

Looking at the contact side of the “Finder”-relay the rightmost contact is the plus-contact, while the left one gets connected to the output pin 7 of the LM311. Right winding and connecting scheme is very important!! If the coil gets connected to 5V (by grounding pin 7 of LM311) the output-pin 3 of the hall-sensor has to go up from 2.5V to about 3V. If the output voltage drops down to 2V: twist the two coil contacts ( and the LED!)

I soldered a green 3mm LED and the 470 Ohms resistor directly to the coil contacts. Keep in mind that the LED is connected “reverse” to work as a voltage limiter for the flyback voltage of the inductance.


At least the electromagnet and the HALL sensor can be mounted within the relay’s housing, where they are well protected against the magnet.

The operating voltage is 5V at only 50mA (up to a maximum of 90mA )
The described modification of the “Finder” relay creates a very good electromagnet and even a good mechanical protection of the whole circuit against vagabonding permanent magnets. If you really want to build it that small within the former relay housing , it can be done with acceptable mechanical effort and usual means.
But of course the circuit can also be built very easily on a breadboard or grid board and only four wires are needed to connect the coil + LED + resistor  and the sensor to the rest of the circuit. A  20cm piece of flat band cable was very helpful to me for this purpose in the prototype.  

Read about my “old” circuit <HERE> and as well HERE Luc’s article about it

Prototype #2


The careful way …

or ….

The difference between a good engineer and a brave but also reckless tinkerer :-))

Luc from the Elektor team has critically but absolutely correctly analyzed that the LM311 can sink 50mA at its output – but what about 90mA??!!! Well – this hint is correct. But my goal was to keep the circuit as simple as possible – and so the tinkerer in me didn’t want to just use an additional driver transistor to avoid an early death of my levetation circuit.

A further look at the internal circuitry of the LM311 and the diagrams in the data sheet reveals that the chip has an internal protection circuit that limits the output current to a harmless level even in case of an output short circuit and ensures a maximum harmless power dissipation of 350mW@5V. This makes the output almost immortal – or at least insensitive to a low impedance load.

Finally, I let my circuit burn in for two days … and as expected … it did not burn out!!!

OK – let’s take a step back: I don’t speed on the road, I pay my taxes and I read and follow data sheets – and I see many very good reasons to stay within the stated electrical parameters. Although I also took another look at the 25 LM311 I got on ebay last year for a very good price 🙂

It was a challenge for me to try out if the circuit can do its job with a lower output current. An obvious way to achieve this was certainly to exchange the 5V relay “Finder 40.52.7.005.0000” with 50Ohm coil resistance for a 6V relay with 75Ohm (Finder 40.52.7.006.0000) – but I did not have such a relay at hand.

So I turned to the next best thought: While keeping the 5V supply I reduced the voltage at the coil by inserting two 1N4148-diodes. This reduced the coil current with no payload to 50mA and with a payload to an average of 39mA. A single 22 Ohms resistor may have the same effect.

And … that did work well too!

Two disadvantages: The now smaller coil current reduces the distance between electromagnet and payload a bit. Additionally the capability of the control loop to equalize disturbances is a bit smaller.

The advantage: The presumed life span of the circuit has just been significantly extended – the LM311 works within its datasheet working parameters now.

The result with and without payload:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: