Shop OBEX P1 Docs P2 Docs Learn Events
Which accelerometer I should use? — Parallax Forums

Which accelerometer I should use?

Henry ChanHenry Chan Posts: 5
edited 2006-11-08 14:14 in BASIC Stamp
Hi,
I've started my project on development an UAV. Now I want to balance the pitch(nose up and down) and roll movement of my plane. To my understanding, I need to use 2-axis gyro to perform this action. Unfortunately most of them are rated at 3.3V and output the analogue signal. As I'm a newbie to electronics I want a simpler device to perform this action, that is, a 5V input with PWM output for my BS2.

After I saw the documentation of the 2 axis accelerometer from Parallax(Memsic 2125 Dual-axis Accelerometer), I found that by some simple calculation it can convert to a single axis gyro. So for my application above, can I use 2 Memsic 2125(putting 90deg to each other) to perform my job? Or even simply only one Tri-Axis Accelerometer(Hitachi H48C) is enough?

Or an accelerometer cannot actually replace a gyro?

Thanks a lot
Henry

Comments

  • ttessierttessier Posts: 14
    edited 2006-11-07 13:29
    Hi Henry,

    A 3-axis accelerometer will provide enough information to tell you what the forces are on the aircraft, and in calm air it would be a decent way to collect information to know what the attitude is - but only until the sampling errors build up. This would be due to·small variations in the measured amounts due to·air turbulence, maybe small errors in banking and·rudder·yaw, those sorts of things that result in·errors·in the signals that will add up over time.

    In aircraft attitude measurement, it is necessary to take out these small variations by the use of a filter. For example, if you are in a turn, you only care about the smooth action of the plane banking, then the small acceleration due to the turn. Little variations from wind currents, etc will only throw off the readings; this is the·"noise" in the signals. A great algorithm to do this is the Kalman Filter (http://en.wikipedia.org/wiki/Kalman_filter).·This filter is very interesting, and even revolutionary for it's time, because it not only acts as a low-pass filter to take out noise error but also "predicts" what the current inputs will be based on what the last reading was. I'm not saying it will fit on a basic stamp and work fast enough for an aircraft, but the idea of a simple filtering scheme would be a way to·reduce your errors.

    To really know the attitude of an aircraft, it is necessary to combine accelerometers with turn rate sensors (sometimes referred to as gyros - although the low-cost solid state ones common today don't use metal spinning gyroscopes).·Having one in each axis is needed to really know what the plane is doing, so that means 3 accels and 3 rate sensors. As an illustration, something like http://www.sparkfun.com/commerce/product_info.php?products_id=411·would give the full sensor suit (albeit it's got bluetooth, which you wouldn't need with your Basic Stamp on board).

    Why are rate sensors needed? Well, it's possible to "fool" accelerometers in an airplane. For example, if the accel is showing 2g due to pitch on the·Z (up-down) axis, this could indicate that the plane is pitching upward ("pulling up") or it could be due to a well-coordinated banking turn, where your accel on the Y axis (side-to-side) shows zero. Sure, you would see a bit of acceleration due to any·changes in·attitude, but any sideslip or turbulence would add noise that would also provide error to your "current knowledge" of where the plane is pointing.·3 turn rate sensors would also indicate if the aircraft is in the process of banking, pitching or yawing.

    All that being said, you will learn a lot about aircraft control with a 2-axis accelerometer and watching it's response as you fly your plane manually. It would be great to have a real-time link where you can see the output of the accels as you fly. Then you can see how the errors would mount up over time and get a feel about how this would work. You could a PC program after the flight to quickly work out errors on the relayed data if you were really ambitious! If you felt confident after a while, (and have excellent liability insurance!), you might even want to put in a "autopilot" algorithm for simple manouvres, but with manual override. Keep in mind that to keep up a sufficient sampling rate and accuracy,·you would need more processing power and memory than what you get in a basic stamp. But it would·illustrate the principles for you, and would be able to indicate the·attitude of the plane - errors will increase over time, and how fast that happens would also be an excellent illustration of these principles.

    I hope you find this useful, this is a fascinating area to work in!
  • John R.John R. Posts: 1,376
    edited 2006-11-07 18:33
    UAV => Underwater Autonomous Vehicle
    or
    UAV => Unmanned Air Vehicle

    ttessier's comments hold in either case, but speed of processing is gnerally less intensive with Underwater.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • Henry ChanHenry Chan Posts: 5
    edited 2006-11-08 09:06
    Thanks for your input ttessier, are you a real pilot? Or you're an expert in UAV area?

    In fact I'm just a model airplane freak and I work as a VB programmer. Writing the embedded software is really challenging to me, but those fascination keeping me to got ahead.

    After I read your comment it really scare me a lot by using Kalman Filter, I remember I learnt something on it when I studies Applied Math n-th years ago, it should be something about probability and interpolation. But this should be my final goal as I saw some well developed UAV are using this approach.

    Maybe I need to get a 3-axis accelerometer for my beta testing first. Until I'm familiar about the operation, I'll get the 6 DOF sensors.

    Just another idea about the attitude control. Can I use a pressure sensor like http://www.sparkfun.com/commerce/product_info.php?products_id=8161 to lock/monitor my height? Assumed that the weather condition keep unchanged, pressure should be a good indicator, I guess!


    Thanks & really appreciate on your help!

    Henry
  • ttessierttessier Posts: 14
    edited 2006-11-08 14:14
    Hi Henry,

    Yes, I think this area is really cool, too. I worked with some pretty smart aerospace engineers that produced complete mathematical models for autopilots and verified them against real-world results. I was helping with the electronics, so ended up learning more from them about 6 degree of freedom (6 DOF) control that I knew existed!!

    Sure, a pressure sensor will give you altitude. Calibration based on daily barometric pressure is key - which is why pilots manually correct thier altimeters before takeoff. Some electronic pressure sensors are sensitive and accurate enough to tell you your altitude after taking an elevator! This would be an interesting way to calibrate it for model airplane use too, if you knew the height of the floors. Just make sure the building's·ventilation system·doesn't create·a pressure gradient of it's own...look at the reading before and after going through the front doors.

    The pressure sensor you posted looks pretty good - with a 16 bit A/D·you can get·about 8 inches of altitude accuracy. Mind you, to get that you need perfect conditions (no·other external factors that affect pressure).·As with any sensor,·you will need to characterize the errors - for example, would·it's mounting location be affected by air turbulence around the plane? It would be interesting to have someone drive you down a highway,·start logging sensor readings, then open and close a window - there should be a pretty significant pressure change. Imagine your airplane flying along at 40 knots or whatever and you can see how any little air holes could cause changes in air pressure and thus add error to the altitude reading.
Sign In or Register to comment.