Carlos Marcano wrote: > About the little thing I have been doing, so you are > proposing to make a sort of "on/off" control? Do you > mean like producing and average magnetic field product > of turning off and on the electromagnete with a > constant current and a constant freq? I suposse that > the big trouble about this is finding out the proper > values for current and frequency to make the ball > float... In the other hand no feedback sensors (i.e. > the postion sensors) would be needed so it would be an > open loop system; would this guarantee (not sure I > wrote it right!) stability in the system? Yes, you do need the negative feedback to get the ball nice and stable. You can remove the bottom light sensor and just use one sensor, and for that matter you only need one electromagnet. the lifting one. For the moment the biggest issue is the mechanics, not the PID method. :o) If you try a constant magnetic field you find the field strength needed to hold the ball weight suspended is VERY close to the field that will slam the ball full upwards. To make it work in that way you need VERY fine control of field strength which is a real pain especially since you are using relatively slow LDR sensors. A better technique is to use a strong field in an on-off fashion, switched very fast based on a simple comparator using the LDR. This will rely on the relatively high inertia of the ball, so it never has time to lift or fall too far. I think you can use something as simple as a LDR + comparator that switches for a set (monostable) off period whenever the ball gets too high, so when the ball gets to set point it switches off, and the off period and gravity are known so the ball falls a known amount, then it switches back on. I have seen commercial desk toys using just a few transistors, and noticed micro oscillation of the load. Basically it is just a mechanical oscillator regulated by ball position. :o) -Roman -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads