Using ESC with Arduino Mega

Sup forum!
Guys, I am finding some serious difficulties interfacing the esc with the arduino mega. I tried everything.. I suppose since both servo and esc work on the same RC receiver, the servo library must run 'em both. But, NO its not working :0 :0. Any help(ANYTHING REALLY..) would be much appreciated..

Guys, I am finding some serious difficulties interfacing the esc with the arduino mega.

The ESC, huh? Is it possible for you to provide a bit more information. After all, there are at least two different ESCs made.

Okay my ESC is a turnigy BASIC 25A esc, for my quadcopter. I tried it with 9ch turnigy RC receiver, it worked like a charm.. But now i tried to go a step further by using it with my 2560mega with the following code:

#include <Servo.h>
Servo myservo;
int pos = 0;
void setup()
{
  myservo.attach(9);
}


void loop()
{
  for(pos=0; pos<61; pos++)
    {
       myservo.write(pos);
       delay(50);
    }
  while(1)
    myservo.write(pos); //the speed stays constant at 60 whatever
}

Here i presume my servo library should do good even for my ESC 'cos they both are PPM type..

Here i presume my servo library should do good even for my ESC 'cos they both are PPM type..

Correct. However your ESC most likely has a startup 'arming' sequence that you must implement in your sketch before you can issue arbitrary motor commands. Check the ESC manual for the correct arming procedure.

Lefty

@ retrolefty-
Sure.. the mannual is weird, big time! All the instructions are for sentry25A and everywhere it says move the throttle stick up 'n all.. I am using arduino, i really dont know what "myservo.write() value" is equivalent to moving throttle stick up and down. Is there any library i can use?

rahlk:
@ retrolefty-
Sure.. the mannual is weird, big time! All the instructions are for sentry25A and everywhere it says move the throttle stick up 'n all.. I am using arduino, i really dont know what "myservo.write() value" is equivalent to moving throttle stick up and down. Is there any library i can use?

The arduino servo library has a, myservo.writeMicroseconds(xxxx); command , which you should use to simulate the arming commands that the trottle stick uses.

The xxxx value to use are:

1000 is equal to stick all the way down
2000 is equal to stick all the way up

The manual should give you the sequence and how long to stay at each position. I think most ESCs give a audio beeping sound to indicate when the arming sequence is complete. Once armed you should have total control of the ESC using any value between 1000 and 2000 with 1500 being 50% speed.

Lefty

Thanks a lot! I'll do just that and post my findings :slight_smile: