## Getting position data from a 3 axis accelerometer

**Why?**

The goal of this report is evaluate the possibility of tracking position from a 3 axis accelerometer to be use in

the Design of propioceptive devices that have sense of its own motion and position.

The idea is take advantage of the unobtrusive nature of the accelerometer to avoid externally referenced motion

sensing technologies as infrared, radar and video that can present interferences.\\
The accelerometer is one of the most widely used sensors for capturing context because it is small, inexpensive,

lightweight, and self-operable.

In efforts to obtain behavioral patterns, many studies* have reported the

use of multiple accelerometers attached to the human body.

**The problem**

Inertial systems like accelerometers are not well-suited for absolute

position tracking and in spite of that in theory it’s possible, relative

position is difficult to implement in real-life situations.

An accelerometer output is a variable voltage depending on the amount of\\
acceleration applied. The common reference is the resultant acceleration

produce by earth’s gravity force. The unit used for the acceleration measure

is g, the earth’s gravity at sea level. (1g = 9.8 m/s~2)

Their outputs need to be integrated once with respect to time to get velocity

and integrated twice to get position.

Force = Mass * Acceleration\\ '''Acceleration = Force / Mass

The process of determining velocity and position by integration from acceleration

is more problematic than the reverse.
In theory knowing the forces applied to an object it is possible to integrate to

find its velocity and position over time.// Positions are found by integrating, over

time, the signals of the sensor as well as any signal errors.

One of the first problems is the time lag. The more accurate your derivative

(ie, the more points back in time you look), the greater the delay. In Addition,\\
acceleration is the second derivative.

The second consideration is the Frecuency Noise. A pure differentiator provides

a linearly increasing gain with frequency.
This amplifies high-frequency noise, which can swamp out the signal.

**Numerical Integration**

There are lots of ways to integrate (Polynomial, Simpson’s Rule, etc.)

Euler integration is the most basic of numerical integration techniques. It is only

completely accurate if the rate of change is constant over the timestep. One possible

solution to this problem is to decrease the timestep, but no matter how much it's reduced,

the error will keep increasing over time. Errors rapidly accumulate during the integration

process and additional knowledge in the form of initial conditions is required for

determination of integration constants.

Gravity complicates things – rotation measurements must compensate for the change in the

gravitational vector, which needs to be subtracted from the acceleration.

In the integration process, changes in accelerometer orientation must be accounted for since

accelerometer measures acceleration relative to its orientation rather than to the earth or

global coordinate system. This underlies the application of accelerometers as inclinometers,

where they determine the component of gravity that acts orthogonal to the level.

**The Exercise**

I use a ADXL330 triaxial accelerometer, manufactured by Analog Devices.\\
http://www.analog.com/en/prod/0,2877,ADXL330,00.html

Range: ±3g

Size: 4mm x 4mm x 1.5mm

Supply Current: 0.2mA \\
Max BW: 1.6 kHz (X,Y)

0.5 kHz (Z)

Noise: 2mg (@50Hz) (X,Y)

2.5mg (@50Hz) (Z)

Cost: $6

I use a low Pass Filter and a simple average for the signal to get the acceleration

values from the sensor to Processing, My main goal was to be able to use this values

with the nature of code (noc) library in order to use the functions of vector math.

The exercise didn’t work.

The code: http://itp.nyu.edu/~mfm317/phycomp/pos_from_acce.pde

Errors:

Bias drift.Changes over time in the baseline (zero input) output.

Scale factor drift. Changes over time in the slope of the input-output curve.

Drift results in an additive noise, which causes an exponential error.

**Options**

The angular velocity output of a gyroscope can be integrated to determine orientation;

so three orthogonal gyroscopes can be used to sense the orientation of a triaxial accelerometer.

Alternatively, and to correct integration errors, it is possible to obtain an absolute measure

of orientation using the earth's magnetic field, as in a compass, which uses the horizontal

components for heading determination.

The earth's magnetic field also has a vertical component, and a 3 axis magnetometer can therefore

sense two-dimensional (2D) orientation, since it is not possible to sense rotations about the axis

of the earth's magnetic field. A combination of accelerometers and magnetometers will give absolute

three-dimensional (3D) orientation, except at the magnetic North and South pole (where gravity and

earth magnetic field are parallel).

IMUs made from low-cost parts quickly diverge from reality because of both poor drift and random walk noise

The only solution is to use external information to reset the orientation or position at regular intervals.

Several companies have developed inertial sensors combining all three technologies, which give orientation in

a global coordinate system (relative to the earth's magnetic and gravitational fields).

Inertial Measurement Units

An inertial measurement unit (IMU) is a sensor package containing three orthogonal axes of rate sensors (gyros) and three orthogonal axes of acceleration sensors (accelerometers)

Often supplemented with additional sensors for calibration (i.e., magnetometers provide a rudimentary degree of orientation reference)

Historically used for inertial navigation or tracking

Typically on the order of $1000

Xsens Motion Technologies http://www.xsens.com

MicroStrain http://www.microstrain.com

Cloud Cap Technology http://www.cloudcaptech.com

Intersense http://www.isense.com

Crossbow http://www.xbow.com

MIT: http://www.media.mit.edu/resenv/Stack

***Reference papers****Activity Recognition from Accelerometer Data**

Nishkam Ravi, Nikhil Dandekar, Preetham Mysore and Michael L. Littman.

**Activity Recognition from User-Annotated from Accelerometer Data**

L. Bao and S. Intille

**A Method for deriving displacement data during cyclical movement using an inertial sensor**