Arming a flight controller using arduino

My problem is that I can not ARM flight controller from Arduino ? I used to do this by moving the left stick of my transmiter to the down right corner(MIN Throttle and MAX Rudder).

I have already tested the quadcopter without the Arduino and I have also wrote down the values of the throttle and the rudder.

I can see these values (in serial monitor) are going to the flight controller through Arduino but its not arming. Actually it did arm by chance once but never happed again...

If anyone knows anything....please respond!!

Thank you!

Post a link to the datasheet or user manual that describes the arming procedure.

And post the program that tries to emulate the procedure.

...R

At the guess the Arduino is not sending the arming signal for long enough.

But if you share some of the information you wrote down and the program that tries to send the same thing then we would have more chance of working out what you are talking about.

Steve

Here is the code that I am using

#include <Servo.h>
#define LED 13

int X,Y,P,Q;

Servo AIL;
Servo ELE;
Servo THR;
Servo RUD;
Servo AUX;

int recAIL;
int recELE;
int recTHR;
int recRUD;
int recAUX;

void setup() {
Serial.begin(9600);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);

pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);

AIL.attach(9);
ELE.attach(10);
THR.attach(11);
RUD.attach(12);
delay(500);
}

void loop() {

recAIL = pulseIn(3, HIGH, 200000);
recELE = pulseIn(4, HIGH, 200000);
recTHR = pulseIn(5, HIGH, 200000);
recRUD = pulseIn(6, HIGH, 200000);
recAUX = pulseIn(7, HIGH, 200000);

AIL.writeMicroseconds(recAIL);
ELE.writeMicroseconds(recELE);
THR.writeMicroseconds(recTHR);
RUD.writeMicroseconds(recRUD);

Serial.print("AIL: ");
Serial.print(recAIL);
Serial.print('\t');
Serial.print("ELE: ");
Serial.print(recELE);
Serial.print('\t');
Serial.print("THR: ");
Serial.print(recTHR);
Serial.print('\t');
Serial.print("RUD: ");
Serial.print(recRUD);
Serial.print('\t');
Serial.print("AUX: ");
Serial.print(recAUX);
Serial.print('\n');
}

Robin2:
Post a link to the datasheet or user manual that describes the arming procedure.

And post the program that tries to emulate the procedure.

...R

http://ardupilot.org/copter/docs/arming_the_motors.html

The program in Reply #3 seems to be receiving values from an R/C receiver and passing them on to the servos or ESCs.

If that is what you are doing then the timing of the arming sequence is the responsibility of the person with the transmitter? is that what you want?

What values are your Serial.print() statements showing?

You said in your Original Post "I have already tested the quadcopter without the Arduino". And, with that in mind, when I look at the program in Reply #3 I don't understand what you are using the the Arduino for.

...R

I am trying to make it motion controlled. The Arduino will receive the sensor data through the bluetooth and when the transmitter will be on it will receive the data through the transmitter..

Robin2:
The program in Reply #3 seems to be receiving values from an R/C receiver and passing them on to the servos or ESCs.

If that is what you are doing then the timing of the arming sequence is the responsibility of the person with the transmitter? is that what you want?

What values are your Serial.print() statements showing?

You said in your Original Post "I have already tested the quadcopter without the Arduino". And, with that in mind, when I look at the program in Reply #3 I don't understand what you are using the the Arduino for.

...R/Users/saikatdas/Desktop/Screen Shot 2018-02-23 at 8.07.28 PM.png

saikatd005:
I am trying to make it motion controlled. The Arduino will receive the sensor data through the bluetooth and when the transmitter will be on it will receive the data through the transmitter..

Does that mean that you want your Arduino program to be able to arm the flight controller without needing to get data from the R/C receiver?

That can certainly be done, but not with the program in Reply #3. You need code to generate the values for throttle and rudder without data coming from the R/C receiver. Write a short program to do that - just put all the code in setup() and leave loop() empty.

I don't understand the purpose of your Reply #7 as it just seems to (unnecessarily) repeat stuff that I wrote.

...R

Robin2:
Does that mean that you want your Arduino program to be able to arm the flight controller without needing to get data from the R/C receiver?

That can certainly be done, but not with the program in Reply #3. You need code to generate the values for throttle and rudder without data coming from the R/C receiver. Write a short program to do that - just put all the code in setup() and leave loop() empty.

I don't understand the purpose of your Reply #7 as it just seems to (unnecessarily) repeat stuff that I wrote.

...R

But I will be needing the code in reply #3 to control the copter later...

it did arm by chance yesterday and I also controlled the motors with the transmitter, I have been trying since but no luck...

Robin2:
Does that mean that you want your Arduino program to be able to arm the flight controller without needing to get data from the R/C receiver?

That can certainly be done, but not with the program in Reply #3. You need code to generate the values for throttle and rudder without data coming from the R/C receiver. Write a short program to do that - just put all the code in setup() and leave loop() empty.

I don't understand the purpose of your Reply #7 as it just seems to (unnecessarily) repeat stuff that I wrote.

...R

Did you mean something like this??

#include <Servo.h>
#define LED 13

Servo AIL;
Servo ELE;
Servo THR;
Servo RUD;
Servo AUX;

int recAIL;
int recELE;
int recTHR;
int recRUD;
int recAUX;

void setup() {
Serial.begin(9600);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);

pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);

AIL.attach(9);
ELE.attach(10);
THR.attach(11);
RUD.attach(12);
AUX.attach(13);
delay(500);

// Arm flight controller
THR.writeMicroseconds(1105); // MIN Throttle
RUD.writeMicroseconds(1934); // Full Left Rudder
delay(20000); // Wait for the flight controller to recognize the ARM command
RUD.writeMicroseconds(1500); // Return rudder to center position.
}

void loop() {

}

saikatd005:
Did you mean something like this??

Yes.

But you need to consider the safety of your fingers. The purpose of the arming procedure is to ensure your fingers are on the RC control unit and not near the propellers.

Your Arduino code will remove that safeguard. It would probably be a good idea to have some code that asks if you want to arm the 'copter and even says "are you sure?". Or, if you can't display words then maybe you need to hold down two switches for 1 or 2 seconds before the arming code is run.

...R

Its working with the code I wrote previously....

the problem is when I try to arm(send the signal) it with the Arduino for the first time it won't connect(receive the signal). Then I try to connect it without the Arduino its get connected and after that if I again connect with the Arduino its get connected...why is this happening (all the values I can see in the mission planner)

Any idea...

saikatd005:
Its working with the code I wrote previously....

Which code do you mean? The code in Reply#3 or Reply #10?

And when posting code please use the code button </>[/i][/color]

so your code looks like this

and is easy to copy to a text editor See How to use the Forum. It would be a big help if you would edit your earlier Replies and post the code correctly.

the problem is when I try to arm(send the signal) it with the Arduino for the first time it won't connect(receive the signal). Then I try to connect it without the Arduino its get connected and after that if I again connect with the Arduino its get connected.

I can't make sense of that. Please explain it more clearly - especially without using the word "it" which is ambiguous. I am not even sure which program you are referring to or what lines of code within the program.

(all the values I can see in the mission planner)

What do you mean by "mission planner"?

...R

I meant the code in reply#3.
I have solved the arming issue.

Mission Planner is a full-featured ground station application for the ArduPilot APM 2.8(Flight controller I am using).Mission Planner Home — Mission Planner documentation

The problem is the signal values that I am sending via Arduino is not stable its fluctuating a lot. The values can be seen in mission planner.

Things I am using Transmitter----->Receiver----->Arduino----->APM 2.8(Flight controller)---->Escs(Motor)

When I was using without the arduino the signal value were stable.

could you please tell me how to solve this issue.

Thank you..

saikatd005:
The problem is the signal values that I am sending via Arduino is not stable its fluctuating a lot. The values can be seen in mission planner.

Things I am using Transmitter----->Receiver----->Arduino----->APM 2.8(Flight controller)---->Escs(Motor)

When I was using without the arduino the signal value were stable.

You need to post the latest version of your program.

Have you some Serial.print() statements in your program so that you can see the values it is working with?
Can you post a sample of the values together with details of what they should be.

...R

I think you will find arming an esc requires moving throttle from minimum to maximum and back again to minimum.
This was the program sequence I used to build a starter motor for a 150cc engine I built here for a model diesel loco.

bluejets:
I think you will find arming an esc requires moving throttle from minimum to maximum and back again to minimum.
This was the program sequence I used to build a starter motor for a 150cc engine I built here for a model diesel loco.

What you say about arming an ESC may well be true, but the OP is asking about arming an unnamed flight controller on a quadcopter.

Same same ....

bluejets:
Same same ....

No it's not