Author Topic: which transfer function of RC servo i should belive ?  (Read 588 times)

0 Members and 1 Guest are viewing this topic.

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
which transfer function of RC servo i should belive ?
« on: April 11, 2018, 07:42:33 am »
Hello ! Thanks you for click !!

in Matlab R2017b, with System Identification toolbox, i got transfer fucntion of RC servo motor.

im using Arduino Due now. i gave signal 0 to 90 degree.

and i measured step response from potentiometer included in RC servo for feedback.

when 0 degree, voltage level is almost 0.3 V from potentiometer.
when 90 degree, voltage level is almost 1.41 V from potentiometer.
from measured excel data in workspace in matlab, i deleted value as much as 0.3 for zero matching when degree is 0.

after save input and output.
in System identification toolbox, i loaded input, output data. (when i setting input and  output, i setted starting time 0, sample time 1)

then, with process model, i got transfer function with this form.
K*exp(-Td*s)
------------------
1+Tp1*s

i repeated this process few time for do compare results.
and i stucked. because, i don't have idea. which TF i should belive....
Please, see the picture what i uploaded...

Please, give me advise, let me know..

this is my code in matlab. (time setting is fine ?)
------------------------------------------------------------------------
clc; clear all; close all;                                    %Reset all

a=arduino('COM4','Due','Libraries','Servo');   %Set Arduinio board
ai_pin='A6';                                                    %Set Analog pin for ADC from potentiometer of RC Servo
s = servo(a, 'D7');

tic;                                                                 %Set stopwatch timer
i=0;                                                             


while (toc<4)
    i=i+1;
    t(i)=toc;
           
    out(i)=readVoltage(a,ai_pin);                    %Already adc voltages calculated
   
   
    figure(1)
    plot(t,out,'r');
    pause(0.05);
   
    if toc < 2                                                %if toc cound is less then 2, give 0 degree signal. if not, give 90 degree signal.
    in(i) = 0;
    writePosition(s, in(i));
    else
    in(i) = 0.5;
    writePosition(s, in(i));
    end
end
------------------------------------------------------------------------

« Last Edit: April 11, 2018, 07:51:27 am by ammjy »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf