Motors dont turn on at the same time

Hi,

I am making a drone with an Arduino as an FC and I have my Arduino connected to a 4in1 ESC that controls my 4 motors. When I move the joystick to add power, The drone motors turn on one by one as I increase power (I have to increase the throttle very slowly at the start to see it happen).

If you want, this is a video of the problem: https://drive.google.com/file/d/1FqVsEa8BPwgKMY0Tj8fXGpZU21N67Teb/view?usp=drive_link

I tried to change the order of the motors in code, but nothing changed. Any help is appreciated.

I don't think that's really a problem. If everything is set up correctly, they still aren't totally 100% in sync. The software you use that read in the various sensors and stick input should be making those slight corrections. Various things over time can also cause this slight motor RPM inequality such as prop condition, cat hair in the motor shaft (don't ask how I know that), etc. Plus they will have to spin at different RPM to maintain level position hold anyway in even slight wind so your flight controller should already be accounting for that.
When you take off, you want to overcome instability due to rotor wash and so thrust is you friend here to avoid pitching or rolling over unintentionally.

Does the documentation of this give any hint as to if this is normal or something that you can adjust for?

This is the link to the documentation. I was not able to find anything that looked like it could change the setting.

Thank you, I agree there is nothing in the documentation relating to your problem, so the problem must be in your code.

What happens if you exchange the connections between two of the motors ? Does the sequence of motor stay the same ?

This is the code I am running. I tried to change the sequence of the different tasks connected to the motors, but the sequence stayed the same.

#include "CRSFforArduino.hpp"
#define USE_SERIAL_PLOTTER 0
#include <ESP32Servo.h>

Servo ESC1;
Servo ESC2;
Servo ESC3;
Servo ESC4;

int throttleValue;
int throttleSafety;
int armHoverSwitch;

int roll;
int yaw;
int pitch;

int pitchRaw;
int rollRaw;
int throttleRaw;

int servoPin1 = D9;
int servoPin2 = D10;
int servoPin3 = D11;
int servoPin4 = D12;

CRSFforArduino *crsf = nullptr;

int rcChannelCount = crsfProtocol::RC_CHANNEL_COUNT;
const char *rcChannelNames[] = {
    "A",
    "E",
    "T",
    "R",
    "Aux1",
    "Aux2",
    "Aux3",
    "Aux4",

    "Aux5",
    "Aux6",
    "Aux7",
    "Aux8",
    "Aux9",
    "Aux10",
    "Aux11",
    "Aux12"};

void onReceiveRcChannels(serialReceiverLayer::rcChannels_t *rcChannels);

void setup()
{
    ESC3.attach(servoPin3,989,2000);
    ESC4.attach(servoPin4,989,2000);
    ESC1.attach(servoPin1,989,2000);
    ESC2.attach(servoPin2,989,2000);
    

    // Initialise the serial port  & wait for the port to open.
    Serial.begin(115200);

    // Initialise CRSF for Arduino.
    crsf = new CRSFforArduino();
    if (!crsf->begin())
    {
        crsf->end();

        delete crsf;
        crsf = nullptr;

        Serial.println("CRSF for Arduino initialisation failed!");
        while (1)
        {
            delay(10);
        }
    }

    rcChannelCount = rcChannelCount > crsfProtocol::RC_CHANNEL_COUNT ? crsfProtocol::RC_CHANNEL_COUNT : rcChannelCount;

    crsf->setRcChannelsCallback(onReceiveRcChannels);

    // Show the user that the sketch is ready.
    Serial.println("RC Channels Example");
    delay(1000);
    Serial.println("Ready");
    delay(1000);
}

void loop()
{
    crsf->update();
    if(armHoverSwitch == 1503)
    {
    if(throttleSafety == 2000)
    {
      ESC1.write(throttleValue + pitch - roll);
      ESC2.write(throttleValue - pitch - roll);
      ESC3.write(throttleValue + pitch + roll);
      ESC4.write(throttleValue - pitch + roll);
     
    }
    else
    {
      ESC4.write(1000);
      ESC1.write(1000);
      ESC2.write(1000);
      ESC3.write(1000);
    }
    }
    else
    {
      ESC4.write(1000);
      ESC1.write(1000);
      ESC2.write(1000);
      ESC3.write(1000);
    }
    
}

void onReceiveRcChannels(serialReceiverLayer::rcChannels_t *rcChannels)
{
    if (rcChannels->failsafe == false)
    {
        /* Print RC channels every 100 ms. */
        unsigned long thisTime = millis();
        static unsigned long lastTime = millis();

        /* Compensate for millis() overflow. */
        if (thisTime < lastTime)
        {
            lastTime = thisTime;
        }

        if (thisTime - lastTime >= 100)
        {
            lastTime = thisTime;
#if USE_SERIAL_PLOTTER > 0
            for (int i = 1; i <= rcChannelCount; i++)
            {
                Serial.print(i);
                Serial.print(":");
                Serial.print(crsf->rcToUs(crsf->getChannel(i)));
                Serial.print("\t");
            }
            Serial.println();
#else
            pitchRaw = (crsf->rcToUs(crsf->getChannel(2)));
            rollRaw = (crsf->rcToUs(crsf->getChannel(1)));
            throttleRaw = (crsf->rcToUs(crsf->getChannel(3)));
          
            throttleValue = map(throttleRaw, 989, 2012, 1000, 2000);
            throttleSafety = (crsf->rcToUs(crsf->getChannel(5)));
            armHoverSwitch = (crsf->rcToUs(crsf->getChannel(6)));

            pitch = map(pitchRaw, 990, 2012, -250, 250);
            roll = map(rollRaw, 989, 2012, -250, 250);
            Serial.print(throttleValue);

            Serial.print("RC Channels <");
            for (int i = 1; i <= rcChannelCount; i++)
            {
                Serial.print(rcChannelNames[i - 1]);
                Serial.print(": ");
                Serial.print(crsf->rcToUs(crsf->getChannel(i)));

                if (i < rcChannelCount)
                {
                    Serial.print(", ");
                }
            }
            Serial.println(">");
#endif
        }
    }
}

I resoldered all 3 connections from motor 1 to the pads on motor 2, and all 3 connections from motors 2 to pads of motor 1 (on the ESC). Now motor 1 turns on first, because it is connected to pads of motor 1.

What order did they start turning in before you made the change and what order do they turn in now ?

the motor connected to ESC pad 1 first, then 2, then 3 and 4 is last. Both before and after the change

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.