This is my first time using an accelerometer 6D. My questions will probably sound a bit naive but I hope you'll be patient. Please be aware that I did look at all the posts (or nearly) on this forum dealing with the LSM303DHLC model and could not find an answer (or missed it).
My project : have brake lights embedded in a jacket I wear when cycling.
Equipment: a sewable board (Lillypad-like) + a LSM303 (in a sewable version) + other stuff meaningless for my current problem.
Basically, a deceleration will switch on red leds. I am prepared to spend some time later on defining the adequate thresholds but for the time being, here's my problem.
The board and LSM303 will be sewed somewhere on the "chest" level of the jacket, resulting in a nearly-vertical position of the sensor. Yet, due to the movement of the cyclist, the position of the sensor (the angle it makes with say the radius of the Earth) will vary a bit.
When I run the Accelsensor test provided with the LLSM303DLHC library (from Adafruit and compatible with the Unified sensor library), I get roughly low (close to 0) values for X and Y when the sensor stands still, and 9.8 as expected (gravity) for Z.
But if I rotate my "device" by 90°, X will show the former Z values (Earth gravity), and Z becomes the value to track for a cyclist linear deceleration.
It makes sense when looking at the diagram included in the sensor datasheet :
But given the way I intend to sew the sensor on my jacket, it will be oriented this way :
My question : is there any way to take into account this phenomenon when trying to detect a linear acceleration (or deceleration) in one axis only ? In my case, the movement of the cyclist.
I mean, the position of the sensor will be roughly vertical, but will randomly change (tilt effect) as the torso of the cyclist is never 100 % still.
I am aware that the LSM303 is a 6 D device, with a magnetometer and an accelerometer. I understood, from a theoretical perspective, that the accelerometer can be used to provide a tilt-compensation for the compass. But can this work the other way round?
In short, can you put me on the right direction ?
Pierre