# Identifying steps in walking accelerometer

I have some recorded walking data from an android phone and want to determine when someones foot hits the ground using the acceleration data. I'm making an assumption here that the person will "bob" vertically as they walk (i.e. when their foot pushes off their body will rise, and as a foot is approaching the ground their body will fall)

Given that, I have taken the $X$-axis acceleration data (which corresponds to the persons vertical axis), removed gravity, and filtered out the noise giving me something like this: My question is: where in this signal does a foot hit the ground?

I have 3 options:

1. Would it be all of the valleys in the signal? This would be correct if I were measuring position information but acceleration is a bit different. I think the marked points are actually the moments of maximum deceleration (or, acceleration towards the ground), so at these times the body is still in motion and not stationary

1. Would it be the points where acceleration is 0? 0 acceleration would mean the person/device is moving at a constant speed, which I believe would be the case upon foot landing because I'm assuming the speed is 0 and therefore not accelerating. But this would also be true on the "rising" part of the walk cycle - as a person pushes off the ground they will accelerate in +X, but once they reach the peak of the rise they would no longer be accelerating and you would probably see a 0 again

1. Would it be the 0 acceleration points, but only after a valley? A valley would, I think, represent point of max acceleration towards the ground (i.e. theyre on the way down), so a 0 acceleration value after a valley would presumably be once theyve stopped accelerating downwards and the foot has landed?

I'm thinking the answer is #3 but wanted to see if my logic is correct, or whether my interpretation of acceleration graphs is completely wrong

EDIT: this data is recorded using a chest harness carrying the phone, so the phone is not on any of the limbs. The main assumption being made is that the torso will move up and down with each step. Also, in the phones coordinate system positive X is pointing towards the persons head

EDIT2: Using a low pass butterworth filter, instead of a bandpass, to eliminate any high frequency noise. The blue vertical lines are where I visually observe the foot hitting the ground so I can use it as a guide (even though it will be off by a few milliseconds): And here is the filtered signal (red) over the raw signal (black): • This is not a DSP question, but one in bio-mechanics. The phase relationship between foot contact and accelerometer data appears, from data I'vd seen published, to be none of the above, and may depend on other factors (walking speed, gender, shoe type, and etc.) Furthermore, the noise you filtered out contains some of the answer. – hotpaw2 Jul 14 '16 at 20:14
• Thank you. It is possible that the mounting point will slightly distort the profile. There are more joints between hip and chest. Is this g-force on the vertical axis? Can you please post the raw signal as well? (The trace will be off by the group delay of the low pass if you are using an FIR, the raw signal will appear to be leading). Is this total magnitude or just the Y component? – A_A Jul 15 '16 at 9:05
• Just added another plot showing the raw signal overlaid with the filtered signal. Filtering was done with a low pass butterworth. Theres no delay between the raw and filtered signals. Vertical axis is linear acceleration in m/s^2, and this is only the vertical component (I'm not too interested in the other 2 axes for this analysis) – Simon Jul 15 '16 at 12:17
• You have a dynamic system with a cutoff frequency in the range of 2-5 Hz, at most. Can you plot the raw data, the low-pass filtered signal with cutoff in this order, and the derivative of the filtered acceleration (jerk)? – luciano kruk Jul 15 '16 at 16:25
• Is there a simple way to calculate jerk or the derivative of my acc vector using R? I've tried both numericDeriv(filtered) and diff(filtered)/diff(time) but they produce drastically different plots – Simon Jul 15 '16 at 21:54

It may well be a simplification, but the inverted pendulum model is often used to model walking.

According to that, when a person is walking, they indeed "bob" up-and-down but also left-to-right as the brain balances the body successively from the left to the right and back to the left (and so on) legs.

The point of zero acceleration is at the top of the pendulum cycle. To get there, the pendulum was accelerating (positive acc) due to push-off and from there it will start decelerating (negative acc) until the collision phase of the next leg (The actual waveforms are a bit more complex than that, see hip point at Fig 6 from the linked paper above).

At every collision, the center of mass has to stop and reverse abruptly and that's where we get "spikes" in an accelerometer's readings that are timed to the walking pace.

I am saying this, about the spikes, because you seem to be filtering with a very narrow bandpass filter to get rid of noise. It's so narrow that the filter is "ringing". Its output appears to be a modulated sinusoid. The sinusoid's fundamental is at the centre frequency of the filter and its envelope is timed to the excitation of the filter by the spikes. It is literally like striking a bell. And in fact, before the bell's ringing has died down (from the previous step), it is hit again, you can see this at the envelope of the filter that looks like a spindle.

With this filter, it will be impossible to study the signal.

What I would suggest is to take the signal from the accelerometer, remove the gravity vector, obtain its magnitude and integrate it (i.e. pass it through a low pass filter). The time constant of the integrator should be comparable to the walk cycle length you want to study. This will get rid of the noise and provide a relatively smooth envelope approximating the movement of the center of mass. Alternatively, just before the integrator you can take the absolute of the magnitude (i.e rectify it). This will turn your output into a square pulse the length of which will correspond to the duration of each step.

Hope this helps.

• Thanks for the advice. Ive added an extra plot to the original question using a less strict low pass filter (and blue lines to highlight visually observed foot landings). Given this new plot, would it be fair to say that foot landings are the sharp drop in acceleration towards 0 after a peak? – Simon Jul 15 '16 at 3:32
• Also, if that is the case, then I drastically misunderstand what a negative acceleration value means. What does it represent in this case walking context? I originally interpreted the positive peaks as "bobbing" upwards towards max acceleration and the subsequent drop to 0 as the highest point in the walk. Then the negative valleys are max acceleration downwards, and subsequent 0 value to be landing on the ground as there is no more acceleration upon impact...is this incorrect? – Simon Jul 15 '16 at 3:35
• Yes, these are the foot landings. Please see this link. But keep in mind that the difference in mounting position alters the profile. – A_A Jul 17 '16 at 22:07

It would be simple to make an acquisition of a single step and identify the phases of the step. For that, you shall consider the geometry of your setup, and therefore answer these:

• The accelerometer has (or not) a relative speed to the ground equal to ZERO?
• The accelerometer measurement axis is aligned to gravity?

My guess is that, when one foot is on the ground, the accelerometer shall measure only gravity for a short period. Therefore, I would look for segments where the jerk is close to ZERO in the vertical axis, AND the magnitude of it is close to -1g.

EDIT: All this new information you have given us, like sensor close to chest, gravity, alignment, etc, demands new dynamic models to represent the measurements you have there. But any model, with respective solution, can have counter-examples to demonstrate that the model is inadequate at all. For example, if the user carries a heavy rucksack, there is a new model to measure the acceleration close to the neck. This is different from the acceleration tied to the feet. That said, the body shall damp the actual acceleration at the feet to a filtered and delayed measurement at the neck. Nevertheless, the readings shall have the same low frequency components as at the feet. This is more less the same I see at your graph, the one with blue lines. The blue lines are as periodic as the low freq. components of the red line, but for a phase. You should consider to review your necessity of precise instant of touch on the floor in accordance with your application.

• To answer your questions: yes gravity has been removed so a zero will be no local device acceleration. And yes, we can assume the axis is perfectly aligned to gravity (I took the strength of gravity along each axis and subtracted it from the acceleration vector to get linear acceleration, which is what Im showing in the graphs) – Simon Jul 15 '16 at 2:54
• In my case the accelerometer is attached to the chest using a harness, not the feet – Simon Jul 15 '16 at 2:55
• So am I correct in thinking that you're saying when the signal crosses the horizontal axis (i.e. when acceleration is zero), is when the foot hits the ground? I think this would also be true when the walker lifts up and is at the very peak of their (mid) step as there would be no acceleration there and you'll also get a zero? – Simon Jul 15 '16 at 2:57

I would have thought the place to start was option 4: at the peaks of the acceleration curve.

Just before your foot hits the ground, it is going down as fast as possible. Just after it hits the ground, it's stationary. That means the acceleration will be a peak in the upwards (positive) direction as you take the step. 