Pulse frequency and Servos

Hello,
If I use the already implemented Servo functions form Arduino, how do they behave regarding the pulse frequency of servos?:
Do the servo functions have already implemented a fixed time delay that assures that subsequent impulses are not sended too fast to the servo (e.g. in a while loop), or do I have to control for that on my own (e.g. if I had a while loop to include a delay comment after each motor command)?

If there is a delay already implemented in the servo functions, how can I change this value (e.g. if the servo allows a very high pulse frequency)?

I would be very glad for an answer.
Cheers.

When you give a command such as myservo.write(90) the Arduino continuously produces the appropriate pulses until you give another command for the same servo. This all happens invisibly in the background.

In general you only need to give another servo.write() command when you want to move the servo arm to a different position.But it won't do any harm to repeatedly call servo.write() with the same position.

...R

The servo library commands are written to the flashram and read from there by servo library commands. Thus , once written, the command will repeat until overwritten. In other words "what he [Robin2] said..."

Okay, when it "continuously produces the appropriate pulses" at which pulse frequency does this happen and can this be modulated? For, some servos allow higher pulse frequencies and some only allow lower pulse frequencies - or do I confuse something?
I would like to have the fastest control of servo moving as possible...

Thank you.

Sorry, but analogWrite() has nothing to do with servos.

The servo library produces a servo pulse every 20 millisecs in accordance with the normal servo standard.

I doubt if faster pulses would give a noticeable effect on the response of the servo as it takes an appreciable time (in computer terms) for the servo arm to move.

...R

If there is a delay already implemented in the servo functions, how can I change this value (e.g. if the servo allows a very high pulse frequency)?

I don't have the answer for this question
EDIT The post with the link to "analogWrite" reference page was deleted because it does not apply to servo library.

Does anyone know what the OP is asking ? Is his question about duty cycle of the servo pwm ? (he doesn't mention that. His question is about delays and I don't know what delays he is talking about. When I look at the servo pwm waveform on the scope the only thing that might be construed as a delay (by a newbee) is the off time of the pwm waveform.

Seems some need to get up to speed on hobby servo operation.

@Zoomcat,
Who me ? I know about PWM , but I couldn't tell what the OP was trying to ask with his questions about delays.
Was he trying to ask about duty cycle ? . I have a scope so I can look at any signals I want and I have already compared the servo pwm to the regular pwm and I know what the difference is.
The OP didn't mention duty cycle. Is that what he meant when he said delay ?

Do the servo functions have already implemented a fixed time delay that assures that subsequent impulses are not sended too fast to the servo (e.g. in a while loop), or do I have to control for that on my own (e.g. if I had a while loop to include a delay comment after each motor command)?
If there is a delay already implemented in the servo functions, how can I change this value (e.g. if the servo allows a very high pulse frequency)?

Have you figured out what he is trying to ask ?

Thank you for your replies.

Okay let me perhaps again explain what I mean. I am not a native english speaker and probably I do not use the right technical terminology. I'm sorry for that.

Our goal is to constantly transform a biosignal (e.g. the eeg mu-rhythm of the motor cortex) into corresponding servo movements, with time delays as little as possible (this is really really important).

As far as I understood it, in normal servo control a PWM of 1-2ms is normally sent to a servo every 20ms, because the typical servo only has this pulse frequency of 50hz - and thus is not able to process a faster updating of new servo commands. Am I right with this?

However, we would like to use a very fast servo (the Align DS610: Servo Database - RC Servo Specs and Reviews), which - in addition to his high speed (0.08 sec/60°) - is said to also have a higher pulse frequency than normal, namely 200hz. Thus, if I understand this right, this servo should be able to receive a new command each 5ms, instead of each 20ms (Aim I right with this interpretation?).

My question is now what happens if I sent two servo commands (using the implemented servo library) directly after each other: Will the second servo command immediately overwrite the first command, or will the second command only be arriving the servo after at least 20ms?
And if this is the case, how can I avoid this?

Thank you very much so far.

I don't see anything about 200Hz on that site, and I looked at a few different servos.

I suspect (from other Threads here) it refers to the internal frequency at which the servo updates its position in response to the regular 50Hz pulses from the controller.

You couldn't rely on the new servo command overwriting the current command. Even if it did it would mean that your code would have to update it very frequently which is the opposite of how the system is intended to work.

If you really do need a 200Hz pulse rate you will either have to modify a copy of the Servo library or (which is probably easier) write your own code.

...R

The fastest RC servo currently available is the Airtronics 94758Z.

Servo speed specs are rated by TIME/Degrees traveled, so this one , being rated for 0.06(sec)/60 deg means that the fastest possible move for 60 degrees will take 0.06 seconds which if repeated continuously would be a frequency of 16.6 hz. Obviously , if the fastest servo sold is 16.6 hertz for a 60 degree movement, you can kiss your plan of getting it to operate at 200hz goodbye. That's a pipe dream. Not possible. A medical EEG does not use RC servos, so your plan to build a working EEG chart recorder using hobby servos and Bic pens is, well, maybe not flawed, but perhaps a little under researched. I don't know if you have ever actually seen an EEG chart recorder up close and personal, (I have, I was a medic in the AF and worked in a hospital ) but they have very delicate needles (the old mechanical ones , designed and build many years before you were born) and one of the reasons is the energy needed to move some mass is proportional to the velocity and mass . An RC servo arm has a much greater mass than an EEG chart recorder needle so the torque needed is much greater. The needle , moving 3 cm (0.03 meters) in 5mS (200 hz) is dist/time=velocity===> 0.03m/0.005mS=6 m/S . The fastest servo available is 3 cm (approx 60 deg) ===>0.03m /0.06S=0.5m/S , which is 1/12th the velocity of an EEG chart recorder.

Okay, I see that my plans are somewhow unrealistic or time-wasting, so I just will leave like it is.
I just wanted to assure to get the maximum out of what is possible with our servos.

Regarding the pulse frequency, I referred to this table here, http://www.ronlund.com/rcheli/HELP_SERVO_PULSE.html, but perhaps they refer to some other frequency?

Regarding EEG: Yes, I am acquainted with EEG, I am actually a cognitive neuroscientist.
I do not want to build an eeg recording system, I want to real-time control a robotic hand based on neuronal oscillations observed in the eeg.
And of course, I do not want to update the servos 200 times a second (10 times a second would be already awesome).
In fact, we will have to conduct some frequency analysis of the eeg raw signal (mu-component), in order to receive the final amplitude values that then can be transformed into motor commands (so there will be other latencies as well).
I just wanted to assure that there won`t be any unnecessary delays between each new calculated amplitude value and the following servo movement. But I see, that it is probably much more worth to spent more time on reducing the other possible latencies (eeg-amplifier to Matlab, online eeg artefact correction, frequency analysis, (classifier), servo command)

Thank you.

What do you need now?

brainybrown86:
Regarding the pulse frequency, I referred to this table here, Welcome to This Expert Blog about Radio-Controlled Helicopters, but perhaps they refer to some other frequency?

....

(10 times a second would be already awesome).

I think those frequency figures are all internal to the servo. Most of them refer to the standard 1500usec centre position.

If 10 times per second is OK I completely fail to see what all your questions are about as the normal servo pulses occur 50 times per second.

Or else we have been misunderstanding each other ...

...R

I do not want to build an eeg recording system, I want to real-time control a robotic hand based on neuronal oscillations observed in the eeg.

From this statement is your robotic hand expected to have much faster movements than a human hand? The needle on a cheap undampened analog multimeter can move much faster than a human finger. The laws of inertia and momentum have to be respected when things are expected to move or change directions quickly. Have you actually setup a servo and done some testing of movement speed? You probably modify the gearing in a standard servo similar to the below servo mod to increase the movement speed some. Lot of confusion as to PWM in servos. In a typical analog servo the internal H-bridge supplies the motor pulses at ~50hz. Digital servo H-bridges pulse the motor at much higher frequencies for better holding power (but also produced an auditory "whine" sound that some don't like). Both of these types are controlled with the standard servo pulse duration method.

However, we would like to use a very fast servo (the Align DS610: Servo Database - RC Servo Specs and Reviews), which - in addition to his high speed (0.08 sec/60°) - is said to also have a higher pulse frequency than normal, namely 200hz. Thus, if I understand this right, this servo should be able to receive a new command each 5ms, instead of each 20ms (Aim I right with this interpretation?).

NO.
Regarding the table you referred to :
since you are Cognitive Neurologist and not an Electronics tech or engineer, we can hardly expect you to know the PWM protocol for RC servos as opposed to the standard PWM of an arduino analogWrite command. What you saw on that table was a cross reference of the frequency of the repeating pulse to the center position pulse width. RC servo PWM differs from analogWrite PWM
in that the pulse width is much narrower and the total deviation of this pulse width is much smaller than the pwm of analogWrite which is a % duty cycle. Servo pulse width is not % duty cycle . The table indicates that for the center position , a pulse width of 1500uS repeats is transmitted at 200 hz. . The period for a 200 hertz waveform is 5mS. This means that during the 5mS period of the 200 hz pwm signal , the HIGH pulse is 1500uS , which is a duty cycle equivilent to 30% , but the total deviation never achieves 100% because the servo signal has a very narrow pulse width with a small deviation, unlike an analogWrite pulse which can deviated from 0% to 100%. We don't expect a Cognitive Neurologist to understand this, but that's what it means and has nothing at all to do with how fast the servo arm moves.

@Zoomcat,
Loved the servo hack !

Alright thank you very much for your comments and explanations, I will just use the Arduino implemented functions without any modifications attempts.

raschemmel:
The table indicates that for the center position , a pulse width of 1500uS repeats is transmitted at 200 hz.

I see no evidence for this. In my opinion the columns in that table are separate. Normal servos use 1500uS pulse widths as the centre position and require pulses of that width 50 times per second, not 200. There is nothing in the table to suggest that the servos are incompatible with regular RC recevers that produce pulses at 50Hz.

...R

I didn't suggest there was any incompatibility. I didn't see anything about 50hz there and I don't see that it matters either way. The frequency at which the pulse is repeated is probably not critical anyway. I'm no expert in servo design but my understanding is that the pulsewidth is the critical spec because that's what changes when the servo receives commands. When you watch the servo pulsewidth on a scope , you're seeing the same 1500uS pulse with either servo. The difference is that your seeing it 4 times more often with the faster digital servos, but if you receive only one bill every month do you have to pay any more if you receive 4 copies of the same bill (one a week) during that month ? (crude analogy , I admit) but my point is that the servo must obeay a command to set it's pulse width some value whether it receives the same command 50 times a second or 200 doesn't change the command. If I have this all wrong please tell me because I do want to know. I'm just saying that is my understanding of it as it stands at the moment.