Hi everybody, my name is Carlos Marcano, I am an electronics engineer from Venezuela (south america), I am new to the list and I hope to be helpfull as posible. Right now I am working on a little experiment wich involves a PID controller working on a 16F84. Ok, here is the thing: I want to keep a metallic ball between two bands and I am using an electromagnet to make the ball "float" between those bands; if the ball passes the lower band the magnet should increase its magnetic field and if the ball passes the upper band the magnet should decrease its magnetic field. I am getting the position of the ball using a couple of LDRs, one for the upper band and other for the lower band. They are polarized by an adjusting circuit in a way to get 5 volts from each when the ball is between the bands, that is letting the LDRs get full light. When the ball is attratcted to the magnet it will avoid certain amount of light to get to the top LDR and the voltage across it will drop. The sums of the voltage from the LDRs will give an aproximation of the position of the ball. After the sum there is an adjusting circuit wich responds to: Position= 5- [(V1-V2)+5]*0.5 where V1 and V2 are the voltages across the top and bottom LDRs respectively. This will produce a voltage from 0 (the ball completely over the bottom LDR and living full lighted the top one) to 5 Volts ((the ball completely over the top LDR and living full lighted the bottom one). This means that when the ball is between the LDRs ("floating") the resulting voltage will be: Position= 5-[(5-5)+5]*0.5 = 5-2.5= 2.5 V. That means that 2.5 is de ideal setpoint for my system. I did this using just analog electronics a couple of years ago, but I lost my schematic circuits and annotations. Recently I came with the idea of using a PIC to control de system, implementing the PID on it. I would use an ADC to convert the position voltage and get it into the PIC, calculate the response with the PID, and then use a DAC to actuate the electromagnet. Well, this is pretty much everything, PLEASE FORGIVE MY ENGLISH, it is not my first language and I am still learning, and as ussual any sugestion will be welcome... Carlos Marcano. (proud venezuelan). _________________________________________________________ Do You Yahoo!? Informacisn de Estados Unidos y Amirica Latina, en Yahoo! Noticias. Vismtanos en http://noticias.espanol.yahoo.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body