# Why does the ESC stop?

I've built a quadcopter with four brushless motors and ESCs (30A). I'm using an Arduino to control them. I haven't written any complex code; just enough to get them running. Everything is fine until I send a number over 920 to the serial. Then, for some reason, all the motors stop spinning. I'm using three freshly bought and charged LiPo cells (V = 11.1V). Here is the link for the site that I bought them from (I cannot seem to find any other resource about them) : 4x A2212 1000KV Outrunner Motor + 4x HP 30A ESC + 4x 1045 prop (B) Quad-Rotor.

When I tried turning on only one motor, I could write up to about 1800 microseconds, while both with 4 and with 1 motor, the minimum that it works is 800.

Can somebody explain why this happens and I how I can fix it?

Here is my code:

#include <Servo.h>

int value = 0;

Servo first,second,third,fourth;

void setup() {

Serial.begin(9600);    // start serial at 9600 baud
first.attach(6);
second.attach(9);
third.attach(10);
fourth.attach(11);

}

void loop() {

first.writeMicroseconds(value);
second.writeMicroseconds(value);
third.writeMicroseconds(value);
fourth.writeMicroseconds(value);

if(Serial.available() > 0){
value = Serial.parseInt();
}

}

• Welcome to Robotics Petros. For a better answer, you really need to say what ESC you are using, ideally editing your question to add a link to the datasheet for it. – Mark Booth Mar 8 '16 at 16:59
• Also, I would be interested to know the full range of values which do work. When you write 920, is it running at minimum, maximum or full speed. What value in microseconds do you have to write to get it to move at other extreme (slowest if 920 is fastest) etc. All of this information can be edited into your question to make it easier for people to answer your question. – Mark Booth Mar 8 '16 at 17:01

First of all I would suggest calibrating them.

From the eBay page you linked to, It would seem that the ESCs are probably HobbyWing (or HobbyWing clones). I would suggest finding some spec sheets for HobbyWing ESCs and using that information to calibrate them as well as understand them better.

Since they seem to respond to values in the range 800-1800 they probably need to be calibrated. The usual range is 1000-2000. I've had HobbyWing ESCs and there is a way to send the proper min and max values to the ESC. Besides that you could adjust your code to accept values in the range 800-1800 and assume 900 is the centerpoint. In a sense, you'd be calibrating them yourself via your code.

As far as them not operating over 920, it almost sounds like a power issue. You say you are using "3 freshly bought and charged LiPo cells (V = 11.1V)". Are you in fact using all three at once? I'm not sure how you've wired them up, but here is an example of proper wiring:

• I think my connections are just like that, but, I'm not using an ardu-pilot, I'm using a standard arduino-uno board. – Petros Mar 8 '16 at 20:25
• Since you have the same escs can you tell me the proper way to power them? I'm using 3 LiPo cells (3.7V, 2500mAh). Did you use an arduino or an other flight controller? If the first was the case, could you post the code that got the motors running? – Petros Mar 14 '16 at 18:24

Following on from Octopus's answer, this comes from the thread, Hobbypower ESC-30A on rcgroups.com, where a user was having the same trouble calibrating them.

I bought exactly the same ESCs from eBay and asked the seller for a datasheet. It appears that WaspNest was right, they match Hobywing product.
Here is a link to the datasheet he sent me: https://dl.dropboxusercontent.com/u/...030A%20ESC.jpg

Here is the datasheet, referred to above:

.

There is also the following:

A programming card is available: Hobbywing Pentium Series Brushless Speed Controller ESC Program Card. It should work with these ESC's with no problem.
Manual?

Unfortunately the first link has expired, and the second link is to the HobbyKing 20A and 30A UBEC, but it could be of some use.

• Useful graphic. This looks like exactly the data sheet I used to have. The programming card isn't necessary. Its function isn't much different from an Arduino on a serial port. – Octopus Mar 9 '16 at 16:08
• @Greenonline - Since you bought the same ESCs, can you tell me the proper way to power them? I'm using 3 LiPo cells (3.7V, 2500mAh). Did you use an arduino or an other flight controller? If the first was the case, could you post the code that got the motors running? – Petros Mar 12 '16 at 16:28
• @Petros - Unfortunately, I don't have the same ESCs, I was merely quoting the link where I managed to locate the data sheet. It is Octopus who says that he had the same ESCs as you. I would suggest that you ask him :-) – Greenonline Mar 12 '16 at 18:25

Looking at the documentation for the Arduino servo library it looks like you are reusing the servo library to produce a PWM speed control for your ESC.

Although the writeMicroseconds() function page doesn't mention continuous rotation servos, the write() function page does:

Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with 0 being full-speed in one direction, 180 being full speed in the other, and a value near 90 being no movement).

What the writeMicroseconds() function page does say is:

On standard servos a parameter value of 1000 is fully counter-clockwise, 2000 is fully clockwise, and 1500 is in the middle.

Which would suggest that 1500 would be static, 1000 would be full speed in one direction, and 2000 would be full speed in the other direction.

For motors which only go in one direction though, an ESC might change those ranges to maximise the controllability of the motor by accepting a larger range of PWM values, and mapping them to unidirectional speed only.

Depending on your ESC, it may be that as you approach 1000, you are reaching the maximum speed, and as you exceed the maximum speed it is capable of the motor shuts off as a protection mechanism.

Ultimately, only the data sheet for your ESC can tell you why your system is behaving the way it is.

• ESCs don't behave like continuous rotation servos. Rather it is more like a standard servo with the low value (usually 1000) indicating lowest speed and the high value (usually 2000) indicating highest speed. – Octopus Mar 8 '16 at 19:42
• Hence why I said For motors which only go in one direction though, an ESC might change those ranges to maximise the controllability of the motor by accepting a larger range of PWM values, and mapping them to unidirectional speed only. Sadly the 'data sheet' uses rcservo speak rather than actually providing a pwm timing diagram, that an engineer would find useful, so I will have to leave this question to rc people. *8') – Mark Booth Mar 9 '16 at 12:42

Have you calibrated your ESC? If you have not yet done so, you can calibrate it using PWM.

First you send max PWM to the ESC, then you send min PWM to the ESC, then send PWM 20 milliseconds (assuming a 50Hz PWM signal). When you give PWM above 20ms your motor will rotate forwards, and if you give PWM below 20ms your motor will rotate backwards.