# Activating Electronic Speed Control with Arduino

For anyone else looking at this, most of our problems seemed to result from not having the pulse range quite right. We eventually hooked our ESCs up to a standard RC controller and used an oscilloscope to figure out the exact pulse range they would respond to.

I'm working on an Arduino-controlled quadcopter using Tower Pro W18A (which are actually labelled Toward Pro). I'm using the Arduino Servo library to control the ESCs ( Electronic Speed Control).

The problem is that the ESCs don't start responding immediatley. There is some sequence of throttle commands that has to be sent before they will turn on and begin responding to commands.

At first, I created a program to let us set the value being sent to the speed controllers manually from a slider. Using this, I've discovered that starting at 0, sliding up to around 70-90, and then sliding back down to zero activates the ESCs. After that, they respond normally.

For some reason, I haven't been able to replicate this in code, though. This is what my code looks like at the moment.

  Serial.println("Setting all to 0...");
setAllESCs(0);
delay(2000);
for(int i=0;i<70;i++){
setAllESCs(i);
delay(20);
}
for(int i=70;i>0;i--){
setAllESCs(i);
delay(20);
}
delay(2000);
Serial.println("Ok, trying at 50...");
setAllESCs(50);
delay(500);
Serial.println("Going in 1 sec...");
setAllESCs(0);
delay(1000);


I've tried several variants. 0 to 90 to 0. 0 to 180 (max) to 0. 0 sliding up to 90 and back to 0. No luck yet.

Does anyone have experience with getting this activation of the speed controller to work?

There are numerous mentions online of the (limited) documentation that comes with the ESC being wrong, but nothing providing more detail about this.

-
What does ESC stand for? Electronic Speed Control or Electronic Stability Control? –  abdullah kahraman Jan 10 '12 at 11:53
@kahraman: Yes, the specific device he's using is an electronic speed control. –  davidcary Jan 14 '12 at 5:22
I fixed a tiny bug in the code -- did that make any difference? –  davidcary Jan 14 '12 at 5:26
Is it possible that maybe servo.write(0) to servo.write(90) are all being interpreted as "negative" speeds and clipped to "don't move", and maybe servo.write(91) to servo.write(180) -- "positive speeds" -- are necessary to get it to move? –  davidcary Jan 14 '12 at 5:33
Relatedly, have you tried a 'slow-ish' ramp to your test value of 50? (i.e. mimicking how the slider would be interpreted by ESC/arduino) –  CoderTao Feb 13 '12 at 17:33

I have worked on building a homemade quarocopter for my final year project, I remember having trouble with this too :)

I have used Turnigy Plush 30amp Speed Controllers.

Frist of all, FYI:

The normal sequence when staring an ESC (again, the one I worked with) is:

1. as soon as your ESC is powered - minimun throttle (close to 1ms pulse) for about 3 seconds (until the beep codes for battery type and ok to start are elapsed)

This is a safety feature - normally, this means that the throttle stick is at minimum. However, a great majority of Electronic Speed Controllers are programmable in terms that you have to program this minimum (and maximum) throttle I said earlier about. In other words maybe that programmed minimum throttle is around 0.7ms (if you programmed it from RC transmitter with trim set to minimum) and when you power on your ESC input is around 10ms pulse, it's a safety feature it won't start, since in this case throttle is not minimum.

In order to program the new maximum and minimum input values (calibration):

1. Power On
2. as soon as you ESC is powered - maximum throttle (close to 2ms pulse) again wait for the beeps (only battery type)
3. quickly jump to minimum throttle (close to 1ms pulse) and wait again for the new initialization beeps (this time there will be less, without battery type)
4. new values for minimum and maximum throttle are now stored

I strongly recommend you use this kind of initialization every time so that all ESCs will be synchronized regarding minimum and maximum value of throttle. Also I strongly recommend you don't have any propellers mounted when experimenting with this approach :)

Now, regarding your code,

• I don't think you need to slide all the way up to the maximum or to down to the minimum during the initialization phase (in my case ESC expects value ASAP, with no slides), you should write the output value directly(no slide up/down).
• As soon as you reach the maximum value you start sliding down to the minimum. You should stay long enough at maximum value (Around 1 second)
• If initialization is not OK on first try, ESC is locked until supply is cut and turned on back again. There is no point in making attempts to initialize if first attempt is failed.

When calibrating or starting the ESC be sure to hold minimum value and/or maximum value as long as it is required. Something like:

Normal starup(as you described your ESC):

• Turn On ESC
• minimum throttle
• wait 2 seconds
• maximum throttle
• wait 2 seconds
• minimum throttle
• wait 1 second
• OK to Go

Normal starup(the ESC I used):

• Turn On ESC
• minimum
• wait 3 seconds
• OK to Go

Calibration:

• Turn on ESC
• maximum
• wait 2 sec
• minimum
• wait 1 sec
• OK to go

Another thing, good to know, entering programming mode for ESCs allows you to set a lot of parameters such as the cutoff threshold, brake. Before attempting flight, you must be sure that all these parameters are set the same for all ESC you use. Again, for the ESC I used, see the manual, page 2.

I'm pretty sure you've already figured this out, but I wanted to post it maybe it will help others :)

-

This is a safety feature, if you connect up your plane ( for say an rc plane ) with the speed set high then you could get hurt. This sequence prevents that, as you must return the speed to zero then ramp up. ( I may be off a bit on the exact details )

-