Questions on Brushless Motor & ESC code, and noted peculiarities....

I’m an electrical engineering student building an airship using a modified quadcopter base. (for reasons). [Lift/buoyancy provided via helium balloon, not pictured]

Microcontroller is the Galileo II.
30A Afro ESC’s, 33mm motors. Li-Po battery.

I’ve a noted a few peculiarities with my rig and wanted to see if anyone had comments/suggestions on my code.

Q1) I also was curious is anyone knew how to reverse direction of a brushless motor without having to re-wire it?
[Due to plug size differences I had to solder the motors to the ESC’s.]

Q2) My vertical motors only require a myservo.write(4) to start spinning, horizontals require (54) to start.
Even when I turn the device over to remove gravitational resistance same values needed to move motors. (All are wired the same and ideally same soldering job.)

–Verticals are in pin 1009, 1010.
–Horizontals are in pin 1005, 1006.
++Swapping them around doesn’t change the outcome either.

I tested each motor one at a time. All rotate CCW at this time. Need two to rotate CW (hopefully without re-wire but will if I have to).

Test code:
#include <Servo.h>

Servo myservo;

void setup()
{
myservo.attach(5); // attaches the servo on pin X to the servo object
myservo.write(0);
delay(3000);
}

void loop()
{
myservo.write(54); //vary this number to change speed…
delay(1000);
myservo.write(0); //pause motor
delay(1000);
}

Hi,

Can you please post a copy of your sketch, using code tags?
Please use code tags.. See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Thanks ..Tom.... :slight_smile:

Most sensorless brushless ESCs don't reverse, they are not designed to do so.
I think you can get specialized sensorless ESCs with reverse, and definitely
sensored ESCs/motors that do this.

With a sensorless motor the backEMF is used for commutation timing and that
requires a minimum motor speed to be sensed reliably.

I own 5 sensorless, brushless ESCs and they all have reverse. In fact every one I've ever bought has had reverse. It's definitely not uncommon but make sure the ESC you're using has reverse! And if it does have reverse make sure it's enabled by selecting the correct ESC mode.

OK here is my tagged code.

#include <Servo.h> 

Servo Lift_Port;
Servo Lift_Stbd;
Servo Thruster_Stbd;
Servo Thruster_Port;

void setup() 
{ 
  Lift_Port.attach(9);      // attaches the servo on pin X to the servo object 
  Lift_Stbd.attach(10);
  Thruster_Stbd.attach(5);
  Thruster_Port.attach(6);
Lift_Port.write(0);        // All Stop
Lift_Stbd.write(0);        // 
Thruster_Stbd.write(0);    // 
Thruster_Port.write(0);    //
    delay(3000);
} 


void loop() 
{ 
  Lift_Port.write(4);        // Test all 4
  Lift_Stbd.write(4);        // The (#) is the smallest number that will move them.
  Thruster_Stbd.write(54);    // 
  Thruster_Port.write(54);    //
  delay(1000);
    Lift_Port.write(0);        // All Stop
    Lift_Stbd.write(0);        // 
    Thruster_Stbd.write(0);    // 
    Thruster_Port.write(0);    //
    delay(1000);
}

All 4 motors will run, the above is the min value it take to make them rotate.

ScrambledEggs:
I own 5 sensorless, brushless ESCs and they all have reverse. In fact every one I've ever bought has had reverse. It's definitely not uncommon but make sure the ESC you're using has reverse! And if it does have reverse make sure it's enabled by selecting the correct ESC mode.

OK then, the cheap chinese one's don't seem to have reverse, not documented in
English at any rate!

For the OP: If you want permanent reversal you simply swap any two of the 3 wires
to the motor.

Drat, I was afraid of that. Time to modify my plans!

Thanks everyone for the help!

Buy a motor controller for an RC car. That will have a reverse available.