Go Down

Topic: GETTING MOVEMENT ACCELERATION FROM ADXL322 (Read 5034 times)previous topic - next topic

Virginia

Mar 29, 2011, 04:30 pm
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
http://arduino.cc/en/Tutorial/ADXL3xx
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  XD

AWOL

#1
Mar 29, 2011, 04:52 pmLast Edit: Mar 29, 2011, 05:05 pm by AWOL Reason: 1
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.
"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.
I speak for myself, not Arduino.

Virginia

#2
Mar 29, 2011, 05:15 pm
Thank you very much for your fast reply. XD 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!

johnwasser

#3
Mar 29, 2011, 05:54 pm
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.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Virginia

#4
Mar 29, 2011, 06:03 pm
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!

johnwasser

#5
Mar 29, 2011, 06:16 pm
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.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Virginia

#6
Mar 29, 2011, 06:22 pm
I had read something about laptos protection, but not too much information.
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!!!!

AWOL

#7
Mar 29, 2011, 06:25 pmLast Edit: Mar 29, 2011, 06:34 pm by AWOL Reason: 1
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.
"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.
I speak for myself, not Arduino.

johnwasser

#8
Mar 29, 2011, 06:33 pm
A Google search for:
accelerometer falls elderly
turned up all sorts of research.  For example this paper: http://portal.acm.org/citation.cfm?id=1166534
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

WillR

#9
Mar 30, 2011, 03:49 am
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.

Virginia

#10
Mar 30, 2011, 09:02 am
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?

AWOL

#11
Mar 30, 2011, 09:06 am
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.
"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.
I speak for myself, not Arduino.

johnwasser

#12
Mar 30, 2011, 12:55 pm

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.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Virginia

#13
Mar 30, 2011, 02:33 pm
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):

Acceleration=/read_digital_value*(3300mV/1023))/460mV/g=value*g

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...

AWOL

#14
Mar 30, 2011, 02:34 pm
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?
"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.
I speak for myself, not Arduino.

Go Up