Are you sure that interpolation will meet your requirements?
To interpolate a value you need to know where previous and next points are, and if you are doing a real time analysis you only know where are the previous points.
I suggest you to have a look to this project: pedometer
It's using accelerometer for the same objective as you and the code is available.
Regards.