Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to measure distance travelled by using 3-axis accelerometer?

Not open for further replies.

Surender Reddy

Full Member level 2
Jan 28, 2012
Reaction score
Trophy points
Bangalore, India
Activity points
Hi everyone,

here I started working on Pedometer, which calculates the number of steps taken.

For this, I chosen MMA8453Q 3-axis accelerometer and freescale's MLK25z uc and using Code warrior IDE.
The accelerometer works with I2C, and I done with this and it is giving the x,y,z axis values.

Change in accelerometer motion, the respected values getting changed.

Need to count no of steps?

I stuck here, don't how to write the logic.

Please suggest me the logic here.


just from the physical / mathematical point of view.

* integration of acceleration gives speed
* integration of speed gives distance


Velocity is the integral of acceleration, a
Distance is the 2nd integral of acceleration.

Thus the "analog logic" is the continuous 2nd integral of the vector acceleration and reset between readings with zero reset time and auto-cal for DC offset using ultra-low input offset chopper type Op Amps as charge amplifiers.

Any small DC offset in acceleration will result in long term position error accumulated.

Acceleration measured on the wrist is only good if user pre-sets the average distance per step which is detected by "jerk" or derivative of acceleration.

Even a pedometer on the ankle will accumulate DC offset error from drift in DC calibration or thermal shift or result of a bump.

Each device must be calibrated for a range of motions and location of sensor is key must be on ankle or shoe.

I wonder how far a basketball pro runs each game.

How to calculate the acceleration from the measured x,y and z-axis values.
Is there any formula for that........

How can we measure the +ve acceleration and -ve acceleration.


You say you have an accelerometer, then you should get acceleration...

Or do you mean how to combine these three values to get a single one?
A long time ago... But it should be the same as the length of a vector in a three dimensional room: a_t = sqrt (ax^2 + ay^2 + az^2).
I'm not 100% sure.


I'm getting one value for acceleration, i don't know it correct or not.

then how to count number of steps taken (Pedometer application) using this acceleration?


I'm getting one value for acceleration, i don't know it correct or not.
The only way i see is to read the datasheet. There you should find all related information. How did you select the device?

... only one value...
For this, I chosen MMA8453Q 3-axis accelerometer
i´d expect three values form a three axis accelerometer...--> datasheet

then how to count number of steps
digital bandpass filter with frequency from low walking speed (maybe 0.3Hz) to sprint speed (maybe 3Hz) folowed by a digital comparator and a counter.


Calculation distance from double integrated acceleration is a purely theoretical option. You can safely forget about it.

Pedometer sounds more practical. I would expect that you can derive step information from vertical acceleration. You should record acceleration waveforms during walking to see if it's suitable.

Not open for further replies.

Part and Inventory Search

Welcome to