Am I using wrong Servo speed parameter?

321 views
Skip to first unread message

Dan N

unread,
Feb 7, 2014, 7:49:54 AM2/7/14
to drones-...@googlegroups.com
Seems MOT_SV_SPEED, and RC_SPEED, maybe mixed up in my Coax code.
 
I am trying to use other examples in the code, but they aren't clear either.
 
So are Servos (not ESC's) to be set with RC_SPEED or MOT_SV_SPEED? 
*I assume ESC will be opposite
 
Also what's with the default values of 250 & 490 hz vs standard RC of 50 hz?
(there not modified, I even checked with scope)
 
Are there servo's and ESC's that can run at this speed?
 
If so, I wish I had some :)
 
Sorry if I'm behind on this, it's been awhile since I was in the code.
I just think others will find it an issue, since I know there is no way any of my E-Flite ESCs will arm at 250 or 490 hz.
 
 

Randy Mackay

unread,
Feb 7, 2014, 8:18:42 AM2/7/14
to drones-...@googlegroups.com

Dan,

 

     Most ESCs should be ok at 490hz.  Most servos are with 125hz.  I’m less sure about 250hz, that seems a bit quick.  The trad heli is all 125 for the servos.

 

     My guess is we should change the default to be 125 for the Coax (and single copter) servos.

 

-Randy

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Dan N

unread,
Feb 7, 2014, 9:46:37 AM2/7/14
to drones-...@googlegroups.com
Really 490 Hz?
 
Max you can even do is 500 hz(2000 us)
 
You have my interest, now, Randy..... Breaking out my scope, and some other ESC's I have around here :)

Robert Lefebvre

unread,
Feb 7, 2014, 11:47:30 AM2/7/14
to drones-discuss
Dan, this is true.  The default framerate for multicopter ESC's is 490Hz.  They leave *just* enough for a sink pulse.  DJI for a while was even claiming impossible 800Hz rates.

Servos now typically take a 125Hz, and up to 333 Hz.  I've even run cheap $3 analog micro servos on 125 Hz without issue.  There are still some servos on the market that can't deal with more than 50Hz, but strangely, they seem to be name brand.

You still running a 72MHz radio? ;)

Dan N

unread,
Feb 7, 2014, 12:30:40 PM2/7/14
to drones-...@googlegroups.com
Best I could get my E-Flight ESC's to arm at was 150Hz,
 
I tried cheap HK, ESC's, that armed at 250 Hz, no problem.
 
I had the code to look at, so it wasn't an issue for me, however I am sure other people are using E-Flite, and so someone should suggest lowering default values, or how to fix the problem somewhere.
 
Servos seem to have no issue at 250hz (Spectrum and HK)
 
So I assume I have it right in my code ?
Message has been deleted

Dan N

unread,
Feb 7, 2014, 2:18:32 PM2/7/14
to drones-...@googlegroups.com
If you set RC_SPEED to anything above 50 Hz, _servo_speed and _speed_hz will equal MOT_SV_SPEED
 
I don't think this is what you intended Randy, but I can not find where the issue is
 
I noticed this, because well testing ESC's rates, I have my scope connected to a Servo channel, and a Motor channel, otherwise I don't think anyone would have noticed.
 
Your likely to find the problem quicker then I
 
 
 

On Friday, February 7, 2014 8:18:42 AM UTC-5, Randy Mackay wrote:

Robert Lefebvre

unread,
Feb 7, 2014, 2:50:05 PM2/7/14
to drones-discuss
Dan, would you mind flashing heli code, and see what the servo speed is?  This should either A) uncover a potential problem or B) help you solve your problem by looking at the heli code.

Dan N

unread,
Feb 7, 2014, 7:13:40 PM2/7/14
to drones-...@googlegroups.com
Scope is at work, will do monday, but you only set one Servo speed mask in Heli code, I already looked at it.
I use _servo_speed and _speed_hz in Coax

Randy Mackay

unread,
Feb 7, 2014, 8:22:02 PM2/7/14
to drones-...@googlegroups.com

Dan,

 

      There are some hardware limitations on the Pixhawk and APM@ as to what speeds we can set the channels to.  My guess is that ch1~ch4 all have to be the same speed.  I’ll bet that some of the higher ones (ch7~ch8) can be different though.  There is some grouping of the channels.

Robert Lefebvre

unread,
Feb 8, 2014, 7:08:29 AM2/8/14
to drones-discuss
In that case, I would set all the channels to 125, or 333 if you have good digital servos, and don't worry about it.  I doubt you'd really see a difference between 490Hz and 125Hz on the ESC response (yaw).

Dan N

unread,
Feb 8, 2014, 7:17:29 AM2/8/14
to drones-...@googlegroups.com
That makes sense Robert, and Randy. My ESC's can do 125, and what you say also makes sense Randy, as I didn't see this problem when using Channel 7
 
Again, scope is at work, I though I would be rebuilding my wifes transmission this weekend, but the parts did so up, so maybe I'll head in today and pick it up.
 
I will test this on different channels
 
MotorsSingle uses channel 7, and the two seperate speed defines.

john...@gmail.com

unread,
Feb 8, 2014, 7:59:35 AM2/8/14
to drones-...@googlegroups.com
All this is just academics as long as the AHRS system is not updated at the same rates.

That said, on WKM or XS-Y6 autopilots with internal AHRS updates at 1khz. I do notice a difference when increasing the "servo" rate. But >250khz there is not much more to gain, since mechanical/inertia drag becomes a major factor.

- JAB

Dan N

unread,
Feb 8, 2014, 8:43:55 AM2/8/14
to drones-...@googlegroups.com
I agree, but, I assume, this is in prep of increasing the loop speed, which from what I have read, is very likely soon, for Pix version.
I only had my Pix for a week, I am still figuring it out, but I can see no reason why not at this point.
 
I have had Ardu version running faster then 40hz, by taking alot of stuff out, that I just didn't need for our application, and was thinking of just getting the new IMU broad (whenever it's release), and using it with my own code.
Put Pix came, so going to try playing with it for awhile :)
 
HAL layer is next.

Robert Lefebvre

unread,
Feb 9, 2014, 11:26:21 AM2/9/14
to drones-discuss
Unless using standard ESC firmwares, where the faster PWM rates can push the changes through the ESC filter algorithm faster.  I've heard that default firmwares use an 8-sample lowpass filter, rather than a time-based filter.  So updating at 490Hz results in a real LPF filter rate of 61Hz.  If you only run 100Hz updates, you'd have a 12Hz update.

Something like that anyway.

Dan N

unread,
Feb 10, 2014, 9:01:24 AM2/10/14
to drones-...@googlegroups.com
I tested this on Single frame type this morning, which uses CH1-4 & CH7..... same effect, all the channels end up being controlled by RC_SPEED or MOT_SV_SPEED, not independent.
It seems to depend on the value of RC_SPEED, if it's set to 50hz, MOT_SV_SPEED is the master, if RC_SPEED is set to 150 or above, MOT_SV_SPEED is ignored, and RC is the master.
 
It appears you intended to be able to set Servo's and ESC's refresh rate separately, but this is not the case.
 
I am testing with one Scope channel on CH1, the other on CH7
 
Suggest you look at this Randy, it's likely in code I don't want to mess with yet.
 
*Setting RC_SPEED = 490 Hz, ends up being 400Hz. The output looks real clean, I am seeing very little / no jitter, on my Tektronic Digital

Randy Mackay

unread,
Feb 10, 2014, 9:45:58 PM2/10/14
to drones-...@googlegroups.com

 

     On the Pixhawk the maximum output rate to the ESCs/Servos is 400hz so even if you ask for 490 you get 400.  With the main loop running at 100hz for the moment even 400 should be fine.

 

     My guess is that if we separate the motors and ESCs a bit more.  Like put the ESCs on channel 1 & 2 and the flaps on 5,6,7,8 we will be able to control the speed separately.

Dan N

unread,
Feb 11, 2014, 6:46:33 AM2/11/14
to drones-...@googlegroups.com
I tested that Randy, as above, servo's on 1,2,3,4 motor on 7, using your Single type code

Ola Sbihat

unread,
Apr 15, 2015, 4:41:33 AM4/15/15
to drones-...@googlegroups.com


Hi,
I built the firmware coaxcopter, 2 outputs must with 250 Hz pwm to control the fans and 2 with 50 Hz must control the two control services. But I tested the output,the four outputs were 250 Hz. can you help me to find the problem ? should the 4 outputs been at the same frequency? can I change the output frequeny so 2 output controllen the two propellers with 250 Hz and 2 outputs controllen the two flaps with 50 Hz?
Reply all
Reply to author
Forward
0 new messages