Pages: [1] 2   Go Down
 Author Topic: GETTING MOVEMENT ACCELERATION FROM ADXL322  (Read 2391 times) 0 Members and 1 Guest are viewing this topic.
Offline
Newbie
Karma: 0
Posts: 19
 « on: March 29, 2011, 09:30:44 am » Bigger Smaller Reset

Hi everyone! I am new to this forum, but I have been searching on it for information about this topis. The thing is I have programmed an accelerometer reading and I get the values said in
But this values depend on the angles of the sensorbecause they give acceleration including g. My problem is that what I need to measure is only the acceleration of the sensor in movement, and also velocity. I found some information like here:
http://arduino.cc/forum/index.php/topic,56561.0.html
but I do not understand where do they get those constants. So, basically, I would like to know how can I transfor my accelerometer readings to accelrations in m/s2 and velocity. Thank you very much
 Logged

Global Moderator
UK
Offline
Brattain Member
Karma: 291
Posts: 25867
I don't think you connected the grounds, Dave.
 « Reply #1 on: March 29, 2011, 09:52:04 am » Bigger Smaller Reset

The accelerometer outputs a voltage depending on acceleration.
Because acceleration can be +ve or -ve, the voltage is offset by half the supply voltage, so that voltages cannot go negative.
So if the supply is 3.3V, the 0g output is 1.65V.

The ADC on the Arduino divides whatever voltage is on its reference into 1023 (or 1024 for simplicity) intervals.
So, if the reference is 5V, each increment from the ADC represents about 4.8mV.

Factor in the sensitivity of the accelerometer (expressed in the dataasheet in mV/g or V/g), and you can calculate the acceleration.
Integrate over time for velocity.
 « Last Edit: March 29, 2011, 10:05:09 am by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline
Newbie
Karma: 0
Posts: 19
 « Reply #2 on: March 29, 2011, 10:15:51 am » Bigger Smaller Reset

Thank you very much for your fast reply. It was really useful.
Anyway, I have some other questions now. Now I get an acceleration value like for example 1g, 0.5g...but of course this is including gravity force, to take it away, is it enough to make -1g?
And also, how can I stabiliza my readings?when I am not moving I do get changes in my values, usually not very significant (like from 510 to 512), but eventually it can make some jumps and be more significant. is there any simple way to calibrate? Thanks again!
 Logged

Massachusetts, USA
Offline
Tesla Member
Karma: 202
Posts: 8716
 « Reply #3 on: March 29, 2011, 10:54:14 am » Bigger Smaller Reset

One problem you will have is how to remove the gravity vector from the calculation.  If you are moving on a level, flat plane you can just ignore the Z axis.

Unfortunately, if you are moving in three dimensions and have no other inputs you can't tell the difference between "sitting still on the ground" and "upside-down accelerating toward the ground at 2G's".  You would have to add some kind of orientation sensor like a 3-axis gyroscope.  Then you could tell which way was 'down' and subtract the gravity vector.
 Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline
Newbie
Karma: 0
Posts: 19
 « Reply #4 on: March 29, 2011, 11:03:35 am » Bigger Smaller Reset

Thanks again for the reply. You are fast! (good for me, quite stressed by now  )
I understand that if I have a 2 axis accelerometer, if I have it in a plain surface, is the same not moving that falling plain. Anyway, I am planing to put my sensor in 3D, but, tipycally it will be with the y axis pointing to the floor and the x asis moving in the horizontal plain. I am not sure to have explain myself properly. the problem is, as you said, that is noot moving in a plain, but in the space, but having these considerations, can anything be done?
I will explain in 2 lines little bit of what I want to achieve, so it may clear something: I want tsomeone to carry the board with the seonsor, and detect when the person falls, so I though a good idea could be to detect sudden changes in (motion) acceleration. Thank you again!
 Logged

Massachusetts, USA
Offline
Tesla Member
Karma: 202
Posts: 8716
 « Reply #5 on: March 29, 2011, 11:16:33 am » Bigger Smaller Reset

Some laptops have an accelerometer so they can detect a fall in progress and protect the hard drive by retracting the heads.  I think they look got a significant decrease in gravity (free-fall).    I think some accelerometers even have a "I'm falling!" output.

That might be hard to do with a 2-axis accelerometer.  If you can only measure X and Y, what if the accelerometer is tilted so that gravity is along the Z axis?  I guess you could look for the sudden stop at the end of the fall:  loss of gravity followed by high acceleration for a short period.
 Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline
Newbie
Karma: 0
Posts: 19
 « Reply #6 on: March 29, 2011, 11:22:49 am » Bigger Smaller Reset

In my case I think it will never happen (at least continuously, maybe during the fall yes)that the person is lying for a long time, so, any idea?
Maybe also detecting the lack of gravity plus then a sudden increase in acceleration can work, but in which axis?wuld you give me more explanations or some reference where to look?
Thank you!!!!
 Logged

Global Moderator
UK
Offline
Brattain Member
Karma: 291
Posts: 25867
I don't think you connected the grounds, Dave.
 « Reply #7 on: March 29, 2011, 11:25:19 am » Bigger Smaller Reset

Is this device strapped to the victim guinea-pig?

It is very difficult to characterise a fall without knowing the initial and final orientation of the device.
 « Last Edit: March 29, 2011, 11:34:14 am by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Massachusetts, USA
Offline
Tesla Member
Karma: 202
Posts: 8716
 « Reply #8 on: March 29, 2011, 11:33:03 am » Bigger Smaller Reset

accelerometer falls elderly
turned up all sorts of research.  For example this paper: http://portal.acm.org/citation.cfm?id=1166534
 Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Georgina Ontario
Offline
Sr. Member
Karma: 5
Posts: 437
Arduino rocks
 « Reply #9 on: March 29, 2011, 08:49:55 pm » Bigger Smaller Reset

The ADXL335 is not a great choice -- no "0G" I'm falling output...

The MMA7361 is a better call -- it has three axes and a  0G output. It has x-Y -- horizontal and a Z-Vertical axis. Much simpler to deal with.

http://www.sparkfun.com/products/9652

The BMA180 would be better again. -- But needs more time to think about how to use it.
 Logged

Just another Hacker

Offline
Newbie
Karma: 0
Posts: 19
 « Reply #10 on: March 30, 2011, 02:02:04 am » Bigger Smaller Reset

Thanks again! I am going to look for some implemented things like protection of hard disks. My main problem now is that I can only use this accelerometer (ADXL322), so I will have to figure out how to do it. Myabe if I can generate an alarm when Acc_x and Acc_y are 0 and then detect a sudden change to high values of acceleration....what you think?
 Logged

Global Moderator
UK
Offline
Brattain Member
Karma: 291
Posts: 25867
I don't think you connected the grounds, Dave.
 « Reply #11 on: March 30, 2011, 02:06:51 am » Bigger Smaller Reset

With the device you have, that is an approach, but it means having the device and the processor powered on, which will affect life on what is presumably a battery-powered device.
The advantage of using a device with a free-fall and/or knockk interrupt is that the processor can be put to sleep when not needed, and only the accelerometer needs to be powered permanently - the processor will be woken by the interrupt.
 Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Massachusetts, USA
Offline
Tesla Member
Karma: 202
Posts: 8716
 « Reply #12 on: March 30, 2011, 05:55:37 am » Bigger Smaller Reset

My main problem now is that I can only use this accelerometer (ADXL322), so I will have to figure out how to do it.

Can you use two of them?  At least that way you could make a three-axis accelerometer.
 Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline
Newbie
Karma: 0
Posts: 19
 « Reply #13 on: March 30, 2011, 07:33:08 am » Bigger Smaller Reset

Nop,  I have to use one of this. Now I am trying to convince my supervisor to buy one of the modules you told me (they directly have a pin that gives you free fall), but currently, I can only work with one.
Now I was able to get the data and convert it like, when is on flat surface, get 3g output in both axis, vertical, get 2g in X axis and 3 g in Y axis, etc. Is a bit confusing, because theoretically the sensor gives +-2g, so if someone knows the reason for this...what I do is (powering it with 3.3V):

if not explanation, I can do with this values. although in fact, it is supposed to change aprox 1g from horizontal to vertical, and it only changes 0.7g
My problem is now how to detect free fall, it can be something like when Acc_x and Acc_y=3g is a free fall? (using my result values now) of course this will also give me an alarm when the sensor is in a flat surface, but I am not considering that possibility. The other problem is that, of course I have to give a range, as my sensor never gives me 2 same readings continuously, I mean, I cannot make a precise if (Acc_x==3), because it will alwyas be like 3.01, 3.1...
 Logged

Global Moderator
UK
Offline
Brattain Member
Karma: 291
Posts: 25867
I don't think you connected the grounds, Dave.
 « Reply #14 on: March 30, 2011, 07:34:47 am » Bigger Smaller Reset

Quote
it is supposed to change aprox 1g from horizontal to vertical, and it only changes 0.7g
Did you remember to set Aref to 3.3V?
 Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

 Pages: [1] 2   Go Up