Magnetic Levitation – The VERY Easy Way

A very simple analog circuit for levitating small objects, which is the essence of many enlightening technical discussions and the result of experiments with some analog or digital prototypes. The analog 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. You will find all my related posts collected <HERE>
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 school” 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 provides the pulsed control current of less than 90mA@5V without an additional external driver transistor directly to the magnet coil. This simplifies the circuit considerably. Since the “old” relay board inverted the output of the LM311 comparator, the signal from the Hall sensor is now fed to the non-inverting input. The hysteresis is now determined only by the ratio of the 100K resistor to the output resistance of the Hall sensor. This makes it possible to save another resistor.

The trimmer for the setpoint is now a standard potentiometer in combination with a single series resistor – a multiturn trimmer is no longer required. The setpoint trimmer is connected to 5V.

The Hall sensor is powered with 5V as well. Fluctuations in the 5V supply voltage affect the Hall sensor and the setpoint trimmer almost equally, and thus become almost ineffective regarding the trigger threshold messuring.

Overall, the parts list has been significantly reduced and the components, which are now by no means so “special”, will still be readily available in electronics stores in a few years.
– LM311 comparator
– SS49E Hall sensor
– 5V relay “Finder” as electromagnet

the new circuit
The simplified schematic circuit

Note the special series connection of a (supposedly reverse connected) LED and the 470 Ohm resistor in parallel to the coil. This is to limit the flyback voltage to a harmless level of below 50V at pin 7 of the LM311 and incidentally thus visually indicates the flyback pulses. But attention! The more current the LED+R combination will draw from the charged coil, the more flight destabilizing effects will occurre, because the field can’t fully collapse in the puls pauses.

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

How to get the right relay safely … and how you can easily 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 need to do as a controlled switch – BUT they are not very reliable in terms of availability and also internal mechanical design … as I had to learn now 😦

So I looked around for a relay that could be a reliable modification victim for the next 50 years ;-). The electromagnet now consists of the well modifiable solenoid coil of a proven 5V relay from “Finder” with the part number “”, which has been available for many years and hopefully will continue to be available without problems, costing less than 4€.

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 less than 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” analog 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 and to reduce the number of components as much as possible. And so the tinkerer in me didn’t want to just use an additional driver transistor to prevent my circuit from dying prematurely.

A further look at the internal circuitry of the LM311 and the diagrams in the data sheet revealed 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 know many very good reasons to stay within the stated electrical parameters. Although I have to admit that 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” with 50Ohm coil resistance for a 6V relay with 75Ohm (Finder – 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 benefit: The expected life time of the circuit has just been extended significantly – the LM311 is now within its datasheet working parameters. I will certainly sleep better from now on and look for a use case for the 24 remaining LM311s 😉

The result with and without payload:

One comment

Leave a Reply

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

You are commenting using your 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: