Quadrocopter robot

Discussion in 'Custom Programming' started by plafki, May 11, 2015.

  1. plafki

    plafki Member

    Hi!

    I am building my own quadrocopter from scratch but it will not be only a quadrocopter. I am trying to make it my baby (hah jk) I mean it will be a droid/bot, I want it to be able to do some IT side also.

    Problems:
    1) What kind of coding/application/environment for developing quadrocopter navigation system through a software (e.g. googlemaps)
    2) Is there self-adjusting/non-crashing automation for quadrocopters?

    Please feel free to answer any kind of link/website/shop/ whatever comes to your mind that could help me further :)

    I need the battery to last 1 hour, so Which parts/DIY kits/websites you guys recommend for shopping for such strong/massive vehicle ? (probably to carry such big battery, the vehicle alone should be able to carry extra 1kg)

    and you guys happen to know how big such battery should be ?

    I heard this works for 10 minutes (for 500 gram vehicle), so I guess 10 times stronger battery?
    What kind of Ah and V would be optimal?
    3.7V 600mAh 25C Lipo Battery
     
    Last edited: May 17, 2015
  2. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator

    One hour battery life is possible, but it is not easy, and is costly. One problem you run into by getting a bigger capasity battery is that it weighs more, and so a 1500mah battery may give you the same battery life as a 3000 on smaller mutirotors. You can get better battery lifes by moving to Li-Ion, because they can be drained more. The best way to get a long battery life is to use bigger props and a bigger battery, I don't know if you will get an hour of flight like that though.

    What type of programming experience do you have?
    What type of budget do you have?

    For the battery if you are able to do a really big build this is about hte size you'd use.
     
  3. Nick

    Nick About to throw an arduino..*cough*F450 Master Race

    A good way to start coding you quadcopter/droid/terminator/skynet would probably be with an Arduino. It's a microcontroller that you can buy in many shapes and sizes. It is coded in c# and you can use the free Arduino IDE to upload you "sketches" to the board. A multirotor friendly version of the Arduino would be the Ardupilot which comes with a gyro/acc build in and headers to attach you battery, receiver, ESC's for the motors and other things like a GPS to it. Good luck to You!
     
  4. plafki

    plafki Member

    Thank you for your reply!
    If you have any indications on places to order batteries please let me know.

    Shaping/Placing of battery could be critical, since its a robotic aircraft, should I get smaller batteries or solve it otherwise?
    Is LI-Ion most efficient battery available for customer usage?

    >The best way to get a long battery life is to use bigger props and a bigger battery

    Just a guess, but if battery would weight 5 kg the machine itself to 'carry it with keeping the balance' (quadcopter) is achieved with what energy formulas in such robotics/project? (force output + machine weight - will require some testing though?)

    Thank you for your reply!
    Adruino seems like very customizable platform, I need to find some tools about the googlemaps navigation, 'protection for aircraft' coordination (specifically for quadcopter).

    >The Ardupilot which comes with a gyro/acc build in and headers to attach you battery, receiver, ESC's for the motors and other things like a GPS to it.

    Do you recommend any parts particularly? How big aircraft should be to carry a 5kg battery?
    Can you share some links about arduino, for example a great guide for quadcopter and places to buy parts cheap?
     
  5. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator

    I'd suggest you get your stuff off from hobbyking, they have cheaper prices and a big selection of things. The only problem is the shipping and customer service.

    I found some motors here, they are expensive, but should higher voltages will allow you to have lower amp draw. Theoretically it should allow you to have longer amp draws.

    I don't have any formulas/equations to give you, but this will be a great resource, the flight time estimates are a little conservative though, but you can test different ideas.
     
  6. Nick

    Nick About to throw an arduino..*cough*F450 Master Race

    As for the Arduino code, you'll find there aren't many good tutorials. But what you do have is the access to the source code to other people's Arduino quadcopters. There is Arducopter, Bluecopter and of course Multiwii that you can look at.

    There is also source code for computing the gyro/acc input on the Arduino playground. The motors will be powered with PWM so you need to look at how to use the servo.h library on Arduino.

    I had the same ambitions as you but it turned out to be a LOT harder than I thought. What I personally ended up doing is buying the newest kk board flight controller to handle the quad stabilization and then use an arduino as a middle man in between the rx and the kk board.

    This way, you don't have to worry about coding the stabilization code (the hardest part) and you can focus on you autonomous flight, rocket launcher, robot arms and google maps with the Arduino.

    Let the kk board do the heavy lifting :)

    EDIT: And I'll be happy to say that with this setup with the Arduino and KK board working together, MY QUADCOPTER FLEW FOR THE FIRST TIME TODAY. If you're interested in doing what I did, I'll be happy to email you my source code. My code will be different from what you need because I use a modded Xbox controller with custom coding for my tx/rx ( also done with an Arduino ) but it's a good start.
     
  7. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator


    I thought the motors/props did all the lifting! Haha, but seriously using the Arduino as a middle man wil lbe a LOT easier, as the people who developed most commercial boards had a small team of experienced programmers and a more time than most would want to spend.
     
  8. Nick

    Nick About to throw an arduino..*cough*F450 Master Race

    So unless you have a team of highly trained coder monkeys under your bed, save yourself months of trouble ( by personal experience ) and get an Arduino along with a kk board.
     
  9. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator

    Don't forget the physicist monkey! Doing it this way will allow your device move to about any hobby grade quadcopter, whether it be a KK, Naza, or something even nicer, you are just processing the user's input with some of your own. This allows for a lot of cool things.
     
  10. Nick

    Nick About to throw an arduino..*cough*F450 Master Race

    With having the Arduino intercept the rx data you can then edit it with you sensor detection and what not before you send the final output to the kk board. I plan to mound 4 ultrasonic sensors to my quad to detect close objects and avoid them.
     
  11. plafki

    plafki Member

    Thank you for your reply!
    You gave out a lot of valuable information. I have quite experienced coders with me so coding wont be an issue. Though if stabilization has been hardest and most time wasting part, I will heavily consider KK board. Can I get some plus/minuses on it? Why KK board? Just for the ready stabilization coding in it?
    I searched for a while for information about KK board and learned only that its just a circuit board for calibrating the quadcopter and connect the controller am I right?

    My point is though building a droid so it will be mostly custom code and circuits, I am atm deciding which parts will I need for the quadcopter. Because weighting battery might be and issue, I might be better of 3d printing most of the parts to get them exactly the size I need. Circuit boards are still an open issue though. Just arduino/ardupilot or maybe some stabilizer like kk board. I guess ardupilot supports super sonics for obstacle evasion system.


    Gratz on the first flight time bro!

    This has been the most helpful board ever.



    Thank you for your reply!
    This was exactly what I needed, the place to order is certainly hobbyking and multicopter calculator table will come handy. I will have to calculate the lifting power needed, but If you could point out the powerful quadcopter buylist (motor, propellers, cooling) it would speed up a lot my process and get me the idea what I should be aiming for.

    I am also spending quite much on this so there is no budgets.
     
    Last edited: May 19, 2015
  12. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator

    The KK board was chose because it is field adjustable (no laptop required) and it was cheap. Not much is needed as it was just going to be handling stabilization. However for your project something like Ardupiloet or CC3D may be better (if you'd prefer to integrate the stabilization with the board you'd be making). Depends how you want to do things. If you choose to have the stabilization board 100% separate from your control board you will be working on then it does not really matter what controller you use, and you can swich/upgrade stabilizers if you wanted to in the future (best option IMHO). Or you could integrate the board for stabilization with your board, but you'd have to stick with that board.
     
  13. Nick

    Nick About to throw an arduino..*cough*F450 Master Race

    So the current code that I am using is for an Arduino based transmitter and receiver and then the receiver being connected to the kk board.

    The "map" functions at the joystick array is where you adjust the limits of your pots on your controller.

    If you have your own hobby rx/tx then you only need the Receiver.ino and modify it to read the hobby rx module. Here is an article to do that ( I used ideas from this code from this post for my own Arduino code )

    EDIT: I also wrote a failsafe (that works kinda good) that if the transmitter loses signal for more than one second, all receiver channels set to 0 ( throttle included).

    Transmitter.ino
    Code:
    #include <SPI.h>
    #include <nRF24L01.h>
    #include <RF24.h>
    
    #define CE_PIN 9
    #define CSN_PIN 10
    
    #define ROLL A3
    #define PITCH A2
    #define YAW A1
    #define THROTTLE A0
    
    const uint64_t pipe = 0xE8E8F0F0E1LL;
    RF24 radio(CE_PIN, CSN_PIN);
    int joystick[4];
    
    void setup()
    {
      Serial.begin(9600);
      radio.begin();
      radio.openWritingPipe(pipe);
    }
    
    void loop()
    {
      joystick[0] = analogRead(ROLL);
      joystick[1] = analogRead(PITCH);
      joystick[2] = analogRead(THROTTLE);
      joystick[3] = analogRead(YAW);
    
      joystick[0] = map(joystick[0],572,155,950,1910);
      joystick[1] = map(joystick[1],129,578,1940,1010);
      joystick[2] = map(joystick[2],373,123,1110,1940);
      joystick[3] = map(joystick[3],117,562,1950,1090);
    
      joystick[0] = constrain(joystick[0],1090,1910);
      joystick[1] = constrain(joystick[1],1090,1910);
      joystick[2] = constrain(joystick[2],1150,1940);
      joystick[3] = constrain(joystick[3],1090,1910);
    
      boolean rad = radio.write( joystick, sizeof(joystick) );
    
      Serial.print(rad);
      Serial.print("Roll:   ");
      Serial.print(joystick[0]);
      Serial.print("\tPitch:   ");
      Serial.print(joystick[1]);
      Serial.print("\tYaw:   ");
      Serial.print(joystick[3]);
      Serial.print("\tThrottle:   ");
      Serial.println(joystick[2]);
    }

    Receiver.ino
    Code:
    #include <SPI.h>
    #include <nRF24L01.h>
    #include <RF24.h>
    #include <Servo.h>
    #define CE_PIN 4
    #define CSN_PIN 8
    
    Servo roll, pitch, throttle, yaw;
    
    
    const uint64_t pipe = 0xE8E8F0F0E1LL;
    RF24 radio(CE_PIN, CSN_PIN);
    int joystick[4];
    boolean ifNoConnection = true;
    unsigned long lostConnection = 0;
    boolean disable = false;
    
    void setup()
    {
      Serial.begin(9600);
      delay(1000);
      radio.begin();
      radio.openReadingPipe(1,pipe);
      radio.startListening();
    
      roll.attach(5);
      pitch.attach(10);
      throttle.attach(9);
      yaw.attach(6);
    }
    
    void loop()
    {
      if ( radio.available() )
      {
        boolean done = false;
        while (!done)
        {
          done = radio.read( joystick, sizeof(joystick) );
        }
        ifNoConnection = true;
      }
      else
      { 
        if(ifNoConnection)
        {
          ifNoConnection = false;
          lostConnection = millis();
        }
        if((millis() - lostConnection) > 1000){
          disable = true;
        }
      }
    
      if (joystick[0] > 1440 && joystick[0] < 1550){
       joystick[0] = 1430;
      }
      if (joystick[1] > 1460 && joystick[1] < 1560){
       joystick[1] = 1475;
      }
      if (joystick[2] < 1270){
       joystick[2] = 1150;
      }
      if (joystick[3] > 1470 && joystick[3] < 1550){
       joystick[3] = 1520;
      }
    
      if(disable){
        joystick[0] = 0;
        joystick[1] = 0;
        joystick[2] = 0;
        joystick[3] = 0;
      }
    
      roll.writeMicroseconds(joystick[0]);
      pitch.writeMicroseconds(joystick[1]);
      throttle.writeMicroseconds(joystick[2]);
      yaw.writeMicroseconds(joystick[3]);
    
      Serial.print("Roll: ");
      Serial.print(joystick[0]);
      Serial.print("\tPitch: ");
      Serial.print(joystick[1]);
      Serial.print("\tYaw: ");
      Serial.print(joystick[3]);
      Serial.print("\tThrottle: ");
      Serial.println(joystick[2]);
    }
     
  14. GJH105775

    GJH105775 Avid Linux User, and U.S. Air Force 1C6 Moderator

    The Rx/Tx combo should have a failsafe built in.
     
  15. Nick

    Nick About to throw an arduino..*cough*F450 Master Race

    Yes if you go the route of buying you own hobby rx/tx it should have a failsafe and you wouldn't need the one coded in the Arduino.
     

Share This Page