Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone : Does a rapidly updating (60Hz) accelerometer drain battery?

I'm making an accelerometer-based app using cocos2d, and I noticed that it's possible to set the accelerometer update interval.

[[UIAccelerometer sharedAccelerometer] setUpdateInterval: (1.0f / 60.0f)];

Is updating the accelerometer very often like this (60 times a second) a significant battery drain?

like image 315
Johannes Jensen Avatar asked Jun 25 '10 21:06

Johannes Jensen


People also ask

Why is the new iOS update draining my battery?

Battery life tends to take an initial hit when new OSes are rolled out because updates to software and apps, as well as the reindexing files, photos, and other functions, taxes the processor, and thus, the battery.

Why is my battery draining so fast after update?

Here are some of the most common ones: There are too many push notifications and alerts draining the battery. There are too many apps running location services. There are too many apps running in the background.

Does iOS 16 Drain iPhone 11 battery?

If you updated to iOS 16 this week, you might notice your iPhone's battery draining faster than you remember before you got Apple's latest update.

How do I drain my iPhone battery quickly?

Open up all/most of your apps. As long as you don't clear them from your phone's memory, this will drain your phone's battery quickly, especially if you have a lot of apps! For example, on an iPhone, if you click on your home button twice, you can slide the apps away-- this is clearing them from your memory.


3 Answers

Given the numbers in the accepted answer the power usage by the actual accelerometer is trivial. Your real hit will come from your app having to process the events and thus making the CPU not sleep more often.

The 3GS has a 4.51 Watt hour battery. Drain from only the accelerometer when running at 100 hz would kill the battery in (roughly) 6000 hours (assuming the 0.75 mW value is correct)

(Also, the iPhone 4 has a 5.25 Watt-hour battery, 4S 5.3 Whr and 5 5.45 Whr, in case you're curious)

like image 67
Donnie Avatar answered Oct 19 '22 23:10

Donnie


According to the LIS302DL accelerometer data sheet, it consumes ~0.75 mWatts of power at an update rate of 100Hz, and 0.0025 mWatts of power when in stand-by mode (i.e., no readings taking place).

So, the short answer is "Yes", but off the top of my head, I can't put those numbers in perspective to give you an idea of, say, "how many minutes of on time" it drains from the battery.

My recommendation would be to do a bit of testing. Find the lowest update rate that provides satisfactory results.

like image 29
johne Avatar answered Oct 19 '22 23:10

johne


From the Event Handling Guide for iPhone OS:

When configuring the update interval for acceleration events, it is best to choose an interval that minimizes the number of delivered events and still meets the needs of your application. Few applications need acceleration events delivered 100 times a second. Using a lower frequency prevents your application from running as often and can therefore improve battery life.

According to this, the more expensive part of having a high update frequency may be the fact that your application has to process each of those accelerometer events, rather than idling for a longer period.

Also, from the iPhone Application Programming Guide:

If you use the UIAccelerometer class to receive regular accelerometer events, disable the delivery of those events when you do not need them. Similarly, set the frequency of event delivery to the smallest value that is suitable for your needs.

like image 31
Brad Larson Avatar answered Oct 20 '22 00:10

Brad Larson