Anyone implent PID feedback via simple opto sensor on a DC motor?
Preferably in Assembly?
Max.
Preferably in Assembly?
Max.
I have and it was a mess - I don't have it but we used it on a small line-following robot - controlled the left and right wheels to keep on the center.Anyone implent PID feedback via simple opto sensor on a DC motor?
Preferably in Assembly?
Max.
I have done a few projects with PID control.
There is a basic formula to use to calculate the output.
Sadly I left it behind when I changed jobs so cant remember much about it now.
I think there were 3 error variables (3 measures of input from opto) and the formula was done on these to produce a shift in output voltage.
previous_error = 0
integral = 0
start:
error = setpoint - measured_value
integral = integral + error*dt
derivative = (error - previous_error)/dt
output = Kp*error + Ki*integral + Kd*derivative
previous_error = error
wait(dt)
goto start
by Aaron Carman
by Jake Hertz
by Aaron Carman
by Jeff Child