make transfer function for RC servo is not possible ? - Page 1
Forum section: electronics / projects

author: ammjy
author_rank: Regular Contributor
timestamp: March 01, 2018, 10:46:38 am
content: 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 ?

author: danadak
author_rank: Super Contributor
timestamp: March 01, 2018, 10:57:51 am
content: Maybe this could help ?https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&ved=0ahUKEwiyhM3M-srZAhUuuVkKHfdYBZ0QFgg3MAM&url=http%3A%2F%2Fusers.encs.concordia.ca%2F~realtime%2Felec372%2Fdocs%2FMODELING_SERVO_MOTOR_SYSTEM2.pdf&usg=AOvVaw1Y_gkMBS12VoROta65Jb68Regards, Dana.

author: ammjy
author_rank: Regular Contributor
timestamp: March 01, 2018, 02:58:17 pm
content: 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.

author: Benta
author_rank: Super Contributor
timestamp: March 01, 2018, 03:29:08 pm
content: 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.

author: ammjy
author_rank: Regular Contributor
timestamp: March 02, 2018, 05:47:32 pm
content: 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.

author: rstofer
author_rank: Super Contributor
timestamp: March 02, 2018, 06:12:15 pm
content: 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!

author: ammjy
author_rank: Regular Contributor
timestamp: March 02, 2018, 06:24:57 pm
content: 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.

author: Benta
author_rank: Super Contributor
timestamp: March 02, 2018, 07:46:39 pm
content: 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 msNeutral pulse width: 1.5 msFull deflection direction 1: 1 msFull deflection direction 2: 2 msI wrote 0.5...1.5 ms which iswrong, 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.

author: max_torque
author_rank: Super Contributor
timestamp: March 02, 2018, 07:58:26 pm
content: 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

author: Benta
author_rank: Super Contributor
timestamp: March 02, 2018, 08:12:22 pm
content: Quote from: max_torque on March 02, 2018, 07:58:26 pmI'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.

author: rstofer
author_rank: Super Contributor
timestamp: March 02, 2018, 11:56:19 pm
content: Quote from: ammjy on March 02, 2018, 06:24:57 pmThat 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.

author: ammjy
author_rank: Regular Contributor
timestamp: March 03, 2018, 05:53:40 am
content: 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 ! =)

author: ammjy
author_rank: Regular Contributor
timestamp: March 03, 2018, 06:49:19 am
content: 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.

author: Benta
author_rank: Super Contributor
timestamp: March 03, 2018, 11:21:01 am
content: 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.

author: ammjy
author_rank: Regular Contributor
timestamp: March 03, 2018, 11:35:44 am
content: 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.

author: ammjy
author_rank: Regular Contributor
timestamp: April 09, 2018, 08:32:37 pm
content: 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 alla=arduino('COM4','Due','Libraries','Servo'); %Set Arduinio boardai_pin='A6'; %Set Analog pin for ADC from potentiometer of RC Servos = servo(a, 'D7');tic; %Set stopwatch timeri=0; %Set i for measure lengthwhile (toc<999)i=i+1;t(i)=toc;step_response(i)=readVoltage(a,ai_pin); %Already voltages calculatedfigure(1)plot(t,step_response,'r');pause(0.1);if toc > 20step_input(i) = 0.25;writePosition(s, step_input(i));elsestep_input(i) = 0.79;writePosition(s, step_input(i));endend

author: bson
author_rank: Unknown
timestamp: April 10, 2018, 04:28:26 am
content: Quote from: ammjy on March 01, 2018, 10:46:38 amHow 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?

author: CatalinaWOW
author_rank: Super Contributor
timestamp: April 10, 2018, 04:57:30 am
content: 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.