Trouble understanding ServoTimer2 and RC control in general

So to be as simple as possible, I don't have any experience in the RC world. I have read on wikipedia that the basis is a 1.5ms pulse being neutral with anything between 1.5 and 2.0 being forward and below that is reverse.

I have a BLDC controller which appears to have been programmed, such that 1730 uS is neutral instead. Ok fine, no problem. So what I want to do is ramp this thing up and down smoothly as though I'm turning the POT on one of those cheapo RC control modules you can buy, but simulated using the arduino.

Now up until now, I have been successful using this library in the following way:

  1. I attach the servo library to the pin going to the BLDC controller
  2. I "park" the BLDC at 1500 and wait 1000mS for the controller to beep at me that it's locked on, which it does
  3. After that, I increment the signal by 1 every 5 mS until it increments to 1730
  4. After this, I REQUIRE that any subsequent signal achieves the corresponding motor speed very quickly (ie. in < 100mS or thereabouts).

Here's my problem.

If I were to increment the signal from 1730 to 1850, which just happens to be the first number I need it to achieve, that's 150 increments. If I wait 5mS between each increment, that's 3/4 of a second I have to wait which is too long.

I could remove the delay but since the signal itself is 1730 uS (1.73mS), updating at Arduino clock speed means the signal will in fact flat-line because it's changing way faster than the pulse itself can update. I have read that if the controller doesn't see a pulse in 20mS it will de-sync and believe the signal is lost.

What is the correct or best way to ramp a signal quickly without losing sync with the controller? Do I even need to ramp through each step as I'm doing or can I just jump from 1730 to 1850 with no ramp at all?

Yes, or you could move in steps larger than 1

Difficult to comment without seeing the code you are using. But whether you are using the standard Servo.h library or ServoTimer2.h it is the library that manages the interval between pulses. Arduino clock speed has nothing to do with it.

Jumping straight from one value to another is fine, it just means that the speed of change is controlled by the ESC and the motor's inertia. You have no control over it. But if you just want "fast" then that's the way to do it.


That's very good news then. I didn't think you could do that but maybe it's because my attempt to do so was at initialization. Ie. I turn the power on and set the signal to 1730 immediately. That didn't work. Setting it to 1500 and then to 1730 also didn't work. But ramping it did. Maybe the controller hadn't locked on yet. So I guess once it's locked on, it will jump to any commanded value as long as there's no dead period longer than 20 mS, which might be the case if you iterate 200 times with a 5mS delay each time.