ESC not responding until half throttle.

Hello everybody,

I’m a college student working on a autonomous quadcopter project, the link to the quadcopter we are using is http://www.parallax.com/product/80000. We bought everything in this kit except for the Hoverfly OPEN broad, we instead decided to use a Arduino UNO that we could program ourselves to control the quadcopter.

Currently in my project I am simply trying to control a Brushless Outrunner Motor 1000kv (http://www.parallax.com/product/750-90002) using the Arduino’s Servo library and a ESC (http://www.parallax.com/product/750-90000). The code that I will post at the bottom of this post is meant to simply measure the voltage across a potentiometer, convert it to something the ESC can read using the Servo library, and then write it to the Servo. It also outputs the current signal being sent to the ESC so that I know where the throttle is.

My problem is that as I’m attempting to control the motor I cannot get it to respond until half throttle, at which point the motor will jump to 50% of its max speed. I have checked a number of sites trying to determine why this is happening and no one can really tell me why, all they suggest is to try with a different brand of ESCs. I am currently attempting to resolve the problem starting with a fresh un-calibrated ESC (same brand) and re-calibrating it to see if maybe I messed up the process the first time.

If anyone could help me out with this problem and suggest a few other things I could do to help find the problem I would greatly appreciate it. I’m new to both the Arduino and quadcopter world so I’m having trouble figuring out how to get everything to work. Thank you for taking the time to read this and for any help you may be able to offer.

Code:

#include <Servo.h>                               // This calls the Servo libaray, this libaray will control a servo motor for us.
Servo esc;                                       // creates servo object to control a servo.
int throttle;                                    // Creates a variable we will use later to control the ESC.
int throttlePin = 0;                             // creates a variable to read the throttle from.

void setup() {     
esc.attach(9);                                   // This command tells arduino that the esc is reciving input from pin 9.
Serial.begin(9600);                              // starts the serial port
Serial.println("ready");
}

void loop() {
throttle=analogRead(throttlePin);                //reads the voltage from the potentiometer
throttle = map(throttle, 0, 1023, 0, 179);               // This turns the range of our speed options to something the servo liabary can read.
esc.write(throttle);                           // This tells the esc what our servo speed should be. 
Serial.println(throttle);                    // Tells us what the thottle is
delay(5000);                                // This tells the program to puase for a 5 secounds.
}

I would question the 5 second delay. Why is it in the code?

When posting code please enclose it in CODE tags so the forum software doesn’t mangle it. You can add them by editing your post, selecting the code and clicking the # button in the edit window.

Many brushless ESCs require some sort of arming sequence before they start. Does yours need anything like that?

If the ESC has been calibrated to a particular range of throttle positions and you calibrated it using the Arduino then it’s quite possible you got it wrong. Try recalibrating it.

Does the sketch print out values varying smoothly from 0 to 179 as you move the potentiometer? Maybe you have a hardware fault which is causing the servo position to jump from 0 to 90 degrees - you can see that easily, but we can’t.

The five second delay between readings seems excessive.

According to the specs I have on the ESC I am using (as lousy as they are) there is no arming sequence, but by arming sequence I assume we are referring to a sequence of actions that need to be done in order for the ESC to start up. All the specs say is that the rocker needs to be at the bottom or else it will not start.

Yes the sketch print out vary very smoothly according to how I change the potentiometer, no jumps or anything that I would think should be alarming. I do realize that the 5 second delay is quite excessive, that was actually from another code where the Arduino would randomly produce a speed and then hold it for 5 seconds. For the posted code I had the delay set at 50 milliseconds. I was told to do this so that the hardware could keep up with the software.

I will try to re-calibrate the ESC, but I’m unsure that this is the problem. I would think if I messed up the calibration in the first place that the ESC would not respond near the top or near the bottom of my throttle range. In my current case it doesn’t respond until EXACTLY half throttle, which leads me to believe that there is some sort of communication issue between the Arduino and the ESC or the ESC and the servo.

Thanks again for the help; I’m not sure what other information I can provide in order to help solve the problem. If you need to know anything just ask and I will do the best I can to provide an answer.

try using the WriteMicroseconds() function

[soapbox] Hi.
throttle = map(throttle, 0, 1023, 0, 179);

I'm sorry but I reguard this as a bit of sloppy code, mapping throttle back onto itself.
Is the variable "throttle" the throttle position?
OR
Is the variable "throttle" the ESC throttle position?

int ESCthrottle = map(throttle, 0, 1023, 0, 179);

This makes more sense and as the program develops could help avoid some funny problems.
[/soapbox]
Tom..... :slight_smile:

I can't think why 50% throttle would be significant. Does the speed controller support reverse (i.e. neutral is the mid position) or forward only? I can't imagine how this would cause these symptoms either way though.

The only thing I can come up with is that you haven't got the wiring right and something is floating. Can you post a circuit diagram to show how you've got the power supplies, ESC, Arduino and pot all connected up?

some escs just stop the motor when you apply reverse

I constructed a pretty basic wiring diagram, rather laughable I think. I’m an aerospace major not electrical so don’t judge me to hard. But the setup is really that simple, no resistors or transistors or anything. I hope that helps a little bit.

I forgot to pick up my equipment from home as I was leaving for school today so I won’t be able to attempt the re-calibration today :frowning: But I have found the name of the ESC I am using. It’s called a GemFan 30 A Electronic Speed Controller. Has anyone dealt with one of these before? As far as I know it does not support a reverse feature, I also thought that might be the case but I really don’t know how to test to see if it does have a reverse.

Now that I found the actual name of the ESC I think I’m going to do quite a bit of internet research on it.

Thanks again everybody.

How are you powering the Arduino?

Can you confirm that the yellow wire to the pot is connected to the wiper?

I'm powering the Arduino with my laptop currently, just by plugging in the Arduino the same way I would to download my code to it.

And yes I'm sure the yellow wire is connected to the wiper, I used a multimeter to see how the output was varying from that wire.

I emailed the makers of the esc earlier to see if maybe I had the wrong specs, no word back yet.

Thanks for taking the time to keep coming back to this post Peter, I realize I'm not giving much information here.

Hi, have you tried using a different output pin on the arduino.

Tom... Just a thought........ :slight_smile:

I don't see anything wrong with the circuit. I don't see anything wrong with the software either. If the sketch is reporting the throttle 'angle' moving smoothly from 0 through 179 degrees then this ought to be sending a pulse in the 1-2ms range at 50 Hz which is the standard RC servo signal - the Parallax web site indicates that your ESC supports this. I can only think that you need to look again at how the ESC is programmed and make sure that's sensible.

Pot/servo test code setup so that the servo values being sent can be viewed in the serial monitor.

//zoomkat dual pot/servo test 12-29-12
//view output using the serial monitor

#include <Servo.h> 
Servo myservoS1;
Servo myservoS2;

int potpinS1 = 0;  //analog input pin A0
int potpinS2 = 1;

int newvalS1, oldvalS1;
int newvalS2, oldvalS2;

void setup() 
{
  Serial.begin(9600);  
  myservoS1.attach(2);  
  myservoS2.attach(3);
  Serial.println("testing dual pot servo");  
}

void loop() 
{ 
  newvalS1 = analogRead(potpinS1);           
  newvalS1 = map(newvalS1, 0, 1023, 0, 179); 
  if (newvalS1 < (oldvalS1-2) || newvalS1 > (oldvalS1+2)){  
    myservoS1.write(newvalS1);
    Serial.print("1- ");
    Serial.println(newvalS1);
    oldvalS1=newvalS1;
  }

  newvalS2 = analogRead(potpinS2);
  newvalS2 = map(newvalS2, 0, 1023, 0, 179);
  if (newvalS2 < (oldvalS2-2) || newvalS2 > (oldvalS2+2)){  
    myservoS2.write(newvalS2);
    Serial.print("2- ");    
    Serial.println(newvalS2);
    oldvalS2=newvalS2;
  }
  delay(50); //slow down looping to better read serial monitor 
}

zoomkat:
Pot/servo test code setup so that the servo values being sent can be viewed in the serial monitor.

The original code already does that.

When looking at the programmable values if the esc what sort of things should I look for? Which items could be making this problem occur? I

The ESC must be programmed using either a programming card http://www.parallax.com/product/85000 or some other way. (I think you can do it with a radio/receiver using the beeps as a guide).

I have this quad with the Hoverfly and have driven a motor/ESC using an Arduino for testing - it's possible.

The full Parallax kit comes with instructions covering programming the ESC's and setting the endpoints with the radio.

PeterH:

zoomkat:
Pot/servo test code setup so that the servo values being sent can be viewed in the serial monitor.

The original code already does that.

I guess once every five seconds works for you. 8)

I have done it just using the beeps as a guide and it gets quite confusing quite quickly. Because of this I have ordered the programming card already, should be somewhere in the system at school.

What I have done up to this point is kept all of the programmable values at their default settings. I recently changed the the low voltage protection threshold to its lowest value to see if maybe that was what was causing my motor to be unresponsive until 50% throttle. But it did not change anything, instead I just burned out my motor.

Side question, do you guys think that my motor burned out at the highest throttle setting because of me changing this low voltage protection threshold?

zoomkat:

PeterH:

zoomkat:
Pot/servo test code setup so that the servo values being sent can be viewed in the serial monitor.

The original code already does that.

I guess once every five seconds works for you. 8)

Yeah that was a error, it was for a different test. For the code for controlling my motor I use a 50 millisecond delay.