Go Down

Topic: Arduino Quadcoptor using XBEE radio modules (Read 164 times) previous topic - next topic

tarkesh2shar

Nov 08, 2015, 04:05 pm Last Edit: Nov 08, 2015, 05:03 pm by tarkesh2shar
Hello world ,My name is Tarkesh ,i am currently working on a Quadcoptor ,the micro controller i am using is Arduino UNO,with 2Xbee radio modules,one xbee is set to a router and another a coordinator i am using router as a transmittor ( controlling device) via laptop(xctu software) or a remote made of/from arduino ,and coordinator as a reciever ,i am nearly towards the end of my project ,but sadly i am stuck in a problem ,
I want my quad to fly as steady  as possible ,for that i used MPU6050 GY521 ,which has an accelerometer and gyro sensor ,I have been successful in getting normalized values from mpu6050 libraries ,and i have quiet an idea of how to work with  arduino PID library,The only problem is my quad doesnt seem to work fast enough or to say work at all , i am using the PID as  shown in the pic,i attached(in my code i was trying to stabilize pitch ,taking 2 PID loops one for angle and other for angular rate)
And in order to drive my quadcoptor to various direction i will just change  the setpoint for pitch and roll,
this can be done in same way as sending command from xbee ,or sending Alphanumeric string where we can parse the integer for values ,and parse character such as 'F' for foward .

Sorry for modification just wanted to talk about remote i made -- so basically my remote is made of arduino UNO ,xbee ,and adxl 345 accelerometer and some push buttons , all stucked in a breadboard ,so i can control my quadcoptor by rotating the breadboard ,just like the one in mobile ,used to play games,i have attached the file  for you guys.

Guys please look at my code below any help will be appreciated thnks

DuaneDegn

I think controlling a quadcopter with a microcontroller is not an easy task.

Do you have to write the program from scratch? What about using one of the already working quadcopter control programs?

Have you used the I2Cdevlib version of a MPU6050 driver? I was very impressed with the software.

I'd let the I2Cdevlib do the work of integrating gyro feedback and filtering and use feedback from the driver to control the quadcopter motors.

I think you want to be able to have the quad hover on its own before attempting to control it with button presses.

I have a bunch of quadcopters and I think they're a challenge to fly. They're hard enough to fly with a nice remote, trying to fly them with push buttons seems like a very daunting task unless the quad can hover on its own.

I've used the accelerometer (and joystick) in a Wii Nunchuk to fly a RC helicopter and while an accelerometer is better than buttons, I think you need to start with a very stable quadcopter if you plan to use an accelerometer as a controller.

I just looked at your "remote" code. I think there are things you should change. There's a half second delay after each serial command. This seems strange to me.

I think it would nearly impossible to fly a quadcopter with half a second between each control input. I notice the accelerometer control is acting the same as a button press. There's no proportional control.

When I used the Nunchuk's accelerometer to control the yaw and pitch of a helicopter I scaled the acceleration values to mimic commands from a joystick. I think to have a chance of controlling the quadcopter with an accelerometer you need to send proportional data. This means the quad copter code will need to parse out this numeric data.

I see you're parsing single characters but I don't see any parsing of numeric data.

It's possible single character control you're using now may be possible but I think for this to work you'd need a quadcopter capable of hovering in place without input. And while such control may be possible, I don't think it would be much fun to fly.

I think you should change the baud of the XBees to 115200. Hopefully this will speed up the control loop.

I really think you need to look at some other quadcopter code.

Have you flown a working quadcopter? Do you know what it's like to control one? I think it would be very helpful if you knew how quadcopters respond to inputs. I think you'll find proportional inputs very important.

I don't understand the other aspects of quadcopter control enough to comment on it.




tarkesh2shar

wow lot of question  ;)
no i have no experience  of flying  a quad coptor , yes all the code i wrote was written  by me from scratch  took me a quiet  long time ,i have gone  through  the DMP programme in i2c  dev ,but i  wanted my program  to be as  short as possible  ,so i took on my own ,and besides i couldnt find any article on Xbee quadcoptor ,except one in youtube where this guys uses xbee to communicate  with mobile device ,so i know.its possible.
 
Anyways about self hovering  ,can you tell whats wrong  with my  main code ,
when i uploaded the code for a fixed throttle value ,and when i tilt it to one axis  say pitch to some.degree it should oppose me but  ,the motors doesnt seem to work out , i dont have a clue where i am wrong  ,i suspect my PId loop is taking a very long time to process, and am i getting  the right idea of pid process as shown in the picture ??

DuaneDegn

wow lot of question  ;)
no i have no experience  of flying  a quad coptor , yes all the code i wrote was written  by me from scratch  took me a quiet  long time ,i have gone  through  the DMP programme in i2c  dev ,but i  wanted my program  to be as  short as possible  ,so i took on my own ,and besides i couldnt find any article on Xbee quadcoptor ,except one in youtube where this guys uses xbee to communicate  with mobile device ,so i know.its possible.
 
Anyways about self hovering  ,can you tell whats wrong  with my  main code ,
when i uploaded the code for a fixed throttle value ,and when i tilt it to one axis  say pitch to some.degree it should oppose me but  ,the motors doesnt seem to work out , i dont have a clue where i am wrong  ,i suspect my PId loop is taking a very long time to process, and am i getting  the right idea of pid process as shown in the picture ??
I'm sure it's possible to fly a quadcopter using XBee radios. A friend of mine, Paul Krasinski, used one of his cool Q2 remotes he designed to control a quadcopter. The Q2 (and Q4) uses a XBee as the radio.

The joysticks' positions are sent to the quadcopter which allows proportional control of the quadcopter.

I don't think it would be possible to fly most quadcopters with just buttons as input. I think it would be impossible to fly most quadcopters with button input and half a second delay between each instruction sent to the quadcopter.

It looks like you are only using the gyro information from your sensor. It's possible to control a quadcopter with gyro only info but it requires active control from the user. The quadcopter will not be able to hold a stable hover without input from the user unless accelerometer data is also used in the control algorithm.

I think it's nearly impossible to control a gyro only quadcopter using button input.

I think you either need to add a way of adding low latency proportional input or you need to use a control algorithm which includes accelerometer data combined with the gyro data.

You can purchase quadcopters for as little as $14 on ebay. I have a couple little $14 quads which are a lot of fun. I think using one of these quads would convince you of the need for proportional control. Throttle control is particular difficult when flying a quad. You can't just using push buttons to control a quad.

I have not used PID with an Arduino. I don't have any suggestions on what you should change.

tarkesh2shar

Wow those Q2 remotes are awesome ,so i think i will upgrade my remote controller now ,i have an idea ,i will map the angle in pitch and roll to 10steps ,according  to these steps my quad could fly in any direction  with 10 different  speed modes ,i understood  what you were saying earlier  ,
everything  having said i am still stuck with the hovering problem.my quadcoptor doesnt resist  the change in angle  ,so i think i will go on for earlier  versions  of pid library  or even make my own ,
Thnks for the idea man ,now i know this project  can be done so i will continue  on ,besides  there is fun in making  your own code  ;) :)

DuaneDegn

I think it would horribly difficult to fly a quadcopter with 10 steps of input in each direction.

I'm sure when my friend used XBees they were not communicating at 9600bps. I believe he used 115200bps.

You need to incorporate the accelerometer of the MPU6050 to get a quadcopter to hover in level flight.

tarkesh2shar

#6
Nov 10, 2015, 09:17 pm Last Edit: Nov 10, 2015, 09:33 pm by tarkesh2shar
hey DuaneDegn  after a long day of coding i finally figured  out how to get the values from i2c dev and DMP unit , :) here is the attachment,i did figured out the way to control my quad ,but first i need to stabilize it ,  ... the next attachments  is my trial to balance  the pitch axis using this library ,unfortunately  there is a bug somewhere my motors wont even start ,anyways guys please give your views

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy