Android accelerometer: Sampling Rate?

pxm picture pxm · Jul 15, 2013 · Viewed 25.2k times · Source

I want to

[1] Increase Sampling Rate of my phone's accelerometer. (SENSOR_DELAY_FASTEST gives max. about 100Hz on Xperia/ 180Hz on Nexus4, I want delay to be about 1ms or less for my work.

[2] If [1] not possible can i make Rate constant.

mSensorManager.registerListener(this, mAccelerometer,10000);//10000 in microsec

Above code doesn't give me 10ms delay. I know it's only a suggestion to Android.

I know These accelerometers inside phones are capable of giving much smaller delay. It's mentioned in their datasheets. So is their any method or driver/ADC programming to do [1] or [2]. I'm using ADT tools. Any other tool to do this?

P.S: I've read

Android: How to increase Accelerometer Sampling Rate?

Impossibility to change the rate of the accelerometer

Answer

user3248182 picture user3248182 · Jan 29, 2014

From developer.android.com :

The data delay (or sampling rate) controls the interval at which sensor events are sent to your application via the onSensorChanged() callback method. The default data delay is suitable for monitoring typical screen orientation changes and uses a delay of 200,000 microseconds. You can specify other data delays, such as SENSOR_DELAY_GAME (20,000 microsecond delay), SENSOR_DELAY_UI (60,000 microsecond delay), or SENSOR_DELAY_FASTEST (0 microsecond delay). As of Android 3.0 (API Level 11) you can also specify the delay as an absolute value (in microseconds).

But you should know the absolute value you specify in microseconds is only a suggestion to Android.