Monday, November 12, 2012

Android accelerometer sampling rates

An app I'm working on relies on quick spikes in accelerometer activity, like fractions of a second, so I have to have a pretty fast accelerometer. Android lets you specify accelerometer sampling rate, kind of: you can choose SENSOR_DELAY_NORMAL, SENSOR_DELAY_UI, SENSOR_DELAY_GAME, or SENSOR_DELAY_FASTEST. Then the phone will try to give you samples at a rate that works for your app.

On NORMAL, my Nexus S gives me about 7Hz. Not at all fast enough. On UI, GAME, or FASTEST, I get about 49Hz, which is almost fast enough. So I gave some friends a little test app which determined their phone's FASTEST sample rate and here's what I found (readings in Hz):

Motorola Droid X: 5.19
Motorola Droid X2: 6.23
ZTE Blade: 9.11
HTC Nexus One: 24.86
HTC Evo 4G: 37.54
HTC Wildfire: 38.40*
HTC Desire: 47.27*
LG Nexus S: 49.44
Samsung Galaxy S3: 93.98
Motorola Atrix: 94.32
Sony Ericsson x10 Mini: 94.77**
Samsung Galaxy S2: 96.03, 97.5
Samsung Galaxy Nexus: 99.8
Samsung Note II: 100.0
Samsung Galaxy S3: 100
Samsung Galaxy Teos: 109.42*
LG Nexus 4: 198

(* from this stack overflow post)
(** from this slideshow, slide 13)

Want to add a reading? Here's how:
1. Enable installation of apps from unknown sources (Settings -> Security -> Unknown Sources)
2. Download this app
3. Tap "start", wait 5 seconds, and post (in a comment) which phone you have and what reading you get.
Edit: thanks all for adding to this! If you're looking for some other phones, check out the comments below.

30 comments:

  1. Motorola Droid X: 5.06, 5.67, 3.98, 7.15, 4.11

    ReplyDelete
  2. Motorola Droid X2: 6.93, 5.47, 3.98, 9.98, 4.79
    HTC EVO 4G: 38.90, 34.98, 37.15, 36.77, 39.90

    ReplyDelete
  3. Samsung Galaxy SII (tmo): 96.10, 95.56, 95.45, 97.00, 96.05

    ReplyDelete
  4. Nexus 1: 25.15, 24.7, 24.79, 24.69, 24.98

    ReplyDelete
  5. Oh great, this was exactly what I was looking for!

    ZTE Blade: 8.84 9.54 8.97

    These results are perfectly in line with what I've been getting with my own code on the same phone. It must be the phone that's slow and not my code.

    ReplyDelete
  6. HTC One X: 44.68, 43.47, 43.98

    ReplyDelete
  7. samsung galaxy s i9000 65 (Hz?)

    ReplyDelete
  8. Would it be possible to get you Source Code for the AccelerometerTest.apk?

    If so, please send it to me at: troels@siggaard.com

    Thanks!

    ReplyDelete
  9. Have you guys tested the Motorola Droid Razr Maxx

    ReplyDelete
  10. The program doesnt work on SE Xperia Ray
    Just shows Working...
    And nothing happens.

    ReplyDelete
  11. Acer Liquid Glow E330: 10

    ReplyDelete
  12. Hi Dan, thanks for the post,
    its a bit late, but here is your Nexus 4 data! ;)

    Google L-Ge Nexus 4: 198.84, 198.60, 198.80, 198.64, 198.88

    Kind regards

    ReplyDelete
  13. Thanks for the post.
    Samsung Galaxy S3: 100.08 100.04 99.96 100.04 100.00

    ReplyDelete
  14. HTC One (M8): 97, 98.4, 98.02, 98.28, 97.62

    ReplyDelete
  15. samsung galaxy s5: 100.28, 100.52, 99.76

    ReplyDelete
  16. Nexus 5: 201.8
    HTC One (M8): 99.92
    HTC One X: 100.26

    ReplyDelete
  17. Oneplus 2 (Model A2003): 199.00, 199.12 (Usually achieves 199.12)

    ReplyDelete
  18. It is not giving any output after starting
    Working .....
    what should I do?

    ReplyDelete
    Replies
    1. Sorry to hear that. Unfortunately, I'm not supporting this app anymore. (I barely know how it worked in the first place :P You're welcome to debug it to figure it out (code's linked above).

      Delete
  19. Galaxy S7: from 99.94 to 100.12 but values can fall significantly as low as 9.01 when doing thing in the background like closing/starting other apps.

    ReplyDelete
  20. Xiaomi Mi Max 2: 198.00

    ReplyDelete

Note: Only a member of this blog may post a comment.