PID-filter routine (2nd try).


Closed Thread
Results 1 to 40 of 132

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    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.

  2. #2
    Join Date
    Jan 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    anyone know how to tune PID coefficient? help me..

  3. #3


    Did you find this post helpful? Yes | No

    Default pid stuff/theory question for Mr Olsson

    .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

  4. #4
    Join Date
    Jan 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    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..

  5. #5


    Did you find this post helpful? Yes | No

    Default position, speed

    do you need to move something to a position and stop, or shift motor from 1 speed to another speed or hold speed constant while the load changes.
    That dictates the type of feedback needed and how fast the control needs to actuate.
    Explain your control operation a little.

    don
    amgen

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hello,
    Sorry for the slow response on my behalf, I've been on the road so I haven't been on the 'net that much.

    As I've written en previous posts in this thread the incPID routine itself does not know or care if it controls position, speed, temperature, waterlevel, light, torque or whatever. It simply returns a value based on the "error" you send it and the tuning parameters you set.

    You can only run one PID-loop with it though (without rewriting the include) so controling BOTH speed AND position with the incPID won't work. What you CAN do though is to set up your system to control position and then in your program you continously change the targetposition. Set up a 100Hz (or whatever) interrupt and add to or subtract from the target position, the more you add or subtract the faster it will go. I've done that myself and it works fairly well.

    Tuning is an art and there's more than a few ways to do it, Google Ziegler Nichols to read up on one of them. I've simply done it by "feel" but you can for example send the errror value to the USART and then plot the value on the PC using EXCEL or whatever to "see" the response of the system.

    I suppose doing an autotune routine would be possible but it's not something I'm going to try. If you're going to write an autotune routine I suggest you read up and get good at manually tuning first so you know and understand how to respond to different situations. (Undershoot, overshoot, oscillation etc).

    Hope it helps!
    /Henrik.

  7. #7
    Join Date
    Aug 2009
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Speed control

    Dear sir,
    I check INCPID routine it works fine as position control.
    I want to control speed via PWM what should i change in the INCPID routine
    and also how can i give pid_Kp pid_Ki pid_Kd using external potantiometer
    which is reading through ADC CH which gives 0-1023 value and how i convert
    this value to $0xxx figure.

Similar Threads

  1. Darrel's latest 16 bit averaging routine?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 17th October 2009, 01:57
  2. 2nd order Low-pass passive RC filter on PWM
    By munromh in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 29th January 2009, 19:03
  3. Atod Digital Filter
    By GeoJoe in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd April 2008, 17:04
  4. PID controller in 16F737
    By joeri in forum mel PIC BASIC
    Replies: 8
    Last Post: - 24th June 2006, 11:39
  5. 2nd Order Digital Filter for 24-bit
    By sefayil in forum mel PIC BASIC
    Replies: 0
    Last Post: - 2nd December 2005, 21:55

Members who have read this thread : 2

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts