Fighting with computers

Computers are not always friendly.

Thursday, March 29, 2012

The not so intuitive use of an IMU

A recent project required acceleration measurements to study a person's gait. I thought this could be done easily with one of the many MEMS (MicroElectroMechanical Systems) devices available in the market under the name of IMU (Intertial Measurement Units) or just accelerometers.

I settled with the cheapest acceloremeter I found on eBay with an I2C interface to connect it to a Funnel IO powered by a rechargeable Lithium battery. Funnel IO (or FIO in short) is an Arduino-like board that includes a USB-powered battery charger plus an XBee module interface on board. It can be programmed wirelessly but this proved to be a real PITA to get it working (and even after that, it does not work reliably).

Once I got some code grabbed from Arduino forums to read my sensor (MMA7660FC from Freescale) I was a bit shocked with the results. My sensor was a 3-axis accelerometer and  I was expecting a measurement of X=Y=Z=0 on my first test with the sensor static. I was wrong. I should have read first this wikipedia article.

It turns out that accelerometers use a "free-fall" reference frame. Bottom line is that the impact of the Earth gravity is taken into account. So even if the sensor is stationary some axis will be sensing the effect of the gravity and this will cause non-zero measurements. The sensor measures the forces a small mass inside experiences and gravity acts upon it even if there is no sensor motion.

Once I did understood my sensor was acting as expected and it was not damaged things progressed smoothly.


  • At 3:16 pm, Anonymous Anonymous said…

    If you build a sensor which distinguishes acceleration from gravity, you'll win a Noble-Prize :)

  • At 11:01 am, Blogger Miguel Sánchez said…

    Not big deal: just detect and remove the constant part of the measurement :-)


Post a Comment

<< Home