full working code for bluetooth controlled quadcopter

i want to build bluetooth controlled quadcopter by using arduino uno not by using multii wii…the command will send it form mobile app which is connected to copter by using bluetooth…please help me about designing its hardware also schematics…if any one has already made this project please send me …

  1. full working or partially working code
  2. hardware list
  3. pin config or schematics
  4. any thing related to build this project

Hey you forgot to post your address so we could send you the freaking quadcopter that you want to make.

Google is good for this kind of thing.

i am really confused i am working on ymfc free code to make it operating on bluetooth....but i have faced lots of problem while converting rf inputs to bluetooth...help

nickstotle:
....but i have faced lots of problem while converting rf inputs to bluetooth...help

How can you expect anyone to be able to help you when you have not provided a single detail about the specific problems.

...R

this is free library in which they have used 6 channel rf transmitter and receiver…i want to use bluetooth instead of rf tx and rx…so i want to edit this code such that according to my Serial.available it will decide the operation…i am using following method where i receiver char from serial and do operation but due to pwm conversion used in this attachment code i feel difficult to understand which instruction i have to change for controlling…need help

if (Serial.available()>0) // checks if bluetooth connect available

{

value = Serial.read(); //reads variable from bluetooth

}

if (value == ‘char’) // button
{
//condition
}

YMFC-AL_Flight_controller.ino (40.3 KB)

Here is my code…i have add the bluetooth reading process in free quadcopter library by ymfc…i just add code from // Reading input from bluetooth… Check it out…i have mapped the rf transmitter axis ranging from 1000-1500(Center)-2000 to various characters…i haven’t yet tested on actual hardware it please tell me that the code will work properly by verifying it properly…the Main loop will execute properly and the receiver command will work fine by using bluetooth characters…

  // Reading Input from Bluetooth
   if (Serial.available()>0) // checks if bluetooth connect available
  {
    value = Serial.read(); //reads variable from bluetooth
    }
    // Now for  receiver_input_channel_1 Roll Axis
    if (value == 'A')
    {
      receiver_input_channel_1 = 1000;
      --receiver_input_channel_1;
    }
     if (value == 'B')
    {
      receiver_input_channel_1 = 1200;
    }
     if (value == 'C')
    {
      receiver_input_channel_1 = 1350;
    }
     if (value == 'D')
    {
      receiver_input_channel_1 = 1500;
    }
     if (value == 'E')
    {
      receiver_input_channel_1 = 1600;
    }
     if (value == 'F')
    {
      receiver_input_channel_1 = 1850;
    }
     if (value == 'G')
    {
      receiver_input_channel_1 = 2000;
    }
    // Now for  receiver_input_channel_2 Pitch Axis
     if (value == 'H')
    {
      receiver_input_channel_2 = 1000;
      --receiver_input_channel_2;
    }
     if (value == 'I')
    {
      receiver_input_channel_2 = 1200;
    }
     if (value == 'J')
    {
      receiver_input_channel_2 = 1350;
    }
     if (value == 'K')
    {
      receiver_input_channel_2 = 1500;
    }
     if (value == 'L')
    {
      receiver_input_channel_2 = 1600;
    }
     if (value == 'M')
    {
      receiver_input_channel_2 = 1850;
    }
     if (value == 'N')
    {
      receiver_input_channel_2 = 2000;
    }
   // Now for  receiver_input_channel_3 Throttle Axis
     if (value == 'O')
    {
      receiver_input_channel_3 = 1000;
      --receiver_input_channel_3;
    }
     if (value == 'P')
    {
      receiver_input_channel_3 = 1200;
    }
     if (value == 'Q')
    {
      receiver_input_channel_3 = 1350;
    }
     if (value == 'R')
    {
      receiver_input_channel_3 = 1500;
    }
     if (value == 'S')
    {
      receiver_input_channel_3 = 1600;
    }
     if (value == 'T')
    {
      receiver_input_channel_3 = 1850;
    }
     if (value == 'U')
    {
      receiver_input_channel_3 = 2000;
    }
    // Now for  receiver_input_channel_4 Yaw Axis
     if (value == 'V')
    {
      receiver_input_channel_4 = 1000;
      --receiver_input_channel_4;
    }
     if (value == 'W')
    {
      receiver_input_channel_4 = 1200;
    }
     if (value == 'X')
    {
      receiver_input_channel_4 = 1350;
    }
     if (value == 'Y')
    {
      receiver_input_channel_4 = 1500;
    }
     if (value == 'Z')
    {
      receiver_input_channel_4 = 1600;
    }
     if (value == '!')
    {
      receiver_input_channel_4 = 1850;
    }
     if (value == '@')
    {
      receiver_input_channel_4 = 2000;
    }
  //Wait until the receiver is active and the throtle is set to the lower position.
  while(receiver_input_channel_3 < 990 || receiver_input_channel_3 > 1020 || receiver_input_channel_4 < 1400){
    receiver_input_channel_3 = convert_receiver_channel(3);                 //Convert the actual receiver signals for throttle to the standard 1000 - 2000us
    receiver_input_channel_4 = convert_receiver_channel(4);                 //Convert the actual receiver signals for yaw to the standard 1000 - 2000us
    start ++;                                                               //While waiting increment start whith every loop.
    //We don't want the esc's to be beeping annoyingly. So let's give them a 1000us puls while waiting for the receiver inputs.
    PORTD |= B11110000;                                                     //Set digital poort 4, 5, 6 and 7 high.
    delayMicroseconds(1000);                                                //Wait 1000us.
    PORTD &= B00001111;                                                     //Set digital poort 4, 5, 6 and 7 low.
    delay(3);                                                               //Wait 3 milliseconds before the next loop.
    if(start == 125){                                                       //Every 125 loops (500ms).
      digitalWrite(12, !digitalRead(12));                                   //Change the led status.
      start = 0;                                                            //Start again at 0.
    }
  }
  start = 0;                                                                //Set start back to 0.

BT_Flight_controller.ino (42.8 KB)

What sort of experience flying RC stuff do you have ?

Regardless of whether the code will 'work' will you be able to control the copter ?

My experience of copters is limited, but I have a fair bit of experience flying RC planes, gliders and electric.

Your code assumes you will be able to control the copter with only 6 possible values\positions for each RC channel, do you know if this will actually work, has anyone else even tried to make it work ?

nickstotle:
i haven’t yet tested on actual hardware it please tell me that the code will work properly by verifying it properly…

There may be two or three people on the planet who are capable of studying code and “knowing” that it will work properly.

But I am not one of them and I am not aware that any of them reads this Forum.

Code needs to be tested in circumstances where the inevitable errors do not cause injury to anyone or more expensive damage to property than you can afford.

…R

I think that by the time you have looked up the command that you need on your crib sheet, and then found the right key on your keyboard, then it will be too late.

guyz i am going to make axis by using seekbar…and going to maap this each letter on various points on axis…suppose one channel 1 axis the seekbar will range from 1000-2000 and it has 7 fixed position refer to 7 values…just like joystick i am going to make the controller…below is two axis for two channels one is horizontal other is vertical

|H
|I
|J
A_B_ C_D(K)__E__F__G
|L
|M
|N

just like that my my two seekbars well send the following character by selecting appropriate point…so it will get easy for me to send this characters…i am using mapping only…so i don’t have to worry about finding letters from keyboard…just please tell me that code will work or not…and the

//Reading input from Bluetooth
if (Serial.available()>0) // checks if bluetooth connect available
{
value = Serial.read(); //reads variable from bluetooth
}
// Now for receiver_input_channel_1 Roll Axis
if (value == ‘A’)
{

should be placed in void setup or void loop???
i m confused because in Void setup they need receiver channel 3 and 4 input to initiate it at lowest possible point as below…so need assistance where should i put my bluetooth commands?
@robin2 @srnet @ johnlinkon guyz please help me…

//Wait until the receiver is active and the throtle is set to the lower position
 while(receiver_input_channel_3 < 990 || receiver_input_channel_3 > 1020 || receiver_input_channel_4 < 1400){
    receiver_input_channel_3 = convert_receiver_channel(3);                 //Convert the actual receiver signals for throttle to the standard 1000 - 2000us
    receiver_input_channel_4 = convert_receiver_channel(4);                 //Convert the actual receiver signals for yaw to the standard 1000 - 2000us
    start ++;                                                               //While waiting increment start whith every loop.

    //We don't want the esc's to be beeping annoyingly. So let's give them a 1000us puls while waiting for the receiver inputs.
    PORTD |= B11110000;                                                     //Set digital poort 4, 5, 6 and 7 high.
    delayMicroseconds(1000);                                                //Wait 1000us.
    PORTD &= B00001111;                                                     //Set digital poort 4, 5, 6 and 7 low.
    delay(3);                                                               //Wait 3 milliseconds before the next loop.
    if(start == 125){                                                       //Every 125 loops (500ms).
      digitalWrite(12, !digitalRead(12));                                   //Change the led status.
      start = 0;                                                            //Start again at 0.
    }
  }

I don't understand the relationship between your proposed control system and the quadcopter.

If the 'copter is automatically stable without any control inputs and if your inputs are only for the purpose of telling it the direction to move what you are proposing may be adequate.

On the other hand if your system is intended to control the stability of the 'copter I think it will be totally inadequate.

...R

nickstotle:
…just please tell me that code will work or not…

@robin2 @srnet @ johnlinkon guyz please help me…

If you want free advice, it would be a good idea to answer some of the questions you have have asked.

Are you actually going to be building this, or is it some form of work\study project ?

And I suggest you read post #8 again.

Hi,
What hardware have you got or aim on getting?
What model Arduino?
What gyro do you need for the program?
What ESCs are you going to use?
What battery are you going to use?
What prop size are you going to use?
Do you have any assembly instructions for the copter used with the code you are trying to modify?

Tom... :slight_smile:

@tom
Arduino Uno R3
BLDC Motors 1000KV
Propeller 10”x4.5”
ESC 30A (Electronic speed controllers)
Battery 3300 mAH 3S 30C
Battery Charger
Chasis (F450)
Landing Gear
Gyroscope Module 3- Axis L3G4200D or MPU 6050
Bluetooth Module HC-05
Temperature Sensor LM35
Dean Connectors Pair to make power distribution board.

Guyz I am using free library made by YMFC :Brokking.net - Project YMFC-AL - The Arduino auto-level quadcopter - Home.
This drone has auto level facility...
@srnet
What sort of experience flying RC stuff do you have ? --i have experience of flying rf based quadcopter.

Regardless of whether the code will 'work' will you be able to control the copter ? -- thats what am saying while using RF transmitter it has 4 channel working all at a time (simultaneously all channels are active) but when i am mapping it through bluetooth at it works serially so i have only one channel to communicate instead of 4. Here i am bit confused that it will not fluctuate while adjusting yaw pitch throttle roll....while turning the drone it may give very much problem cause simultaneously i cant transmit PITCH and ROLL data..instead of which i will first turn the pitch low and then roll the quadcopter towards turn and then increase the throttle...

My experience of copters is limited, but I have a fair bit of experience flying RC planes, gliders and electric. --yeah my experience in coding is not much as yours..many of makes laugh at me..

Your code assumes you will be able to control the copter with only 6 possible values\positions for each RC channel, do you know if this will actually work, has anyone else even tried to make it work ? ---No one ever tries to map the axis of but i am figuring out if it works or not....i know to very the speed of motor we use 1000-2000us pulse but i am using only 6 possible values... that i dont know work fine with code...but by looking at code i have decided that values.

@robin2

the library or original source code tells that the system has function to auto level and having sustained flight and control mechanism but by observing the code i haven't see any of it i am figuring out for part which is there in code that sustains or maintaining the stabilty so that i can implement hover function in my quadroter....i think it has auto level and stability control i haven't tried yet...

@all
can the code will take the inputs 6x4 channels=24 input and performs the job...main question is where should i put my bluetooth read function in void setup or void loop see post #10...

main question is where should i put my bluetooth read function in void setup or void loop

In the loop() function. setup() is executed only once upon startup.

nickstotle:
@robin2

the library or original source code tells that the system has function to auto level and having sustained flight and control mechanism but by observing the code i haven't see any of it i am figuring out for part which is there in code that sustains or maintaining the stabilty so that i can implement hover function in my quadroter....i think it has auto level and stability control i haven't tried yet...

@all
can the code will take the inputs 6x4 channels=24 input and performs the job...main question is where should i put my bluetooth read function in void setup or void loop see post #10...

I don't mean to sound unkind but I can't help feeling you are trying to run before you have learned to crawl, never mind walk.

The last question I have quoted makes no sense if you know anything about programming. The setup() function only runs once so it is unthinkable that you would only read the Bluetooth data there.

A quadcopter is an extraordinarily complex device. You can't just tamper with the code (which you seem not even to have tested before you start tampering) in the same way that you can re-order the bricks in a Lego set.

...R

If the OP ever gets anything working, people will probably want to shoot it down.

Here are several interesting ways to do that.

nickstotle:
i think it has auto level and stability control i haven't tried yet...

Then its a complete waste of everyones time trying to write the software until you know this for sure.

Would have been a good idea to mention this in post #1.

Most copters do have thier own controllers that have the stability control built in, but your the one that need to check.