Author Topic: make transfer function for RC servo is not possible ?  (Read 4358 times)

0 Members and 1 Guest are viewing this topic.

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
make transfer function for RC servo is not possible ?
« on: March 01, 2018, 10:46:38 am »
Hello !

i already know servo moter transfer function is K/Ts+1, if model is simple.

but, for my university work, i want modeling transfer function for my RC servo mg90s.

RC servo company also don't know.

how can i make or get transfer fuction for RC servo ?


 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: make transfer function for RC servo is not possible ?
« Reply #2 on: March 01, 2018, 02:58:17 pm »
Thanks you for answer, Dana ))

hmm.... it is quite hard work.. i think..

because, i can't analyze full circuit of RC servo.. casue of IC chips.

i think i should use system identification tools in matlab for find model.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6221
  • Country: de
Re: make transfer function for RC servo is not possible ?
« Reply #3 on: March 01, 2018, 03:29:08 pm »
You can do it empirically by measuring its step response.
Is it a normal 0.5...1.5 ms pulse controlled RC servo? In that case apply 0.5 ms pulse train, and change it abruptly to 1.5 ms pulses, while recording the actuator movement. Do the same for a 1.5 to 0,5 ms step.

Odds are it's close to a second-order response, so studying the step response output should give you the gain, loop natural frequency, damping etc. parameters.

Edit: you can also measure the output voltage from the feedback pot, this will give you the same information, but is much easier to plot.
« Last Edit: March 01, 2018, 04:07:01 pm by Benta »
 

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: make transfer function for RC servo is not possible ?
« Reply #4 on: March 02, 2018, 05:47:32 pm »
Hello, Benta !

first, Thanks you for kind reply.

if you don't mind, i want more question to you !

your meaning of answer is, i can measure DC motor output voltage with change between minimum pulse.....maximum pulse ?? for get step response.

luckly, i can record the voltage levels to file from multimeter.





 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9932
  • Country: us
Re: make transfer function for RC servo is not possible ?
« Reply #5 on: March 02, 2018, 06:12:15 pm »
Benta's suggestion the get the feedback voltage is quite clever.  It will give you the exact step response even if the servo is loaded.  I am pretty certain that logging with a DMM will be useless.  The motor will have finished the transition before the DMM gets around to the second sample.  I'm just not aware of any DMMs that sample at a couple of hundred samples per second.

I would suggest a digital scope with one-shot hold.  Come up with a way to trigger the scope just before the pulse width is modified.  That's pretty easy if you are using something like an Arduino to generate the pulse train.

Here's another idea:  Take the feedback voltage as suggested above, scale it with some resistors (if necessary) and feed it into the Arduino A/D input and log it internally.  You can get quite good sampling if you have enough RAM (and there isn't a lot).  Still, you should be able to time the samples such that you get a few hundred samples over the step duration.  You can download them over the serial port and graph them using MATLAB or Excel.

You will probably want to put a small capacitor on the A/D input.  Not big enough to disturb the step response measurement but enough to smooth out the signal.  I'm thinking of 0.1 ufd but I don't have any basis for that number.

Extra Credit if you use the MATLAB-Arduino interface to automate the entire test.  The Arduino support package for the Simulink simulator has things like servo control and A/D input.  I don't know how to do this project but I'll bet I could figure it out.  It would be a really slick way to get the graph!
 

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: make transfer function for RC servo is not possible ?
« Reply #6 on: March 02, 2018, 06:24:57 pm »
Thanks you for detail kind reply so much, rstofer !!

again, i want say Thanks you to you and Benta, other users.

now i understanded 99% about method.

if you don't mind, i want ask one more to you.

still i don't understand about feedback voltage.

my RC servo feedback is working with potentiometer. (RC servo use potentiometer for feedback)

i missed some point ?

please, let me know.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6221
  • Country: de
Re: make transfer function for RC servo is not possible ?
« Reply #7 on: March 02, 2018, 07:46:39 pm »
First, a correction from my side (sometimes memory farts happen).

As I understand it, you are using a normal RC servo. The control signal is usually a PWM with the following parameters:

Period: 20 ms
Neutral pulse width: 1.5 ms
Full deflection direction 1: 1 ms
Full deflection direction 2: 2 ms

I wrote 0.5...1.5 ms which is wrong, my apologies.

What you want to know is, how does the output shaft move when you command the servo to move immediately from neutral position to full right or full left position (and back again. You might even want to plot a full right-left movement with a 1 ms to 2 ms step).

For this you send 1.5 ms pulses to the servo until it's stable, and then suddenly change this to 1 ms or 2 ms pulses.

The feedback potentiometer will tell you exactly how the output shaft moves. All you need to do is plot the voltage from the wiper on the feedback pot. A DSO is normally necessary here, although rstofer's suggestion of using the Arduino for both generating the servo control signal and doing the data logging is elegant. I suspect that the number of data points that can be stored in internal RAM would be too low, but give it a try.

« Last Edit: March 02, 2018, 07:54:04 pm by Benta »
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1323
  • Country: gb
    • bitdynamics
Re: make transfer function for RC servo is not possible ?
« Reply #8 on: March 02, 2018, 07:58:26 pm »
you'll also want to know the servo's response under different output torque loads.  connecting it to some sort of drum, with a string and mass, would probably suffice to give you the response under a few different loads
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6221
  • Country: de
Re: make transfer function for RC servo is not possible ?
« Reply #9 on: March 02, 2018, 08:12:22 pm »
you'll also want to know the servo's response under different output torque loads.  connecting it to some sort of drum, with a string and mass, would probably suffice to give you the response under a few different loads

I'm not sure about this. My experience with RC servos is, that if you load them so hard they are getting measurably slower, you are way outside their operating window and should choose a larger servo.
Modeling a servo under load is interesting, of course, but then we are talking complete system response, which can be modeled mathematically when the servo response is known.

Anyway, let ammjy try to get the unloaded response first, then let's see. It's a fun experiment.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9932
  • Country: us
Re: make transfer function for RC servo is not possible ?
« Reply #10 on: March 02, 2018, 11:56:19 pm »
Thanks you for detail kind reply so much, rstofer !!

again, i want say Thanks you to you and Benta, other users.

now i understanded 99% about method.

if you don't mind, i want ask one more to you.

still i don't understand about feedback voltage.

my RC servo feedback is working with potentiometer. (RC servo use potentiometer for feedback)

i missed some point ?

please, let me know.

That potentiometer has an output that goes back into the servo electronics to balance the current position against the commanded position.  So, it has some output voltage at full-CCW and a different output voltage at full-CW (clockwise).  As the servo moves from position to position, this voltage changes.  But it is not the command position, it is the actual position.  Just what you need to see if you want the step response.  What was the voltage before the step, what is the voltage during the move and what is the voltage when the move is complete.

Let's say you are commanding with a 1 ms pulse every 20 ms.  You will measure the potentiometer voltage (and you will need to drill a hole in the case to route the extra wires).  When you hit the servo with a 2 ms pulse stream (still every 20 ms), the voltage will change as the servo moves to the new position.  The curve of the voltage is the step response.


 

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: make transfer function for RC servo is not possible ?
« Reply #11 on: March 03, 2018, 05:53:40 am »

Thanks you Very much Benta, Rstofer, max_torque !! i'll not forgot your helps.

when i get some information, i'll write here my result also ! (in this post)

Thanks you so much again for kind detail, lovely helps ! =)
 

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: make transfer function for RC servo is not possible ?
« Reply #12 on: March 03, 2018, 06:49:19 am »

Mr. Benta, if you don't mind i wnat ask one more ))))))) haha.

Please, answer to me when you are comportable !

Please, let me know !

i want know why you wrote 1.5ms for neutral pulse with, and 1, 2ms for full deflection direction.

and can you check my plan for experiment ?

1. find a feedback port in RC servo.
2. give 1, 2ms PWM from 1.5ms neutral pulse width.
3. with scope or arduino, measure reaction of feedback voltage. and record every point of voltage, and make graph.
    and finally, two graph (1ms, 2ms from 1.5ms) will be exist. and it's a step response.



 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6221
  • Country: de
Re: make transfer function for RC servo is not possible ?
« Reply #13 on: March 03, 2018, 11:21:01 am »
The 1.5 ms for neutral and 1 ms for full deflection in one direction and 2 ms for full deflection in the other direction is simply how the servo interface is defined. I didn't invent it.

Your 3-step plan looks fine.
 
The following users thanked this post: ammjy

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: make transfer function for RC servo is not possible ?
« Reply #14 on: March 03, 2018, 11:35:44 am »
Really, with my all power, Thanks yoh so much, Benta, Rstofer ! and other users also !

Again, Thanks you so much, Benta. ill not forgot you guys help.
 

Offline ammjyTopic starter

  • Regular Contributor
  • *
  • Posts: 160
  • Country: kr
Re: make transfer function for RC servo is not possible ?
« Reply #15 on: April 09, 2018, 08:32:37 pm »
Thanks you Benta and Rstofer and other users !

this is matlab code what i use.

how i know 0.25 is 1ms and 0.79 is 2ms --- > i checked with oscilloscope !
---------------------------------
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;                                           %Set i for measure length

while (toc<999)
    i=i+1;
    t(i)=toc;
           
    step_response(i)=readVoltage(a,ai_pin);    %Already voltages calculated
   
   
    figure(1)
    plot(t,step_response,'r');
    pause(0.1);
    if toc > 20
    step_input(i) = 0.25;
    writePosition(s, step_input(i));
    else
    step_input(i) = 0.79;
    writePosition(s, step_input(i));
    end
end

 

Offline bson

  • Supporter
  • ****
  • Posts: 2441
  • Country: us
Re: make transfer function for RC servo is not possible ?
« Reply #16 on: April 10, 2018, 04:28:26 am »
how can i make or get transfer fuction for RC servo ?
How can you have a transfer function for a part that has an electrical input and a mechanical output?
But on the face of it, it's little more than an integrator, no?
« Last Edit: April 10, 2018, 04:30:34 am by bson »
 

Online CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5429
  • Country: us
Re: make transfer function for RC servo is not possible ?
« Reply #17 on: April 10, 2018, 04:57:30 am »
Anything can have a transfer function.  Mechanical in to mechanical out.  Mechanical in to chemical out.  It is all just a matter of defining a metric for the input and output functions.  In electronics the metrics we typically use are volts or amps, but meters, liters/minute, and others work just as well.

When measuring the transfer function of a servo remember that transfer functions are a linear representation of a linear system.  If the system is non-linear it technically can't have a transfer function.  RC servos do have a number of non-linearities, but don't panic, the typical way to use a transfer function for any system is to represent approximately linear behavior around an operating point, which is valid for small excursions around the operating point. 

There remains one more problem.  The RC servo has an internal servo loop which has been described briefly by others on this thread.  The overall system will be small signal linear as long as that internal loop has small errors, but when there are larger errors the servo is often slew rate limited making it non-linear.  So the step response will give very different answers than if you measure amplitude vs frequency using amplitudes low enough to avoid the slew rate limit.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf