Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use accelerometer or gyroscope on Android

Is it ok to assume most of the user devices will have a gyroscope? In other words will I be excluding a significant number of people by using a gyroscope in my app?

I'm making a children's storybook app and I'm wanting the user to be able to tilt their device around the yaw axis to move a rocking chair back and forth. It's a small part of the app and it doesn't have to be very precise. Is there one sensor I should use over the other?

like image 775
user2892857 Avatar asked Dec 19 '13 23:12

user2892857


People also ask

Which is better gyroscope or accelerometer?

The main difference between the two devices is simple: one can sense rotation, whereas the other cannot. In a way, the accelerometer can gauge the orientation of a stationary item with relation to Earth's surface.

When should we use accelerometer?

Accelerometers can be used to measure vibration on cars, machines, buildings, process control systems and safety installations. They can also be used to measure seismic activity, inclination, machine vibration, dynamic distance and speed with or without the influence of gravity.

What is the use of accelerometer in android?

What does an accelerometer in smartphone measure acceleration? The accelerometer is an in-built comment of a smartphone to measure its acceleration. It tracks the different motion like shaking, tilting, swinging, and rotating and accordingly change the orientation of your app.

What's the difference between a gyro and an accelerometer do I need both?

Accelerometer Versus GyroscopeAccelerometers measure linear acceleration (specified in mV/g) along one or several axis. A gyroscope measures angular velocity (specified in mV/deg/s).


1 Answers

User coverage:

Most devices have both gyroscope and accelerometer, but almost every device has an accelerometer. Especially the older devices and the cheaper ones do not have a gyroscope. Don't forget that since it is a kids app, maybe the parents don't want the little ones to use their superb 700$ tablet, and will probably use cheaper ones. Cheaper devices tend to not have gyroscopes. So +1 for the accelerometer.

User experience

The accelerometer measures acceleration in the 3-dimensional coordinate system. In most cases (when the user actually does not jump around or throw the device) the biggest part of acceleration is gravity. With gravity alone it is very easy to determine tilt and slight movements. Plus you have the Gravity software sensor to eliminate strange movements, and Linear Acceleration to eliminate Gravity. The Gyroscope detects rotation. It is more sensitive, more precise and produces events faster than the accelerometer, but it seems to be an overkill for this usecase. If you wanted to make a 3D racing game or a flight simulator It'd be a win for the gyroscope, but for a kids app it's just too much.

Battery Usage

No contest here. The gyroscope uses 3-30 times more battery (maybe more, depending on device), while the accelerometer is very gentle on the battery. Plus, for most users the accelerometer is already active (to rotate the screen automatically) so there is no sensor battery usage here. +1 for the accelerometer

Programming

Sensors are pretty easy and straightforward to implement in Android apps. Since the gyroscope detects rotation speed, it gives all 0 values if the device is left still (and maybe a little noise in the range of +-0.01rad/s), so you only need a small if block to dismiss very slight movements (e.g. when gyroscope values are less than 0.2 rad/s). With the accelerometer, you need some extra calculations to determine the orientation of the device and which axis is actually the one that needs more attention to determine the direction of movement. It's not hard to do, but it does add a few extra lines of code and some extra debugging to your line of work. +1 for the gyroscope.

Conclusion

For a simple kids app, accelerometer is the way to go. I wouldn't think about it any more. Since you don't care much about precision, you actually eliminate the points gained by the gyroscope.

like image 123
foibs Avatar answered Sep 19 '22 10:09

foibs