Coupling Problem in PR24 feedback mechanism

LED Blinking, Walking with Cytron Servo, Displaying RFID, Multi-function Mobile Robot......

Coupling Problem in PR24 feedback mechanism

Postby macher » Sat May 29, 2010 6:08 am

when i switch the power, i can see the angle and P, I,D values on the lcd and i can change them but when i push the run button, the motor does not respond properly, it seems like it is being overloaded because of the mechanism, since the cylinder showing the degree does not turn straightly although i have coupled it correctly, what should i do and what are the best values for this motor, how will i understand the right p, ı, d values
macher
Newbie
 
Posts: 10
Joined: Sat May 15, 2010 12:34 am

Re: Coupling Problem in PR24 feedback mechanism

Postby ober » Sat May 29, 2010 2:04 pm

If you have mounted the coupling correctly, the action of overshooting and slow are caused by the PID value in software. You need to play with the value of P, I and D in order to get the optimized result. This is an Trail and Error method.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Re: Coupling Problem in PR24 feedback mechanism

Postby macher » Tue Jun 01, 2010 3:55 am

is it normal for the motor to run when angle was zero but P value was set to a low value? I also couldn't screw the motor through that little holes so, i had to shave the holes of u-joint a little bit, does this effect the performance of the system? Also the motor does not stop and the the lcd display mixes on several values, does this mean the values are not useful? ı have no idea how will i find the best values by trial, i am not even sure if this system is working properly, i mean the motor turns the other side some occasions or never stops, i am desperately in need of help!
macher
Newbie
 
Posts: 10
Joined: Sat May 15, 2010 12:34 am

Re: Coupling Problem in PR24 feedback mechanism

Postby waiweng83 » Tue Jun 01, 2010 3:13 pm

Try to replace the interrupt function with this one, see it works or not:

CODE: SELECT_ALL_CODE
//   Interrupt function
//==========================================================================
static void interrupt isr(void)
{
   signed int set_value = 0;
   signed int feedback_value = 0;
   signed long error_value = 0;
   static signed long pre_error = 0;
   static signed long integral = 0;
   signed long derivative = 0;
   signed long output = 0;
   static signed long pre_output = 0;
   signed int motor_direction = 0;
   
   
   unsigned char pwm_value=0;   

   if(TMR1IF == 1)                                             // If TMR1 register overflowed.
   {
      TMR1IF = 0;                                             // Clear TMR1 overflow flag.
      
      feedback_value = ai_read(1);                              // Get the feedback value.
      set_value = ai_read(0);                                    // Get the set value.
      
      error_value = set_value - feedback_value;                     // Calculate the error.
      
                if ((pre_output != 255) && (pre_output != -255))
                {
                    integral = integral + error_value;                           // Calculate integral.
                }
                derivative = error_value - pre_error;                        // Calculate derivative.
      
      output = (kp * error_value) + (ki * integral) + (kd * derivative);   // Calculate the output, pwm.
      
      if (output > 255) output = 255;                              // Limit the output to maximum 255.
      else if (output < -255) output = -255;
      
      if (output > 0)   motor_right((unsigned char)output);               // When output is positive, turn right.
      else if (output < 0) motor_left((unsigned char)(-output));         // When error is negative, turn left.
      else motor_stop();                                       // When ouput is 0, stop the motor.
      
      pre_error = error_value;                                 // Save as previous error.
                pre_output = output;                              // Save as previous output.
   }
}
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm

Re: Coupling Problem in PR24 feedback mechanism

Postby macher » Wed Jun 02, 2010 3:51 pm

There is a beep noise comin i guess from the motor sometimes continuously, sometimes consecutive beeps, what does this noise refer to? for each position i guess there will different p,ı,d values, so how will i define them, firstly i have to increase the p value but until when and then i could see the effect of I by increasing it but how will i see the effect of D term? can you please help me how to define the most suitable PID values according to what since there are no parameters of the motor i can't find the transfer function and so the PID values?
macher
Newbie
 
Posts: 10
Joined: Sat May 15, 2010 12:34 am


Return to DIY Project Set

Who is online

Users browsing this forum: No registered users and 13 guests

cron