Search for "floating ball" application
Reinhard
Posts: 489
Hi,
Do anyone know a propeller based application about "floating ball" control loop?
Means to keep a metallic object in a certain distance by a (PWM) - controlled magnetic field.
Measure the object position with hallsensor or phototransistor.
I search in the forum, but nothing found, maybe I used the wrong keyword.
Thanks for any hints,
Reinhard
Do anyone know a propeller based application about "floating ball" control loop?
Means to keep a metallic object in a certain distance by a (PWM) - controlled magnetic field.
Measure the object position with hallsensor or phototransistor.
I search in the forum, but nothing found, maybe I used the wrong keyword.
Thanks for any hints,
Reinhard
Comments
For PWM, there is at least one PWM object in the Propeller Object Exchange (OBEX). Have a look at this:
http://obex.parallax.com/objects/467/
Also on the OBEX are numerous objects for various sensors and some PID controllers.
Hope that helps get you started.
I have an experimental-setup with a PWM controlled coil and use a hallsensor for measure the actual value for position.
If I bring with my hand a metallic object into position, I can see how the puls width modulation works, but not stable enough to hold the position.
Maybe it's better to use a light source and a LDR , I go on to try it.
Or I improve the PI - coefficients, this is a game with try and error .
thanks
Reinhard
edit: I am sure the propeller is fast enough to do this job !
This sounds like a great project!
Care to share more details?
What is your application? Magnetic levitation?
Don't bother with the forum search facility (it worked for a few weeks once).
Best to just use google.com.
Enter this in the box: "site:forums.parallax.com floating ball"
By "floating ball" do you mean a device like Edmund Scientific sells with a levitating globe (or space shuttle)?
I'm pretty sure there is a permanent magnet in the object to levitate as well. The permanent magnet means the electromagnet doesn't have to be as strong as one required to lift a ferromagnetic item.
If you're levitating an object with a permanent magnet, you can levitate it from below like this product.
I like the video. I'm very tempted to get one myself.
This would be very cool to be able to do with a Propeller. I don't recall seeing any sort of project like this here on the forum though.
Kye has an object for controlling a motor with a PID algorithm. I wonder if you could replace the encoder information with data from a hall effect sensor and use it to levitate an object.
It might be a good starting point.
first I work with an magnetic ball as floating object ( has a mass of 3 gramm)
But now I know this is not an adequate object. His own field disturb the measure and make it too complicated.
Now I search for a good object.
Seems only my coil is too weak to bring up the force over a distance greater than 3 cm.
So I have added a permanent magnet in "serial", thats allowed a little bit wider range.
Supply it with 15 Volt and meas a maximal current of 800 mA.
Must draw a schematic for more offers. ( programming language is propgcc )
Be carefull if experiment with a magnetic ball, it can get a extrem high accerelation and not only in vertical direction !
Reinhard
this is a preliminary schematic from first experimental setup.
keep in mind this is always in flow .
I use the DAC's to give out the position and error signal, rather than a printf.
Reinhard
Are you using an analog display of some type?
Actualy PWM is connected with P20, but it can be any free portpin (in future).
I observe the analog out with 2 channel o-scope, so I can study the dynamic behaviour in "realtime".
If I send out the interesst values via terminal, is not the real sample timing.
But this isn't needed for the functionality.
Reinhard
seems better and smoother than the previous, has no spikes because works in linear range.
Reinhard
http://www.parallax.com/Portals/0/Downloads/docs/prod/sic/Web-PC-v1.0.pdf
Thank you for this link, a very useful info !
Reinhard
The AD Conversion needs 50µs, but there is place to optimize with unrolling the loops
Reinhard
What ADC chip are you using?
I wonder if a parallel output, high speed ADC would make this task easier? The TLC5540 (one of a hand full of ADC chips I have experience with) only has 8-bit resolution but can sample at 40 million samples per second.
I agree with Jazzed, this is a very interesting project.
The reason for decision to use this kind of ADC was I have it just at hand.
I experiment with him only as a trial to get a feeling for requirements.
Since I have absolut no feeling about this, the setup is more a feasibility study.
On other hand in my theoretical mind: a body in earth gravity field in idle state
moved in 50µs a distance of 9.81m/s² * (50µs)² are round about 24 nm.
Add the time for control algo (currently unknown) I feel there is enough time
to calc a inverse force.
However it is not a professionel work and I have time to deal with different rudiments.
And in case I get no result, I have learned a lot.
best regards
Reinhard
** the force/displacement of separated objects is highly non-linear
Once you have above 1G (ie levitate), the force will quickly increase as your ball moves closer
** The Ball and your solenoid, will have magnetic build and collapse times that are non zero
** The inductance of your coil also works against you.
Is this a full 3D problem ?. or is this constrained eg inside a nylon/clear tube
If it is inside a tube, you can add viscous fluids to get your control loop working, and then drop the viscosity.
You can also tilt a tube, so the forces needed are lower, but the control problem is similar.
(angular momentum becomes a new variable )
what you report is exactly the work I have done today afternoon.
I have build a new mechanical setup with a plastic tube which keep the ball in 1D trajectory.
And at first I try to determine the parameters in horizontal way.
The idea with a fluid is very clever, what kind of fluid are you tought ?
Reinhard
I have found the solution with hallsensor in a schematic with analog components.
The circuit is very simple
the hallsensor is the input of an opamp
the other input is a poti (reference signal)
the output drives a power mosfet , this control the current through the solenoid.
I think the thing is in steady state the sensor deliver a certain value which is the reference level. (+offset)
I know this sounds too simple, but the analog solution exist, why not with a µC.
Reinhard
What I don't understand is the physical layout of the solenoid, floating magnet/ball and the sensor.
It just seems to me that:
1) Ball moves
2) Sensor detects motion via change in magnetic field
3) Control circuit drives solenoid
4) That changes the magnetic field which upsets the sensor
How is it arranged that this does not happen?
No reason at all. Provided the whole loop of sensors-ADC-software loop-DAC-solenoid is fast enough. Of course the complete uC digital solution is a lot more complicated than an op amp or two and some R's and C's.
Aside: I once met a semi-retired engineer working on testing aircraft flight control software. He had been involved in designing controls for the Concord and explained that it was all done in analog with op-amps. There were no uCs back then. Some times he would slap his head and ask "why are we doing all this in software it would be much simpler with an op amp?"
I've seen two solutions to the first challenge. First is the classical approach, get a really high speed low noise position feedback signal and crank up the gain. (start with the 'D' gain (viscous damping) and progress to the 'P' (spring rate) then add a bit of 'I') This has the effect of making the controller totally dominate the motion of the system. I.e. the system is still non-linear, but those non-literariness generate forces much smaller than the magnitude of the controllers corrections, at most about 1/10th as large. While this type of approach often works, the solution is slower, more expensive, and or noisier than it could be if all the information known about the system was used.
The second solution to the first challenge I've seen is to carefully consider the physics of the system and use the controller to modify them to suit your needs. ( a "control volume" is a useful concept here) In this case you want to be able to use the levitation coil to exert force 'commands' on the steel ball. To do that you first need to get control over the levitation coil's current. An analog servo loop or fast uC loop should do this easily as the levitation coil will mostly be an inductor. Second, you need to calculate what the relationship is between force, current, and ball position. (find an electromagnetics text and read up for this part) With this relationship you can now construct a "command transform" to transform force commands and the measured position of the ball into current commands for the levitation coil. At this point, you should be able to command the coil to exert 1 Newton of force on the ball, and have the controller exert 1N on the ball independent of it's position. At this point you've also transformed a rather nasty non-linear system into a nice simple linear system. (as long as the current control loop can keep up with your force commands anyway.) Finally, with the levitating ball system linearized, classical PID control theory applies perfectly. (wikipedia has a decent treatment )
BTW, the proportional, derivative, and integral gains should have REAL UNITS on them. With the system linearized, proportional gain should have units of [force/length], the derivative gain should have units of [force/(length/time)] etc. These gains can also be directly measured by measuring the response to a known disturbance force. (easy to create, by adding a "disturbance" command on to the servo loop's corrections) The proportional gain of a position loop is particularly easy to measure as it's a spring.
The second challenge of impure position sensor readings, is harder to deal with. To a certain extent, you can "map" the interactions out with a function that depends on both the position measurements and levitation coil current. This can get a small improvement in performance before the "map" function requires impractically accurate parameters. It will be much better to get a new position sensor that isn't effect by the levitation coil current.
Lawson
Here is the analog referenz design:
http://www.bis0uhr.de/index.htm?http://www.bis0uhr.de/projekte/schwebekugel/index.html%99htt
later more
Reinhard
I believe that, in aircrafts and medical products the highest requirement is absolute safeness.
And this is easier to verify with an well proofed (analog) design.
how knows when a bug in (large and complex) software occurs.
back to the thread:
using a fuzzy logic is a smart idea, exist there (spin) examples how to implement in best practise a system of rules ?
Reinhard
Sadly I forget what the system or the bot are called just now.
I think it was a comercial product so it may cost you a little.
So, the ball is a magnet.
There is a magnet at the top lifting the ball.
The sensor is sitting about midway between them.
Could I guess that the sensor will see a zero (near zero ) magnetic field when the ball is in the desired position.
The actuator coil only has to do a little work to maintain balance.
A change in that field balance causes the sensor to drive the op-amp one way or another.
Now, what goes on with the opamp circuit? Is that oscillating and having its frequency and/or pulse width adjusted by the sensor input. Or is it driving the coil linearly?
The functional principle:
An electromagnet (coil) is turned on. The magnetic sphere gravitates towards it.
When the sphere gets near the magnet sensor (Hall sensor), the sensor reacts and turns off the electromagnet.
In the following, the sphere descends again. The magnet sensor then turns the electromagnet on again
and the cycle starts anew.
This happens approx. 70 times per second (depending on the distance and the weight of the magnet).
That's how the magnet levitates.
best regards
Reinhard
edit: this sounds to me like a PWM over the time
That sounds very a simplistic explanation but let's go with it.
That implies that after all the talk of difficulties with physical modeling and PID control it boils down to the simplest crudest "bang-bang" controller. If "too low" turn it full on. If "too high" turn it full off.
Sometimes it pays not to think to hard and just do it:)