How can I implement sensor fusion using a gyroscope and a magnetometer to find the orientation?

I am working on Fall Detection in humans. A system that would raise alarm when a person falls. For this I plan to use acceleration to see if it is a fall and orientation change to reduce false positives. I was trying to get angle of orientation using gyroscope,accelerometer and magnetometer. According to what I have googled I shouldn't use gyroscope alone as when we integrate to get angle the result is not accurate and I should use sensor fusion and filter using kalman filter or complementary filter. I can't use accelerometer as during a fall the acceleration won't be only from gravity. I am a newbie so I don't know how to proceed. Correct me if I have understood anything wrong till now.

2 Answers

The magnetometer will be very difficult to use because you have no idea what the local magnetic field will look like around the user.

The gyroscope can help you keep track of angular orientation data during accelerations, but unless you know exactly how this is going to be attached to the human it will not help because you cannot orient the relative angles to the subject. A person can fall with or without rotating in the air as well, so I don't see it helping much anyway.

Kalman filters are great, but overkill; you are not doing inertial navigation over long distances, so don't bother. Simple averaging will suffice.

The accelerometer should be able to detect falls by itself. The only way it will ever "Zero out" is in freefall, and if that zeroing is long enough and then followed by a very hard acceleration against the direction of gravity (the crash) you can call it a fall. Unless the person has some kind of engine to produce thrust, or is going so fast air resistance is a factor, there will be no accelerations in the air. Simplely calibrating of the threshold for being in freefall, the time necessary to call it a fall, and the necessary strength of the following crash should be able to detect falls or jumps with almost no false positives.

For instance if you want to track short falls where the object is never fully off the ground, a large dip in acceleration data will still be seen, so just set the "zero" threshold high.

Such system, some even has airbag, has been around in university/research/papers for many years. Presumably, falling means a marked change in 'data values'. One can easily log some data (accel and gyro) by falling on bed and plot the values.

May you find some inspiration in followings

http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&cad=rja&uact=8&ved=0CEMQFjAC&url=http%3A%2F%2Fcourses.daiict.ac.in%2Fmod%2Fresource%2Fview.php%3Fid%3D2430%26redirect%3D1&ei=Ls_WU5-cOob_8QW3v4KoCA&usg=AFQjCNEDUyJKTNYFCi71rX13RMlxoHL8kg&bvm=bv.71778758,d.dGc

https://www.google.com/search?q=human+fall+detection+system&safe=off&tbm=vid&source=lnms&sa=X&ei=ps3WU6jGMYyE8gWxo4LYCA&ved=0CAoQ_AUoAw&biw=1577&bih=800&dpr=1#q=elderly+fall+detection+airbag&safe=off

Hope it helps