can an acceleration sensor (smartphone) sense if someone is sitting on a train (or commuting in a car for example) or just sitting stationary?

This may be a really basic question but thanks for your time.

  • \$\begingroup\$ Do you strictly need to use only the accelerometer, or other sensors are available? I think that the GPS would be the no brainer here. \$\endgroup\$ – Vladimir Cravero May 10 '18 at 9:56
  • \$\begingroup\$ if you are driving with a constant speed, no accel. appears. So you will only detect the breaking, accel., and maybe curves. \$\endgroup\$ – Sir Sy May 10 '18 at 9:59
  • \$\begingroup\$ @VladimirCraveroI am also using Gyroscope but I don't think that would make any difference. But GPS is a no go as I am trying to implement a system which does not use user's location. \$\endgroup\$ – Salman Shaukat May 10 '18 at 10:15

You question is not entirely clear.

An acceleration senser can sense only acceleration. Hence in a perfect train ride, it would detect nothing at all, just like you wouldn't be able to detect anything if you were in an enclosed box. In practice, a train ride generally has very specific bumps where sections of the rails are joined, and left-right swaying at ~ seconds that cancels out on a slightly longer time frame. I think this could be easily detected.

A car ride has very different characteristics, like more rapid acceleration and de-acceleration, but this depends a lot on the track (like in-city versus unjammed highway). I think car rides are somewhat more difficult to detect.

But I think there is no easy, 100% sure way to detect a ride from just accelerometer data.

  • \$\begingroup\$ yes, I was expecting the same problem. I am also using Gyroscope but I don't think that would make any difference. \$\endgroup\$ – Salman Shaukat May 10 '18 at 10:21
  • 1
    \$\begingroup\$ Gyro and accelerometers are very good for short-term positioning, but over time the errors accumulate, so they are generally used in combination with a sensor that is good at long term but bad at short term, like GPS. \$\endgroup\$ – Wouter van Ooijen May 10 '18 at 10:28
  • 1
    \$\begingroup\$ I believe the noise-level (slight vibrations) from being in a vehicle should be detectable, as the accelerators are quite sensitive. It might depends on the quality of the vehicle's suspension. \$\endgroup\$ – Bort May 10 '18 at 12:49
  • \$\begingroup\$ @Bort probably. But it all depends on what exactly the OP wants to detect. Being in an elevator or on an escalator might produce the same type of vibrations. \$\endgroup\$ – Wouter van Ooijen May 10 '18 at 14:34
  • \$\begingroup\$ Actually, gyro might be helpful here. The very nature of train travel implies much less rotational movement than non-highway vehicle ride. On a side note, about the first thing people do when they board a train is pull out their phone and start typing. Now that would screw all your sensor data a lot. \$\endgroup\$ – Maple May 10 '18 at 16:49

Are you looking for instantaneous detection, or over an extended period?

If a person is sitting and holding a phone, there will be an acceleration of 1g downwards, due to gravity. There will also be short bursts in which the acceleration is not 1g, every time they move the phone.

If the person is commuting, there will be sustained periods of acceleration and deceleration. This, added to the normal 1g, will give an acceleration of more than 1g for several seconds. Aside: going round bends is a form of acceleration.

If you can filter out the random shaking, and just look at longer term accelerations, you should be able to spot that the phone is in a moving vehicle.

  • \$\begingroup\$ Actually, I am looking for detection over 1 minute or so, while mostly mobile device will be inside pocket. your answer is helpful. \$\endgroup\$ – Salman Shaukat May 10 '18 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.