Quadcopter using Arduino mega 2560

bought an EMAX 20A ESC and Emax mt2213 BLD motor.
using an arduino mega 2560 to build a quad copter using the above!
I am not able to Callibrate the ESC with the motors or run them. tried with many sketches.. all were negative!!

could anyone help me out with that???
thank you...

How about sharing some of your secrets with us?

For example ...

The code for the sketch that worked best?
What did it actually do?
A link to the specifications for the ESC?
A link to the specs for the motor?
A wiring diagram (a photo of a pencil drawing is fine)?

...R

i am using the following ESC:
http://emaxmodel.com/views.asp?hw_id=1307
and motors:
http://emaxmodel.com/views.asp?hw_id=1240

i used the standard code for setting the ESC using a potentionmeter at A0 pin and mapping the values of 10bit PWM ranging from 0 to 1023 with 0 to 179 . but WIth the instructions could see that , the ESC was able to recognise only the highest point i.e; the max. rpm !!
this was the setup i used for ESC callibration:

You haven't posted your code or the wiring diagram.

How many times do I have to ask?

...R

here it is:

#include <Servo.h>

Servo esc;
int pot = 0;
int pot1;
int throttle;

void setup()
{
esc.attach(9);
Serial.begin(9600);
}

void loop()
{
int pot1 = analogRead(pot);
Serial.println(pot1);
throttle = map(throttle, 0, 1023, 0, 179);
esc.write(throttle);
Serial.println(throttle);
}

This is like finding a hen's teeth.

How many things did I ask you to provide?

...R

sorry about that...i even have pics ... butt not getting, how to upload them !!! just trying to do so!!!

this was the setup i tried to calibrate the ESC.. i had tried with both 1K and 10K potentiometer !!!

Thanks for that. I had felt the "here it is:" with your code was a little abrupt.

Unfortunately I can't tell from your photo exactly what is connected to what. Can you do a clear pencil sketch and upload a photo of that?

I see from the webpage for the ESC that there is a startup procedure. Are you following that correctly? can you tell us how you deal with each step and what response you get from the ESC?

...R

yeah.. i read the instructions. and followed them.. what id did was:
initially i kept the pot to max. i.e; it gave a value of 1023, connected the yellow wire of ESC to digital pin 9.
then gave the power connection to the ESC.

As expected i got 2 beeps from ESC which indicates that ESC has recognized the max. rpm !! then within 2 seconds i decreased the pot value to 0 . I expected that the ESC should have recognized the min. rpm . but always i get a continuous beep which indicate lack of signal or sometimes i get different kind of beeps as it comes in the transmitter programming mode for changing brake settings and many more!!!

I don't know if this will help with an ESC. It is a common problem with servos that the range through which they work isn't exactly matched by the Arduino's 0 to 180.

I suggest you try using servo.writeMicroseconds(xxx) as it gives you finer control. In theory xxx should range from 1000 to 2000 microseconds (= 1 to 2 millisecs) for the range 0 to 180. I would try setting your bottom numbers perhaps below and above 1000. Perhaps up to 20% either side.

This is just a trial and error process to find out the setting that corresponds to your ESC's notion of minimum throttle.

By the way when you say "contimuous beep" to you mean a continuous single constant tone or a continuous series of beeps?

Finally your diagram is very clear and the wiring seems to be correct.

...R

hi .. thanx for your suggestion.. i tried with a similar program .. i found this code in the forum. it worked better. but i did not understand the working of the code.
here is the code:
int STATE =1;
int Arming_Time=0;
int pin=9;

int Pulse=1000;

void setup()
{

pinMode(pin,OUTPUT);

for(Arming_Time=0; Arming_Time < 500; Arming_Time += 1)
{
digitalWrite(pin,HIGH);
delayMicroseconds(1100);
digitalWrite(pin,LOW);
delay(20-(Pulse/1000));

}
}

void loop()
{
for(Pulse = 1050; Pulse <= 1300; Pulse += 1)
{
digitalWrite(pin,HIGH);
delayMicroseconds(Pulse);
digitalWrite(pin,LOW);
delay(20-(Pulse/1000));

}
}

even with this there was a problem. when we run this program the ESC gets callibrated and makes 2 beeps !! but the motor does not start rotating. If we rotate the motors ourselves, after few seconds the motor starts to work properly !! i think, we need to give A high pulse initially for the motor to start . but did not get how to program it !!!

Put your code in code tags PLEASE

I can't make any sense of that code.

The "arming sequence" seems to be 500 pulses of 1100 microseconds with a gap of 20 milliseconds between them. That doesn't correspond with the instructions.

Then, in loop, it seems to vary the speed up from 1050 to 1300 and instantly back to 1050 over and over.

I wonder if the actual arming takes place when the code transitions from setup() (the 1100usec pulses) to loop() the 1050us and up pulses.

And why didn't the author simply use servo.writeMicroseconds() and save himself a lot of trouble.

The fact that the code seems to work supports my earlier comment that you need to experiment with the pulse lengths.

On the basis of that code maybe the following will work ...

#include <Servo.h>

Servo esc;

void setup() {

   Serial.begin(9600);
   Serial.println("Starting to Arm - LOW output");
   esc.writeMicroseconds(1050);
   delay(1000);
   Serial.println("Continuing to Arm - HIGH output");
   esc.writeMicroseconds(1300);
   delay(500);
   Serial.println("Arming done"
   Serial.println("Testing speed");
   esc.writeMicroseconds(1500);
   delay(2000);
   Serial.println("Stopping motor");
   esc.writeMicroseconds(1050);
  
}

void loop() {
   // deliberately empty
}

I suspect that 1300 is too low and 1800 might be better - but I am matching the numbers in the code you gave. And I might have the order of high and low for arming back to front because "your" code cycles I don't know which part actually did the job.

At least you have a short piece of code to try other options.

...R