Update intervals for startDeviceMotionUpdatesToQueue:withHandler:

I'm creating an app that uses CMDeviceMotion to collect device-motion updates from an iPhone and Apple Watch at an update interval set by the user (varying from 20 Hz to 100 Hz). When checking the timestamps generated for each CMDeviceMotion instance, I have seen that some set update intervals does not equal the true update interval, while some are very precise. For example, setting the update interval to 0.0167 s (60 Hz) and. 0.0125 s (80 Hz) results in true update intervals of 0.019 s and 0.015 s respectively, while at 40 Hz and 100 Hz, the true update interval is as expected. So at some update intervals, it seems to round up or down to an update interval or frequency that "works"?


From the documentation, I understand that deviceMotionUpdateInterval is capped to minimum and maximum values, e.g. the maximum value is determined by the maximum frequency supported by the hardware. But what about in between? Does anyone know anything more about this?

Replies

I've got the same question, have you figured anything out over this past year?

I've also encountered the same behavior with startDeviceMotionUpdates(using:to:withHandler:) on an Apple Watch Series 6 running watchOS 10.3, Xcode 15.1.

Depending on how you set the deviceMotionUpdateInterval it seems to result in either significantly slower sampling rates or occasionally accurate or somewhat faster sampling rates.

I measured the average interval for deviceMotionUpdateInterval = 1 ... 100 hz on the Apple Watch Series 6. When inaccurate, true rates seem to be ~either 30% or 40% slower or 10% faster. I'm trying to run an FFT on the signal, so accurate sampling rates are critical. Has anyone else discovered why this is the case and whether there are any workarounds?