Thank you so much Henrik, now I got it!
I'll test it as soon as I can. Then i'll bother you again
I have another question in a new thread, not related to PID, but related to counting position. Thread title: "Pulse count matching"
Thank you so much Henrik, now I got it!
I'll test it as soon as I can. Then i'll bother you again
I have another question in a new thread, not related to PID, but related to counting position. Thread title: "Pulse count matching"
"Beethoven had his critics too, see if you can name 3 of them"
can i use the code to control speed and position of motor using same pic?
First step (get), you Get variables from hardware (via pot, encoder, ...)
Second step (control), you correct those variables (PID between desired and got variables)) to reach your desired speed, direction & position by PWM and polarity (depending on the type of motor DC, BLDC or what ever). That is control.
And yes, both steps you can perform them in a single MCU. Motor control oriented MCU's works great for this, such as a dsPIC30F3011; or for this compiler, a PIC18F2431 (or any of the family PIC18Fxx31) which have QEI peripheral, where QEI stands for Quadrature Encoder Interface, which decodes signal from a rotary Quadrature Encoder, ideal for gathering motor rotation activity.
Rodrigo M.-
Last edited by RodSTAR; - 27th March 2009 at 17:36.
"Beethoven had his critics too, see if you can name 3 of them"
i'm using 1 channel incremental encoder and PIC16F877A.i use timer 1 to count pulse on background.to get the speed i use "count" instruction but it take a 0.5 second.is there any faster solution to calculate speed?
i decide to use incPID program to control speed,but how can i tune to find Kp,Ki, and Kd value..
Last edited by infinitrix; - 27th March 2009 at 22:41.
.5 sec is too long to get speed reading, you may be able to timer/counter 1 pulse duration to get speed ref faster .
PID itself is hard to tune. Isn't each correction just how-much and how fast ? and slowing-down and reducing each correction until there is no overshoot ? I made an alternator/regulator controller that self-tuned by jointly reducing correction amount and slowing corrections (longer pauses) until there were no more overshoots. The output was the PWM to MOSFET. You could also adjust up/down the gain/time with a pot input ref.
Are you interested in PID discussion ?
don
amgen
i'm interested in pid to control position and speed.. can u show me some program and schematic for self tune pid.. i use 3 pot to adjust kp,ki and kd.. i'm just not very clear about tuning the pid..![]()
Bookmarks