Hi guys, so I've been playing with an accelerometer (ADXL345) on an arduino and I seem to get what I assume to be proper acceleration values, if I place the X axis up then I get a value of approximately 1.01G which would be about 9.81m/s/s so that makes sense in terms of gravity. But the thing is I want to get only the acceleration of movement and thats all, but that value will obviously be wrong due to the added gravity values, the problem is I never really know what orientation the accelerometer will be in. Does anyone have any ideas in how I could combat the effects of gravity in a sense lol.
the problem is I never really know what orientation the accelerometer will be in.
When ? While your using it ?
Well if you just looked at it , it would be obvious , wouldn't it ?
Don't get offended by this question but do you understand the difference between acceleration and velocity ?
The accelerometer has a three axis, x,y, & z. Have you bothered to read the datasheet ? (like maybe page 35 ?)
the problem is I never really know what orientation the accelerometer will be in.
When ?
While your using it ?
(or in the future ?)
raschemmel:
Don't get offended by this question but do you understand the difference between acceleration and velocity ?
The accelerometer has a three axis, x,y, & z. Have you bothered to read the datasheet ? (like maybe page 35 ?)
I don't really know what you're getting at unfortunately, if I place it like on page 35 with the top facing up I get zout of 1g and if I turn it upside down I get a Zout of -1g just as it suggests, and if I try the other orientations I get the appropriate 1G values or 0G depending on the axis I look at. So I don't really get what you're trying to say about page 35?
Maybe I'm not understanding whats being recorded properly, but I figured that lets say I have top facing up, then my zout is 1g which would get me 9.81 m/s/s for gravity? But then if say I moved it down enough to get 2G I would be getting the gravity acceleration plus the movement acceleration. Is this thought process incorrect?
raschemmel:
When ? While your using it ?
Well if you just looked at it , it would be obvious , wouldn't it ?
The problem is, the orientation of the accelerometer will change unknown to me, for example lets say I taped it to a ball. The ball can be thrown in any orientation, so the accelerometer orientation will change while the program is running.
The ball can be thrown in any orientation, so the accelerometer orientation will change while the program is running.
So ? So what ? You don't really think it's possible to know which way it's oriented in flight do you ?
I mean, with the right software and the right computer, it might very well be since you know 1g z is up -1g z is upside down,
0 g z means it's 90 degrees off from "up" . Where the whole concept of what your proposing falls apart and makes the idea ludacrous is that while the acceleration of the ball STOPS the moment it leaves the pitchers hand so it is basically in a freefall
horizontally in the sense that while it does have velocity , it has no acceleration so all values will be zero except for the effects of gravity in the up / down axis (where "down" means point at the earth perpendicularly). So you see , if you have both feet firmly
planted on the ground and you hold the accelerometer in your hand (like it is shown on page 35) you DO know which way it is oriented. If you mount it on vehicle and that vehicle is NOT a sidewinder missile , then it is reasonably safe to assume that the
acceleration in the x axis is related to the motion of the vehicle and if you see acceleration in the y axis then you've just been
broadsided by someone while running a red light. If you slam into a brick wall you should see a very large negative spike in the x axis. It you hydro-plane on the freeway in heavy rain and go into a full 360 (like I did once), your heart will skip a beat but you will get really cool acceleration in both x & y , but nothing in z until you roll over....
With some geometry, you can figure out your orientation and acceleration in any given direction. The 1.0G will always be there, though the direction may change. The Accelerometer will give you a vector that is a sum of the acceleration of your doohickey + gravity. It will help immensely if you can maintain a relatively steady Z so you have an easier point of reference, or if your accelerations are not constant, then you can use previous readings to measure current readings to determine orientation.
You do make it difficult if you can't assume down is down.
If you collect the data from an accelerometer inside a ball thrown, and plot it vs time, you can see the z axis going up to 1 g at different points along the way but since you have no reference, and all the other values fall to zero when it leaves the pitcher's hand unless they go to 1 g as the ball spins, you still can't use the data. Basically , you plan won't work.
mirith:
With some geometry, you can figure out your orientation and acceleration in any given direction. The 1.0G will always be there, though the direction may change. The Accelerometer will give you a vector that is a sum of the acceleration of your doohickey + gravity. It will help immensely if you can maintain a relatively steady Z so you have an easier point of reference, or if your accelerations are not constant, then you can use previous readings to measure current readings to determine orientation.You do make it difficult if you can't assume down is down.
Oh right I think that makes a lot more sense now, I was just thinking about it a bit, would it be right to assume that since my acceleration is going to be a vector sum of the x,y,z of the accelerometer which becomes doohickey + gravity haha then I could just get the magnitude of the vector and then minus gravity from it, and that should get me the magnitude acceleration without gravity right? :D.
would it be right to assume that since my acceleration is going to be a vector sum of the x,y,z of the accelerometer which becomes doohickey + gravity haha then I could just get the magnitude of the vector and then minus gravity from it, and that should get me the magnitude acceleration without gravity right? smiley-grin.
probably but since :
There is no acceleration after the ball leaves the pitchers hand....
raschemmel:
would it be right to assume that since my acceleration is going to be a vector sum of the x,y,z of the accelerometer which becomes doohickey + gravity haha then I could just get the magnitude of the vector and then minus gravity from it, and that should get me the magnitude acceleration without gravity right? smiley-grin.
probably but since :
There is no acceleration after the ball leaves the pitchers hand....
Oh awesome, so basically once the ball leaves the pitchers hand I should get an acceleration of around zero since it would just be velocity at that point.
so basically once the ball leaves the pitchers hand I should get an acceleration of around zero since it would just be velocity at that point.
No, it will then be slowing down or decelerating so you will get negative readings.
Oh awesome, so basically once the ball leaves the pitchers hand I should get an acceleration of around zero since it would just be velocity at that point.
Yeah, except that the data will be meaningless since you won't know which way is up, or rather I should say up is the only way you will know because if one the three axis reads 1 g then THAT axis is oriented with respect to gravity. If it reads - 1g it is upside down with respect to gravity. That is all you will know which eliminates quite a bit. A vector sum where two of the axis are zero would still be zero would it not ?
Yeah, I was fiddling with the geometry a bit, and without knowing the direction of gravity, I'm not sure you t have enough information to separate out gravity from any other accelerations. You'll have to obtain more information somehow.
What exactly are you trying to accomplish?
There seems to be some confusion here about an object in free fall, such as a ball thrown once it has left the thrower's hand.
Any practical accelerometer measures relative acceleration which is to say the inertial force experienced by its internal "otolith" relative to its housing.
In free fall, the gravitational force experienced by that sensing mass is identical (in proportion) to that experienced by the housing so the registered acceleration is zero (in all directions). The only acceleration that will be measured, is that due to air resistance to the travel of the object such as a ball - which will of course, be mostly directed opposite to the present direction of travel.
As already pointed out numerous times, the moment the ball leaves the pitcher's hand it stops accelerating and is in a ballistic trajectory (curving gradually toward earth) which , for want of a better term I guess we can call a "free fall". There may be some acceleration due to gravity but there is no way to know the ball's orientation in flight.( or at least if there is I don't see it).
trustnoone:
the problem is I never really know what orientation the accelerometer will be in. Does anyone have any ideas in how I could combat the effects of gravity in a senselol.
The answer is that you need to know which direction is vertical (relative to the accelerometer). If you know that the orientation will be constant, and know that gravity is the only acceleration that is sustained over the long term, you can work out out. Alternatively if you have gyro sensors so that you can detect rotational accelerations then it's possible to get a pretty good guess for which way is up. Depending on your environment you might be able to think of other ways to work it out.
Let me second PeterH's response. You can't rule out the effect of gravity unless you know what way the system is pointing. This is why most systems that use accelerometers also use a three axis gyro to sense orientation.
That said, gyros come with a lot of extra overhead that includes calibrating them to know what flat is when you start, and compensating for the fact that they will slowly drift off course. If you can find a cleaver way in your given application to sense what you want without knowing your orientation (The magnitude of the vector might be one place to start) that may be a simpler solution.
trustnoone:
Hi guys, so I've been playing with an accelerometer (ADXL345) on an arduino and I seem to get what I assume to be proper acceleration values, if I place the X axis up then I get a value of approximately 1.01G which would be about 9.81m/s/s so that makes sense in terms of gravity. But the thing is I want to get only the acceleration of movement and thats all, but that value will obviously be wrong due to the added gravity values, the problem is I never really know what orientation the accelerometer will be in. Does anyone have any ideas in how I could combat the effects of gravity in a senselol.
You need to detect the magnitude and direction of the local gravity field under zero acceleration conditions, then remove that bias vector from your integrated accelerations.
Start here and have fun! Average G
raschemmel:
would it be right to assume that since my acceleration is going to be a vector sum of the x,y,z of the accelerometer which becomes doohickey + gravity haha then I could just get the magnitude of the vector and then minus gravity from it, and that should get me the magnitude acceleration without gravity right? smiley-grin.
probably but since :
There is no acceleration after the ball leaves the pitchers hand....
Actually there is because of air resistance. What you said would only be true in a vacuum.