Interfacing Arduino Mega 2560 with ESC

I have googled this problem quite a bit, found a bunch of example code, and nothing seems to work for me. I purchased 4 Hobbymate 15A Oneshot125 ESCs and 920kv brushless motors. I connected the red and black ESC wires to the battery, along with the Arduino Mega, and connected the three black wires to the three motor wires in order. I grounded the black wire from the three pin connector and wired the white one to the servo control pin.

I used several example codes, ranging from user created ones to the Servo Sweep example code, and nothing seems to work. At most, the motors make a kind of jittering noise, just rotating a tiny bit in random directions like the signals are just noisy and not providing any useful direction to the ESC.

Some users have suggested an arming sequence, some say the motor has to beep a certain number of times. The motor beeps occasionally, but I can’t seem to figure out exactly what makes it beep and what the beeps mean.

I am fairly new to this, but most people seem to have luck with the servo sweep example sketch when I am not. Has anyone used a Oneshot125 ESC with Arduino before, or have any advice on what to do next? Thanks in advance.

Please show your circuit diagram, including power sources, and your code.

This is the code I am using, and I included a picture of the wiring. I have tried changing the delays as well with no avail.

/* Sweep
 by BARRAGAN <http://barraganstudio.com>
 This example code is in the public domain.

 modified 8 Nov 2013
 by Scott Fitzgerald
 http://www.arduino.cc/en/Tutorial/Sweep
*/

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// twelve servo objects can be created on most boards

int pos = 0;    // variable to store the servo position

void setup() {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

I've had good luck making an ESC work by using the "Knob" example in the servo examples.

You will need a pot to use it. When firing things up have the pot rotated full either way then wait to see if the ESC arms itself.

If it does arm be very careful when fiddling with the pot to vary the speed. Those motors are FAST.

I've had good luck making an ESC work by using the "Knob" example in the servo examples.

You will need a pot to use it. When firing things up have the pot rotated full either way then wait to see if the ESC arms itself.

If it does arm be very careful when fiddling with the pot to vary the speed. Those motors are FAST.

I did this and the only response I get is a jittering when the analog input is mapped to 800ish... what kind of ESC are you using? Thank you.

I was able to configure the ESC to 1000-2000us using a sketch.The motor beeped as expected for calibration. HOWEVER, I still cannot run the motor. At 1000us nothing happens, as expected. At around 1100us the motor jitters and if I don't stop the motor, it will stop itself and beep once. Anyone know why that might be?

You still didn't tell us the voltage of your battery and motor. You should fix the electrical part first, before you start coding.

Thanks for your responses. It turns out the issue was the connection between the ESC and the motors. The wires I was using for testing were too thin and long. I clamped the connections directly from the ESC to the motor leads and it worked fine. Hopefully this helps other that have the same issue.