Strange problem controlling 4 Motors/ESCs

Strange problem controlling 4 Motors/ESCs with my arduino Uno R3 ! I'm using only the PWM pins for all my motors, gave them all correct inputs but only 2 out of 4 runs, and then even if I swap the pins of the one running and one not running, the one which was already running before starts running again but not the one which wasn't. Whatever I change in my code the sequence, the delay but some random motors sometimes only 1 or sometimes 2 works, I can't get them all or even more than 2 to work together at once. Maybe there is a problem in configuring the escs or I don't know what, I'm so frustated now. PLEASE HELP !

Don't ESCs take servo signals (not PWM)? Please post a data sheet for the ESCs.

I don’t have any datasheet for the ESCs, they are generic unbranded 30A ESCs, nothing is written on them except ‘30A’.

This is the sketch that I’ve been trying to run :

#include <Servo.h>
Servo c;
Servo a;
Servo b;

int x=1400;
void setup()
{
c.attach(5);
a.attach(10);
b.attach(9);
delay(3000);

a.writeMicroseconds(1000);
b.writeMicroseconds(1000);
c.writeMicroseconds(1000);
delay(3000);
}

void loop()
{

a.writeMicroseconds(x);
b.writeMicroseconds(x);
c.writeMicroseconds(x);

delay(1000);
}

When posting code, use code tags. It makes the code easier to read and pull in to the IDE or other test editor.

Some ESCs require an arming sequence. Something like:

  • power on at zero throttle
  • wait a few seconds
  • move to full throttle
  • wait a few seconds
  • move to zero throttle
  • wait a few seconds
  • Now you are armed

Do you have a potentiometer? If so, wire it up as is done in the knob servo tutorial. Map the pot value to the servo value. Set the pot to the zero throttle postition before applying power to the ESCs. Apply power to the ESCs. Try walking through the above sequence and see what happens.

I don't have a potentiometer :(

Update : I tried using only one pair( signal and ground) from the arduino and gave the same to 3 motors using a breadboard, strange thing is all the motors wre now confgured when I removed and reconnected the ground pin on the arduino. BUT, still all the three motors are rotating without sync, but they should work all together because the same signal from arduino is being used right?

Update : I just found out mine are SIMON 30A ESCs. :/

How are you powering the ESCs and motors? Try this test sketch with 1 ESC / motor at a time:

/*
 Try this test sketch with the Servo library to see how your
 ESC responds to different settings, type a speed (1000 - 2000)
 in the top of serial monitor and hit [ENTER], start at 1500
 and work your way toward 1000 50 micros at a time, then toward
 2000. 
*/
#include <Servo.h>
Servo esc;

void setup() {
  // initialize serial:
  Serial.begin(9600); //set serial monitor baud rate to match
  esc.writeMicroseconds(1500);
  esc.attach(9);
  prntIt();
}

void loop() {
  // if there's any serial available, read it:
  while (Serial.available() > 0) {

    // look for the next valid integer in the incoming serial stream:
    int speed = Serial.parseInt();
    speed = constrain(speed, 1000, 2000);
    esc.writeMicroseconds(speed);
    prntIt();
  }
}
void prntIt()
{
  Serial.print("microseconds =  ");
  Serial.println(esc.readMicroseconds());
}

siddharthbhadauria: Update : I just found out mine are SIMON 30A ESCs. :/

The popular ESC SimonK has these instructions.

  1. SimonK firmware ESC start-up tones All ESCs make the motors sing, so does SimonK firmware ESC. When connected to power, you need firstly unlock the flight controller. Then ESCs make 3 beeps (di da di), to tell you self­detection finished. If flight controller also makes control instructions, a long beep (di­­­­) will tell you ESCs have received throttle signal from flight controller and ready to start. Then pull up the throttle stick, motor starts to run. OK! Let's go!

So it sounds like my earlier description of an arming sequence does not apply here.

Edit: This still leaves open @outsider's question on how you are powering the ESCs/motors. Can you post a wiring diagram? Pencil, paper and a camera are good enough if you include proper detail.

Found the datasheet and now I'm somehow able to use all the motors and escs together. Thank you everyone, cheers !