Electromagnetic Floater/Levitator?

Has anyone tried building this electromagnetic floater, and had it working? Because I'm trying to make it, except it doesn't work for me....I don't know whether it's the circuit, or just me.

P.S; Are most of the circuits on this website reliable?

Picture of Electromagnetic Floater/Levitator?
sort by: active | newest | oldest
What happens on U2A PIN 7 as you adjust the amount of light entering Q1 ? What happens at u2B pin 1 ?
.Unknown. (author)  steveastrouk6 years ago
Um...nothing. Pin 7 reads a constant 1.7V relative to ground, and Pin 1 reads a constant 2.74V relative to ground. Let me check my wiring and get back to you on this.
U2 Pin 5 shouldf be changing with changes to the light on Q1
.Unknown. (author)  steveastrouk6 years ago
Ok, thanks, I'll check that asap.
.Unknown. (author)  .Unknown.6 years ago
Right, thanks for everything so far. I rechecked my wiring, and found a short circuit. Fixing that, Pin 5 now varies from ~2V to ~4.8V. Only problem is, that L1 doesn't receive any current, and I can't turn D3 off. Any suggestions?
I have built something similar, a magnetic floater toy using a partially broken light beam for the position sensor.  A picture of this, and a diagram of the circuit I used, are attached below.

The upward force on the object being levitated is very sensitive to the distance between it and the electromagnet.  For this reason it is helpful (maybe necessary) to have some kind adjustment for the height of the electromagnet above the light beam. 

The way I did this is shown in the attached picture.  The core of my electromagnet is a piece of 1/4-by-20 steel bolt stock.  A matching nut is used to adjust the height of the electromagnet. Since the thread is 20/inch, one turn is 1/20th of an inch, and 1/6 of a turn (It's hex nut.) is 1/120th of an inch.

For any object that this device is capable of levitating, there is an optimum height adjustment that depends on the objects mass. For heavy objects you have to move the magnet closer to the light beam, and farther away for lighter objects.  This optimum adjustment  is the one which puts the DC part of the magnet current in the middle of its range.   For example if the magnet could supply a max current of +200 mA, and a min of 0, then the middle of its range would be 100 mA.

Also I think it's helpful to put the light sensor, and light emitter, each at the bottom of sort of a deep hole, to collimate the light.  That way the sensor only sees light from the emitter, and not from the surrounding lights in the room, sunlight, etc.
Can you please explaint the use and working of the in-between position comparator?

Also tell me if I understand it correctly,
the emitter follower connecton of transistor allows the op-amp to vary the voltage across the coil continuosly as the voltage across the phototransistor varies ?

The in-between comparator is not actually needed to make the object levitate.  All it does is turn on a green LED when its input is near 6 VDC.  I forget what the range is. Maybe between 4 and 8 volts, makes the LED turn green.  Any input outside that range, i.e 0 to 4 and  8 to 12, makes it turn red.  How it works might be tricky to explain, but you can build it and supply its input voltage with a potentiometer, and confirm that it works as described.

The reasons I included the in-between comparator are twofold.  The first was because I had a left over op-amp (the LM324 comes with 4 per package).  The second, was because I want my signals to have a DC value near the center of their range, which is 6 volts, and the in-between comparator provides a visual indicator of this.   For some reason I'm using this comparator to look at the phototransistor signal, but it might make just as much sense to look at the magnet driving signal.

You are correct in thinking that the voltage driving the magnet varies continuously.  Other designs may drive the transistor with some sort of PWM signal that is always on, or off, but never in between.  Because the transistor in my design is driven in a linear way, most of the time it is partially open, so the product of collector-emitter current and collector-emitter voltage is usually not zero, so I've got a big heat sink on it.  That's worth mentioning, and the heat sink is not visible in the picture I attached.

The controller itself is essentially an inverting amplifier.  It's DC gain is about -2, i.e. -47/22,  I think the gain for high frequency signals is much higher.  I'd have to go back and calculate the transfer function, to tell you what it is for sure.  You might be wondering how it is I picked those component values, and these are mostly the result of trial and error.  I spent a lot of time playing with it, and tweaking these values to get it to work. 
Thanks a lot for the reply!
That explains a lot of it.

There is some confusion though. As I see it, the phototransistor is driven from 6V supply so its maximum voltage can only be 6V, how could it range from 4-8V?

About the controller, is this correct :
The inverting amplifier has a reference of 6V.
Since your phototransistor is driven from 6V, its output will always lie below 6V. That is what is fed into the op amp's V- terminal. With a gain of -2, the op amp amplifies the difference (6 - V-) by two times and adds it to 6V.
For example if the phototransistor output is 3.8V, the controller outputs :
2*(6-3.8) + 6 = 10.4V


How come you didn't need a potentiometer to set the right amount of gain to output the correct amount of voltage to the coil to be able to float the object at a specified height?
That's a good point. The voltage from the phototransistor is never higher than 6V, so I don't need a two sided, in-between, comparator.  I could get away with just a simple comparator. Maybe make the light go green for higher than 4 V. Make it turn red for less than 4.

At one point in this thing's evolution I might have had the phototransistor-resistor voltage divider connected to 12V instead of 6.  Honestly, I'm not sure why I decided to connect it to 6V instead.

Also you are correct in thinking that since the phototransistor voltage is always less than 6V, that the output from the controller will always be more than 6V.  So I guess the output from the controller is swinging between 6 and  12, and the voltage across the electromagnet is just a diode drop below that, like 5.6 to 11.4 volts.

Why do I not need a potentiometer?  I don' know.  I can adjust the height of the coil above the light beam, using the nut on the bolt through the magnet.  In fact, adjusting this nut is the first thing I do.  Then I release object ( a steel ring, or ball bearing, etc) when it sort of "feels" like the magnet is going to pick it up.  Then if does take it, and it starts levitating, then I guess it must have closed the loop somehow; i.e found a combination of phototransistor voltage and magnet voltage that works.

I'll admit that sounds kind of vague, but I think that's all I've got for you, unless I try to rebuild this thing, and write it up as a real, detailed, instructable.
I have a photodiode but in the configuration you have put it, it gives me a voltage from 0.5V to 4V depending on the IR light incident. more ir = lower voltage and vice versa.

I am planning to do a follower with an op amp and feed this directly into an arduino and use pwm to vary the coil current via a MOSFET. Will I need to place any capcitors anywhere?

Also it would be great if you could give me any tips on the algorithm I should use in the arduino sketch.
Since you're implementing this controller using a microprocessor (Arduino), there are lots of possibilities,
but I'd start with something simple like a PID controller.
Sections 10.7 of  Wikipedia's PID controller article show this is done in discrete time, which is the way a microcontroller does things.  Section 10.8 even gives you some pseudocode.

You might be wondering what to pick for the gains for P, I, and D, to stabilize your levitating piece of steel or magnet, and I am going to guess that for this type of system some P and D gain are necessary, but that you can let the gain for I be zero. 

By the way, these gain settings are the dynamics
of your controller, i.e. how it responds to different frequencies of input signal.  For my op-amp based controller, I put those capacitors in place (the ones attached to the inverting input of OP3) to give it a large response to high frequency (or fast) signals.  You can do the essentially same thing, provide a large response to high frequency signals,  by picking a large gain for the D (derivative or difference) term of your software controller.
My biggest mistake was to try to make a coil wound by hand using 24 AWG wire. Halfway through I realized what a pain it is to wind this by hand.

Anyway I was just testing my coil. Its resistance is about 3.5-4 ohm and I was driving it from 15 volts with a pwm of 50%. I too have a bolt in the center of the coil like you. There is a small embossed logo of the manufacturer on center of the bolt's head.

So I was trying to balance a small neodymium magnet...
It flew from my hand and hit the bolt in the center of the coil. When I tried to retreive the magnet, it was broken...in half.
My guess is that the embossed logo is the culprit. So now I'm putting a layer of rubber under the bolt head to avoid breaking more magnets.
Now look at U2 pin 1 does that change ? It turns Q7 up and down.

Open the circuit at R11/C3 by disconnecting pin 7. Connect a variable resistor between +5 and ground, and put the wiper to R11/C3. Changing that voltage SHOULD make the voltage on the collector of Q7 and R14 vary too, and push current through L1.

Q2,3,4 and 6 make what we call a pre-regulator, to reduce the work little Q7 has to do.
.Unknown. (author)  steveastrouk6 years ago
Ok, so now I've double checked it so many times, I'm almost certain that I built it correct, according to the schematics. Trying out you suggestion, I can't get any current through the coil. I tried other things, but then I noticed that I can never get D3 off completely. I disconnected Q6 completely, and it still stayed on. If I disconnect Q7 though, it does turn off. Where's the current coming from? And looking at the datasheet for the LM358, a dual op amp, I'm pretty sure, Why can't you connect the emitter of Q1 straight to where pin 1 and 7 used to be? The output of Q1 seems higher than pin 7.
How do you mean "disconnected Q6 completely" - That's the ONLY source of current for Q7, yet d3 is stil on ???????

This is a feedback circuit, where the properites of U1 and u2 are vital to the way the circuit operates.

Check Q7 is wired correctly.

What voltage do you measure at R14 to ground ? My guess is 5V.

My other guess now is that the preregulator Q2,3,4,6 is part of the problem. Remove Q7 collector and R14, and put your relay coil inplace instead. Drive R4/Q2 emitter with a pot from +5 to gnd and see that you can NOW change the voltage on the relay coil.


.Unknown. (author)  steveastrouk6 years ago
Hm, ok, now I'm getting current to the coil (no modfications) but it is very small. I'm trying to make an amp of some sort for it...would that work?
Its supposed to BE an amp. Have you used the right relay coil ?
.Unknown. (author)  steveastrouk6 years ago
Well, it only says "6-15V relay coil". I tried using a 6V one, as well as a 12V one, but with not much difference.
.Unknown. (author)  steveastrouk6 years ago
Coming back to this, i found different results. using a 500k pot, if I turn the wiper either way, fully, D3 turns on. Other wise, it stays off.
....and can you see the IR light from D1 on your mobile phone camera ??
.Unknown. (author)  steveastrouk6 years ago
Yes, I can, but it's nowhere near as bright as the light you get coming from a standard IR remote.
It won't be ! IR remotes are designed to shine very brightly. So, what about the op-amp conenctions ?
kelseymh6 years ago

These are going to be pretty basic suggestions, but they can be easy to overlook when you get wrapped up in complex details...

Have you checked that you're getting +5V out of your regulator? Have you checked continuity all of the simple linear components (diodes, resistors, etc.)? Have you checked your solder connections (e.g., very gently flex the board and make sure none of the connections lift up)? Have you checked your solder connections to make sure you didn't introduce a short somewhere?

I haven't built this circuit myself, but I do have a commercial toy which does the same thing (the "Galileo Gravitator," sigh...), and it works like a charm. That doesn't address your question about this circuit, but it can reassure you that the concept isn't nonsense :-)