yeti logo icon
Close Icon
contact us
Yeti postage stamp
We'll reply within 24 hours.
Thank you! Your message has been received!
A yeti hand giving a thumb's up
Oops! Something went wrong while submitting the form.

iPhone Accelerometer Calibration

By
Tony Scherba
-
October 12, 2011

I’ve started a couple games with the great idea of using the accelerometer for the control. Most of the time these games are super fun in theory but end up becoming a nightmare because making the accelerometer play nicely with what the user expects is difficult.

An important aspect of this is calibrating the accelerometer so your code knows where the user thinks zero should be. This can be a difficult process because you have to think in 3 dimensional space.

I conducted an experiment where I held the device steady at multiple angles in landscape mode and recorded the raw accelerometer read out. Soon into the experiment it became obvious what was going on as I’m sure you’ll be able to figure out from the chart below.

It quickly becomes very clear that acceleration.x is an inverse sine wave and acceleration.z is an inverse cosine wave. I couldn’t believe I hadn’t thought of this before but it is very obvious why this happens. The constant acceleration of gravity is pushing down and so therefore by rotating the device you are essentially reading that acceleration at an angle. Naturally it creates these waves because you are moving it in a circular fashion. So now with this knowledge and your trigonometry book from high school you should be able to figure out the best way to calibrate your program for an awesome user experience.

NOTE: I’ve received quite a few requests for code snippets to explain what I’m talking about here. I am working on another follow up blog post that will include some.

Tony Scherba is a CEO + Founding Partner at Yeti. Tony has been developing software since high school and has worked on digital products for global brands such as Google, MIT, Qualcomm, Hershey’s, Britney Spears and Harmon/Kardon. Tony’s writing about innovation and technology has been featured in Forbes, Huffington Post and Inc. At Yeti, Tony works on strategy, product design and day to day operations, hopping in and working with the development teams when needed. Follow Tony on Twitter.

You Might also like...

colorful swirlsAn Introduction to Neural Networks

Join James McNamara in this insightful talk as he navigates the intricate world of neural networks, deep learning, and artificial intelligence. From the evolution of architectures like CNNs and RNNs to groundbreaking techniques like word embeddings and transformers, discover the transformative impact of AI in image recognition, natural language processing, and even coding assistance.

A keyboardThe Symbolicon: My Journey to an Ineffective 10-key Keyboard

Join developer Jonny in exploring the Symbolicon, a unique 10-key custom keyboard inspired by the Braille alphabet. Delve into the conceptualization, ideas, and the hands-on process of building this unique keyboard!

Cross-Domain Product Analytics with PostHog

Insightful product analytics can provide a treasure trove of valuable user information. Unfortunately, there are also a large number of roadblocks to obtaining accurate user data. In this article we explore PostHog and how it can help you improve your cross-domain user analytics.

Browse all Blog Articles

Ready for your new product adventure?

Let's Get Started