14

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?

1
  • A bit of clarification on the above: Before I found the 100 Hz and ±2g limits on the iTouch-4. I found these through experimentation. Others said the same of the iPhone-4. My question: Has anyone experimented with the iTouch-5 or iPhone-5 or iPads and found the same limits? Or different limits? Oct 23, 2012 at 12:56

3 Answers 3

6

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.

9
  • 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. Oct 22, 2012 at 20:27
  • 1
    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). Oct 22, 2012 at 20:30
  • :) 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.
    – BluMo.us
    Oct 23, 2012 at 11:51
  • 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. Oct 23, 2012 at 12:39
  • 1
    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. Oct 24, 2012 at 3:33
3

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

2
  • 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. Jan 30, 2013 at 15:44
  • 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.
    – Mike
    Jan 31, 2013 at 22:18
2

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.

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