Changes in accelerometer / gyroscope limitations for iPhone 5 / 5th Gen iPod Touch?

17,829

Solution 1

I was testing techBASIC on an iPhone 5 and noticed an anomaly that led me to this discussion. Apparently the accelerometer in the iPhone 5 is set to the 8G range! While I can't find any references to confirm it, techBASIC's accelerometer demo showed this when I shook the iPhone 5 up and down:

Plot of Acceleration on an iPhone 5

That's pretty exciting for physics applications. I used a SensorTag to measure the acceleration in a model rocket because it has an optional 8G range, and the iPhone did not--you can now dispense with the SensorTag and just use the iPhone.

http://www.youtube.com/watch?v=8YNjwcNXOK4iPhone Rocket

Solution 2

Of the reading I have done you usually have 2-3 choices when determining what min/max readings an accelerometer will read. 2G is an extremely common choice for accelerometers because the next step (8G) is usually to coarse a reading to get the fine measurements needed when working with a hand movement. If you were dropping it off a building to measure the force of hitting the ground you would want to use the 8G (or 16G as some offer).

It looks like the Hz is intentionally capped at 100Hz according to the folks at Corona Labs. It is to keep from abusing the battery apparently. I had read that the accelerometer is the least power hungry sensor but I guess it's all relative or there is a sharp increase in power use at some point around 100Hz.

Solution 3

To help answer the other half of your question, I am using an iPad Mini and when I use Warren Whipple's suggestion, I find that the accelerometerUpdateInterval and gyroUpdateInterval would be reset to 0.01 immediately if I set them to any lesser value.

However, when I run diagnostic tests on the device I find that the real rate at which the accelerometer or gyro data is updated is closer to 0.02 s, i.e. if I set the accelerometerUpdateInterval to 0.01 s and query accelerometer data at 0.01 s, I get a unique reading on every other fetch, but if I set it to 0.02 s (or query at 0.02 s) then I get unique reading on every fetch.

Share:
17,829

Related videos on Youtube

Warren Whipple
Author by

Warren Whipple

Updated on June 04, 2022

Comments

  • Warren Whipple
    Warren Whipple almost 2 years

    Back when the iPhone 4 and 4th Generation iPod Touch came out, I was toying around with Apple's Core Motion sensor fusion algorithms to see if I could get any interesting results for very local dead reckoning (over the range of a few inches or feet). I didn’t expect anything spectacular, given the relatively low specs of the MEMS sensors. And although Apple’s CMDeviceMotion gravity property uses a decent (though opaque) sensor fusion algorithm, the complementary userAcceleration property isn’t exactly targeted at dead reckoning. Still, I thought there might be enough there to have a bit of fun.

    The iPhone 4, iPhone 5, 4th Gen iPod Touch, and 5th Gen iPod Touch all apparently use the STMicroelectronics LIS331DLH accelerometer and L3G4200D gyroscope. (Actually, I haven’t seen the part number for the iTouch-5 gyro yet, so it could be different.)

    Teardowns: iPhone-4, iTouch-4, iPhone-5, iTouch-5

    The ST specs show that accelerometer could sample at 1000 Hz up to ±8g. And that gyroscope could sample at 800 Hz up to ±2000 dps.

    Specs: LIS331DLH, L3G4200D

    But, playing with my 4th Gen iPod Touch (both iOS 5 and iOS 6), I can only crank the sampling rates up to 100 Hz. If I set CMMotionManager deviceMotionUpdateInterval any lower than 0.01, it automatically resets to 0.01. Same for accelerometerUpdateInterval and gyroUpdateInterval.

    Further, the accelerometer output always seems to be capped at about ±2g.

    I've seen others remark on similar bounds for the iPhone 4.

    Both these bounds severely limit the local acceleration calculations I can squeeze out the device (experimenting with my 4th Generation iPod touch). I presume Apple has set these bounds low to reduce power consumption. Though I don’t know if they’re set in the hardware, or in iOS somewhere.

    Has anyone played with these accelerometer and gyroscope bounds on the iPhone 5 or 5th Generation iPod Touch? (Or any iPads for that matter?) Any sampling rates higher than 100 Hz? Any accelerometer measurements outside the bounds of ±2g?

  • Warren Whipple
    Warren Whipple over 11 years
    On range: The detailed accelerometer specs (LIS331DLH datasheet pdf p9) show range is set ±2g/±4g/±8g. Swinging it around, I easily exceed 2g. Remember, the accelerometer always feels gravity, so you only need impart 1g to hit the 2g limit. I think ±4g would be the most useful for my purposes (dead reckoning). Switching to ±4g should only halve the sensitivity, right? That doesn’t seem so bad… I suppose it could interfere with iOS monitoring the device orientation.
  • Warren Whipple
    Warren Whipple over 11 years
    On power consumption: If I’m reading the accelerometer specs correctly (LIS331DLH datasheet pdf p10), power consumption only varies across "low-power mode" (10 µA) vs "normal mode" (250 µA). Low-power mode output is set from 0.5 to 10 Hz, while normal mode output is set from 50 to 1000 Hz. Since Apple allows 100 Hz, bumping it up to 1000 Hz should cost no more power. The detailed gyro specs (L3G4200D datasheet pdf p11) show only one active power consumption mode (6.1 mA).
  • BluMo.us
    BluMo.us over 11 years
    :) I was not trying to defend the arbitrary decisions as I do not understand them either but I thought you would like the info. I did try to find a way to adjust the settings through iOS but I couldn't find anything. When working with Arduino or other micro-controllers it is too easy to setup a sensor to allow changes to these settings programatically (on the fly) to believe they are hardwired. Please let me know if you find a way to change them even if it is something you need an unlocked phone to execute. I'll do the same for you.
  • Warren Whipple
    Warren Whipple over 11 years
    Sorry. Didn't mean for that to come off as a rebuttal. :) I did find this stackoverflow thread, where someone claims they were able to change the accelerometer range to ±8g on their jailbroken iPhone with third party software. No follow up on exactly how, though.
  • BluMo.us
    BluMo.us over 11 years
    Well, I will keep looking for a better answer. I'm not sure they would let us change the frequency if it was set to limit battery use but like you said above changing the min/max to 4G seems very reasonable. Especially seeing as how most applications are only using the accelerometer to determine orientation and 2, 4, or 8G would do that with equal precision, I would think. And you make a really good point about 1G being needed just to overcome Earth's gravity. Anyway, I'll spend some time and let you know if I find anything worthwhile.
  • BluMo.us
    BluMo.us over 11 years
    If you have that app you wrote for the iPhone 4 & it outputs to something I could post (or email, whatever) I would be happy to put it on my wife's phone and shake it about to see what's up.
  • Warren Whipple
    Warren Whipple over 11 years
    Sure! You can check accelerometer range with Apple's AccelerometerGraph sample code. To check the update interval caps: Link CoreMotion.framework. Import CoreMotion.h. Run anywhere: CMMotionManager *mm = [[CMMotionManager alloc] init]; mm.accelerometerUpdateInterval = 0.001; mm.gyroUpdateInterval = 0.001; NSLog(@"%f, %f", mm.accelerometerUpdateInterval, mm.gyroUpdateInterval);. I get both reset to 0.01 immediately.
  • BluMo.us
    BluMo.us over 11 years
    I apologize for offering and then having to tell you to wait but I have to travel for work and will not be back until Tuesday. I'll try it then though. B
  • cjensen
    cjensen over 11 years
    so did anyone findout the config of the chip? my findings are that iphone 5 displays far higher g for some reason. a drop from chair gives around 3 on iphone 4 but around 7 on iphone 5 very strange
  • Warren Whipple
    Warren Whipple over 11 years
    That great, and answers half my question! Thanks! Would you be interested in checking whether the caps on accelerometerUpdateInterval and gyroUpdateInterval have been bumped up from 100Hz? An easy way to check is explained in my comment here.
  • Mike
    Mike over 11 years
    No, at least not with the motion manager. I'm getting update rates of about 0.02 seconds per sample, sometimes a bit faster, but nothing like a reliable 100 MHz rate. There are a lot of ways to sample the accelerometer, though. You may be able to coax a bit more out of it.