Zeeshan
Published

Quadcopter 0.0

This quadcopter is intended to learn basics of electronics and aerodynamics. I planned to develop and code every function by myself.

AdvancedWork in progress30 days2,189
Quadcopter 0.0

Things used in this project

Hardware components

Arduino MKR1000
Arduino MKR1000
×1
GY-521 MPU-6050 3 Axis Gyroscope + Accelerometer Module For Arduino
×1
ESC
×1
Motors
×1
Quadcopter Frame
×1

Software apps and online services

Android 6.0
Arduino IDE
Arduino IDE
Android Studio
Android Studio

Story

Read more

Code

Android App

Java
This is a basic android app to ascend and descend the phase-1 quad
No preview (download only).

Arduino Code

C/C++
This is basic code to lift off the Quad
#include <Servo.h>
#include <SPI.h>
#include <WiFi101.h>
#include <Wire.h>


char ssid[] = "QuadCop";
WiFiServer server(1979);

int temp_data;
int temp_data1, new_data2, new_data3, new_data4;
int data_old1, data_old2, data_old3, data_old4;

int new_data,data_old, throt,throt1;
Servo esc1,esc2,esc3,esc4;

void setup() {
  if (WiFi.status() == WL_NO_SHIELD) {
    while (true);
  }
  if (WiFi.beginAP(ssid) != WL_CONNECTED) {
    while (true);
  }
  delay(5000);
  server.begin();

  esc1.attach(2);
  esc2.attach(3);
  esc3.attach(4);
  esc4.attach(5);
  throt=20;
  wr_data1(throt);
  throt = map(throt, 0, 100, 20, 180);
  esc1.write(throt);
  esc2.write(throt);
  esc3.write(throt);
  esc4.write(throt);
}

void loop() {
  throt=rd_data1();
  WiFiClient client = server.available();
  if (WiFi.RSSI() >= -60){  //WiFi is connected or within range
    if (client) {           //server ready
      if (client.connected()) {   //client connected
       if (client.available()) {  //client sent data
          wr_data1(client.read());
       }
       quad_under_control();
      }
      else {
        quad_out_control();
      }
    }
    else if (!client){    //server not ready
      quad_under_control();
      //client.stop();
    }
  }
  else if (WiFi.RSSI() <= -60){   //WiFi is disconnected or out of range
    quad_out_control();
    client.stop();
    server.begin();
  }
}

void quad_under_control(){
    throt=rd_data1();
    throt = map(throt, 0, 100, 20, 180);
    esc1.write(throt);
    esc2.write(throt);
    esc3.write(throt);
    esc4.write(throt);
}

void quad_out_control(){
    throt=15;
    throt = map(throt, 0, 100, 20, 180);
    esc1.write(throt);
    esc2.write(throt);
    esc3.write(throt);
    esc4.write(throt);
}
void wr_data1(int data){
  temp_data=data;  
}

int rd_data1(){
  return temp_data;
}

Credits

Zeeshan

Zeeshan

13 projects • 50 followers
Creative and destructive design master. Ability to use the brain waves for both construction and destruction

Comments