Gyroscope or Accellerometer for Tilt Sensor on Flying Platform?
Dakota Writer
Posts: 34
Hello, Parallax! (This is my first post).
Okay, so I'm considering building a quad-prop flying unit, similar to the Elev-8. I want to control it with an XBee connection most of the time, but as a safety feature, and to smooth out the flight, I want the quad-prop to auto-level. I think I can do the programming all right, though I might need some help when I get there. (Anyone have sample C code for the gyroscope?) My question is which option I should select for detecting tilt on a moving platform: the parallax gyroscope, or one of three accellerometers (4 directional, two axis, or three axis)? Or a gyroscope and an accellerometer in conjunction?
Thanks in advance. Any advice is appreciated.
Okay, so I'm considering building a quad-prop flying unit, similar to the Elev-8. I want to control it with an XBee connection most of the time, but as a safety feature, and to smooth out the flight, I want the quad-prop to auto-level. I think I can do the programming all right, though I might need some help when I get there. (Anyone have sample C code for the gyroscope?) My question is which option I should select for detecting tilt on a moving platform: the parallax gyroscope, or one of three accellerometers (4 directional, two axis, or three axis)? Or a gyroscope and an accellerometer in conjunction?
Thanks in advance. Any advice is appreciated.
Comments
In post #10 of my index (see signature) I have a bunch of ELEV-8 links. Among the links is a link to Jason Dorie's QuadX code to control a quadcopter with a Propeller.
IF you want to test and play and generally futz with the code to learn how the part works, you moght consider playing interactively with FORTH. One of the propforth guy just put up a bunch of gyro and accelerometer code.
After you you know what the code should look like and how the parts respond, you have a good starting point for the C code.
http://code.google.com/p/propforth/wiki/MPU6050gyroaccel
http://code.google.com/p/propforth/wiki/L3GD20gyro
http://code.google.com/p/propforth/wiki/HMC5883Lcompass
http://code.google.com/p/propforth/wiki/GY80 <- this stuff isn't finished yet
So, it looks like I might be going in over my head. I thought that I read somewhere that a gyroscope was basically a spinning "top" that maintains its axis of rotation as long as it spun. I was hoping to set that axis straight up and down, then just measure deviations from that. Unfortunately, as usual, the truth seems a lot more complicated. Please forgive my ignorance, but what exactly does the model on the parallax website do? Would I use it to measure velocity, acceleration, what?
Also, this is the first time I've heard of FORTH. It that a programming language?
Again, thank you for your replies. And again, sorry that I don't know this stuff already - that's why I'm asking. I know some Java, C++, and PBASIC, but my real interest in robotics started just last September (and as such, I'm rather new to the whole sensor world). I'd love to learn; just trying to lay the groundwork.
I now I wouldn't explain how an electronic gyro works as well as Parallax has. Between the documents provided on the product page, and Learn.Parallax.com, I think this info is pretty well covered. Sorry for the "Read The Fantastic Manual" answer but Parallax's manuals are fantastic and worth the read.
A good place to start learning to make use of a gyro and accelerometer is to make a two wheeled balancing robot. Hanno has a good example of this with his DanceBot.
http://onerobot.org/products/dancebot/
Hanno has a chapter about the DanceBot in this book:
http://www.amazon.com/Programming-Customizing-Multicore-Propeller-Parallax/dp/0071664505
Good. If you already knew everything, it wouldn't be much fun.
Ignorance is to be encouraged, and cured. Gyro is for rotational velocity, accelerometer is for acceleration. (I am just repeating from the datasheet, I don;t actually know either).
Now you've said the secret word. FORTH is the EASY way to do robot stuff. It is an environment and programming language. You can work interactively from the keyboard, very fast development cycles. Also you can run command in litle scripts, really powerful. Lots of little experiments that are easy to do and find errors; (as opposed to a few giant experiements where its impossible to find mistakes). If a silly person like me can write drivers for accellerometer and gyro in FORTH, it MUST be pretty easy. YMMV. After you figure it out in FORTH, it will be MUCH easier to get code working in a traditional programming langague, as you will know what to expect from the parts and that the wires are plugged in correctly.
Give is a whirl, we'll help you as much as we can. The only confusing part is the I2C protocol, and that secret is well established.
It looks like I might be fabricating my own piece, for simplicity's sake (and the budget!). I'm planning a metal ball in a shallow conductive bowl, making resistor connections on the rim when tilted. Using rc_time and an rc circuit, I'll tell which resistor it's contacting. I think that gravity will compensate for acceleration. Big disadvantage, I know, is not knowing how much the craft is tilted; but I don't intend to be trying barrel rolls in this. If it corrects for minor tilts, it should suffice. Use of only a single pin is also an advantage.
When parts arrive, I might start up a new thread to document the development of my quadcopter. Thanks for all your help.
Wish me luck! Happy robot-ing!
I can tell you right now, your metal ball and metal bowl, might be a fun experiment, but it's not going to be very useful in controlling a quadcopter.
There are a lot of inexpensive quadcopters. IMO, it's a good idea to start with one of these and then try to make your own board after you've know the quadcopter can really fly. I've had a lot of fun with one like this one. I added a small Propeller board so I could add additional controls to the quadcopter. My attempt to add an ultrasound sensor didn't work because the motors' noise interfered with the sensor. There's some discussion about this small quadcopter here. There are quadcopters which are even smaller and cost less than this one.
I have additional links to quadcopter threads in post #10 of my index. This includes a link to Jason Dorie's QuadX software he has been working on.
I'd suggest getting the same kind of sensors Jason is using so you can use his code. Once you find out the type of sensor, you can search ebay and probably find an inexpensive source for the sensors.
Good luck but don't just rely on luck. Be smart and learn from other people's experience.
And I believe you about the custom-made tilt sensor... but, just so that I know, what's the big pitfall?
I actually thought about adding a ping sensor to detect low altitude; thanks for the warning!
I'm looking at a pretty small quadcopter - maybe a little over a foot across. Part of why I'm reluctant to spring for an Elev-8 or similar is that the flight unit is pre-programmed. As I'm sure you can understand, the fun for me is as much in the development as the finished product. I can see the logic of getting a unit that already flies, then reprogramming it, though.
Quick question: for a quadcopter, is there any "generic" rule of thumb for the kv and propeller diameter of the motor vs. the total thrust? I know that there are a lot of variables, just looking for a weight guideline.
Your giving great help, thank you! Sorry if I seem reluctant to simplify and let someone else do the work... maybe it's a fault, but it's worked well for me so far.
Usually the price of a sensor is a small part of the cost of using the sensor. The larger cost is time spent learning to use the sensor. You're not going to get anywhere near the support in learning to use a sensor from an ebay vendor as you will from Parallax. The quality of the ebay part isn't going to be anywhere as good as the quality of a part made by Parallax.
I buy a lot of stuff from Parallax but I also buy a lot of stuff off ebay.
Just call it a gut feeling. That and acceleration from gravity and acceleration from changing velocity is indistinguishable (thank general relativity for this). If you make one, make sure and video your efforts to share with the rest of us.
Ultrasound sensors can work on quadcopters. The small motors on the small quadcopter produced an interfering sound. I doubt larger motors would cause the same issue.
There probably are rules of thumb about these things but I don't know them.
I hope you don't mine and smelt your own copper to make your own wire? Unless you like mining and smelting copper that is. Life is short, make sure you're enjoying the process.
Will do! I'll probably try for very slow acceleration, and hope that the 9.81 m/s^2 acceleration of gravity overcomes it. Having never touched a quadcopter before, I'll just be ecstatic if it hovers and inches back and forth at command. No acrobatics necessary, at least not on this first draft.
So, hopefully, Elev-8 motors will be large enough? It just would be nice for the craft to know if it's about to crash...
Yeah, I was thinking about that as I posted it. No I'm comfortable buying components, but I'd like to be in a position where, given the parts, I could replicate the craft. Programming in particular I'd rather not copy, even if it is open-source. In this instance, I'd rather have a minimally capable device that I could honestly claim to have programmed 0, than the new 6-prop version of the Elev-8 that I hadn't built. I guess each person needs to decide what his or her level of acceptance for outside code is for a project, and mine is near-0. That, and I don't know that I'll have time to learn both parallax's gyroscope and its accelerometer before school lets out.
Thank you, sound advice. The process I'm describing, whether or not it succeeds ultimately, sounds like one I'll enjoy; enjoy much more than a more developed kit.
Please, please don't take my response as trying to contradict you - you sound like you've had more experience in this area than me, and I respect that. Still, given the circumstances (which I have not completely communicated on the forum), I think I'll try the homemade part, if only so that I know how it will work without question. If it fails, I can try the parallax parts, plain and simple.