Gentlemen.. I have a problem with these "Chinese" brush less motors i bought last week. I am using the following code to get it running. Its not consistent because sometimes it starts sometimes it doesn't and many times it doesn't look like its listening to the arduino at all. Sadly, if this happens my autopilot program wont work! This is my school project and I desperately need it to work. I'll be grateful for any help that I may receive.
#include <Servo.h>
Servo servo;
int pos;
void setup()
{
servo.attach(8);
servo.writeMicroseconds(1000); //Setting the toggle stick to least position
delay(3000); // Delay to arm the motors
}
void loop()
{
for(pos= 1200; pos<1801; pos+=10) {
servo.writeMicroseconds(pos);
delay(15);
}
servo.writeMicroseconds(pos);
while(1);
}
Then you have a hardware problem, not a software problem (except perhaps inappropriate, but not inconsistent, software)
I think so too.. I am using arduino and the mega version of it so its appropriate. And, as you said, its pretty consistent most of the time.
I'll try futuba/turnigy motors instead..
Brush-less motors are not necessarily servos. Why are you using servo code for them?
The both work on ppm signal so naturally i am using servo library.
The code in loop() (except the infinite loop) should be in setup() if it is to happen only once.
I'll surely try that.
Now, an infinite loop that prevents the Arduino from doing anything else. Why?
I aim at stopping the brushless motor at 1810 and i want to run it at that, for now i am using while(1); to pause the proceeding..
later I'll be using the raw data from the gyro to keep the speed at bay.
Brush-less motors are not necessarily servos. Why are you using servo code for them?
Because the vast majority of R/C type brush-less motors are powered/controlled by a ESC (electronic speed controllers) bought either as a set or separately with the motor. The ESCs only except a servo control input interface (1-2ms PPM), and provide the 3 pin female servo connector to plug into a standard R/C receiver as a servo.
OP: Are you sure your are following the correct 'arming' procedure? On the ones I had several years ago I had first to go to 100% speed (2000us) hold for more then a second, then go to 0% (1000us), the ESC would then 'beep' and would only then except valid speed commands. This of course is a safety feature to prevent the motor (often attached to a propeller) from starting up at initial power up. I suspect some ESC have slightly different 'arming' sequences and most of the Asian manufactures are not very good at documenting the technical details of their ESCs.
Also be sure your input voltage to the ESC is at or above the minimum requirements, as many would stop the motor, or slow it down, or pulse it on and off so as to prevent over discharging the main battery so much that Li-po battery damage could result. When used in a aircraft, this was used as a 'low battery warning' to get the plane down ASAP.