PID control for motor

PID control for motor

Postby omsingh » Fri Jun 22, 2012 4:12 am

i have a system in which i am using load cells output to drive two motors.load cell output is in range of 0-3.3V and according to output , i sample the analog through ADC in my program and according to the samples , motor speed is varying. but i have some problems regarding this because when i changed the load cell output , speed updation is not accurate, some time motor overruns.

i am running motor according to the analog o/p given by load cell. i set the load value in my controller and according to that set value , load on the load cell is increased or decreased to attain the set value. for this motor speed should be increased or decreased.here i am facing difficulty to change motor speed according to load cell o/p.
Last edited by omsingh on Sat Jun 23, 2012 3:57 am, edited 1 time in total.
omsingh
 
Posts: 1
Joined: Wed Jun 20, 2012 8:27 am

Re: PID control for motor

Postby Brett » Fri Jun 22, 2012 11:47 am

this question might be better served over at the diy-pid-control google group. this forum is more about the ospid specifically.

but you posted here, so let's see what we can do:

looking at your code I don't really see a separation of the proportional and integral terms i see "error = (P_CTRL)*error;" but then this entire term is summed to old_frequency. instead of output = P*error + I *Sum(error), it looks like you have output = sum(I*P*error).

I would try to sort this out before going any further. about a year ago I posted a series of 7-8 posts detailing how I write a bullet-proof pid algorithm. it's not going to be exactly what you need, since you're using integer math and don't have derivative, but maybe it can give you some ideas.

hope this helps,
Brett
User avatar
Brett
Site Admin
 
Posts: 99
Joined: Fri Mar 09, 2012 10:05 pm
Location: Boston


Return to PID Control / Tuning

Who is online

Users browsing this forum: No registered users and 1 guest