Autonomous quadcopter tracking and finding signal strenths from cellphone

hey everyone,

I am currently working on a school project using a quadcopter, having an APM2.6 flight controller and turnigy 9x rc and receiver. It has to fly autonomously capturing signal strengths coming from a cellphone.

I am thinking about using an arduino mega to connect it to the APM. Any better advice on how to approach this project? I could also only use the arduino mega and try to attach a cellphone. But I am still working on those ideas.

I intent to use this code for the autonomous functionality:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

#include <PID_v1.h>
#include <NewPing.h>
#include <Servo.h>
Servo aleo,eleo,thro;
double Setpoint,Input1,Output1,Input2,Output2,Input3,Output3,Input4,Output4,Input5,Output5;
NewPing s1(A0,A1,200),s2(A2,A3,200),s3(A4,A5,200),s4(2,3,200),s5(4,5,200);
#define Kp 2
#define Ki 5
#define Kd 1
PID leftPID(&Input1, &Output1, &Setpoint,Kp,Ki,Kd, DIRECT);
PID rightPID(&Input2, &Output2, &Setpoint,Kp,Ki,Kd, DIRECT);
PID frontPID(&Input3, &Output3, &Setpoint,Kp,Ki,Kd, DIRECT);
PID backPID(&Input4, &Output4, &Setpoint,Kp,Ki,Kd, DIRECT);
PID altPID(&Input5, &Output5, &Setpoint,Kp,Ki,Kd, DIRECT);
int left,right,front,back,ale,ele,op1,op2,op3,op4,thr,aux1,aux2,x,y,z;
void setup()
{
Input1=s1.ping_cm();
Input2=s2.ping_cm();
Input3=s3.ping_cm();
Input4=s4.ping_cm();
Input5=s5.ping_cm();
Setpoint=50;
leftPID.SetOutputLimits(0, 300);
rightPID.SetOutputLimits(0, 300);
frontPID.SetOutputLimits(0, 300);
backPID.SetOutputLimits(0, 300);
altPID.SetOutputLimits(1000, 2000);
leftPID.SetMode(AUTOMATIC);
rightPID.SetMode(AUTOMATIC);
frontPID.SetMode(AUTOMATIC);
backPID.SetMode(AUTOMATIC);
altPID.SetMode(AUTOMATIC);
aleo.attach(11);
eleo.attach(12);
thro.attach(13);
Serial.begin(115200);
Serial.println(“initializing…”);
}
void loop()
{
x=pulseIn(6,HIGH,20000);
y=pulseIn(7,HIGH,20000);
z=pulseIn(8,HIGH,20000);
aux1=pulseIn(9,HIGH,20000);
aux2=pulseIn(10,HIGH,20000);
if((aux1<=1500)&&(aux2<=1500))
{
aleo.writeMicroseconds(x);
eleo.writeMicroseconds(y);
thro.writeMicroseconds(z);
}
if(aux1>1500)
{
Input1=s1.ping_cm();
Serial.print(“Sonar1 =”);
Serial.println(Input1);
Input2=s2.ping_cm();
Serial.print(“Sonar2 =”);
Serial.println(Input2);
Input3=s3.ping_cm();
Serial.print(“Sonar3 =”);
Serial.println(Input3);
Input4=s4.ping_cm();
Serial.print(“Sonar4 =”);
Serial.println(Input4);
leftPID.Compute();
rightPID.Compute();
frontPID.Compute();
backPID.Compute();
ale=1500+Output1-Output2;
ele=1500+Output3-Output4;
aleo.writeMicroseconds(ale);
eleo.writeMicroseconds(ele);
Serial.print(“Aileron =”);
Serial.println(ale);
Serial.print(“Elevator =”);
Serial.println(ele);
}
if(aux2>1500)
{
Input5=s5.ping_cm();
Serial.print(“Sonar5 =”);
Serial.println(Input5);
altPID.Compute();
thr=Output5;
thro.writeMicroseconds(thr);
Serial.print(“Throttle =”);
Serial.println(thr);
}

}

How can I integrate this code with the signal tracking?

Thanks everyone for your time to provide me your feedbacks about this project.