Accelerometers
May 27th, 2012 at 9:28 pm by Dr. Drang
Gabe linked to this recent video by Bill Hammack in which he talks about the workings of the accelerometers in our smartphones. You may have also seen it on Boing Boing.
This is one of his best videos. It’s an especially good introduction to how silicon etching is used to create tiny machines.
But…
But if you didn’t know better, you’d get the impression that the purpose of the accelerometers is to determine a device’s static orientation. And although they can do that, the true purpose of accelerometers is to measure—no surprise here—acceleration, a distinctly dynamic quantity.
I understand why Prof. Hammack stuck with statics. It’s easier to explain in a short video, where you really can’t get into the differential equations of motion. Lucky for you, I don’t feel any such constraint here.
Let’s start by simplifying the problem. Your phone (and your Wii controller, I believe) have three accelerometers oriented at right angles to one another. We’re going to study the behavior of just one accelerometer. Once you understand the behavior of one, extending it to three is easy.
Accelerometers can be made in many different ways, but they all have three essential parts:
 A mass that can move relative to the accelerometer’s housing.
 A spring that connects the mass to the housing.
 A damper that dissipates energy and keeps the springmass system from vibrating forever.
Conceptually, at least, they all look like this:
where
 [m] is the mass of the moving block.
 [k] is the stiffness of the spring.
 [c] is the damping constant.
 [x] is the position of the moving block relative to an inertial (stationary) frame of reference.
 [y] is the position of the housing relative to the same inertial frame.
While this doesn’t look like the accelerometer Prof. Hammack is demonstrating, it is an abstraction of all the important features. If you go back and look at the video, at about 1:40 you’ll see this drawing of the accelerometer:
The “seismic mass” is the moving block; the four arms at the ends of the block act as the springs; and the position of the block relative to the housing, equivalent to the difference [x  y], is monitored through the capacitance of the green and blue “fingers.” Not shown explicitly is friction, which acts as the damping on the system.
Let’s assume the housing is being shaken back and forth in a sinusoidal motion:
[y = Y \sin \omega t]where [Y] is the amplitude of the motion, and [\omega] is its frequency^{1}.
The motion of the moving block is governed by this differential equation:
[m\ddot{x} = c(\dot{x}  \dot{y})  k(x  y)]Borrowing some notation from Isaac Newton, we’re using dots to represent differentiation with respect to time. [\ddot{x}] is the acceleration of the block relative to the inertial frame. The damping force is proportional to the rate of extension of the dashpot, [(\dot{x}\dot{y})], and acts opposite to its direction. The restoring force is proportional to the extension of the spring, [(xy)], and acts opposite to its direction.
Solving the equation is easier if we rewrite it in terms of the motion of the mass relative to the housing,
[z = x  y]which gives us, after differentiating the expression for [y] and a little algebraic rearrangement:
[m\ddot{z} + c\dot{z} + kz = m\ddot{y} = m \omega^2 Y \sin\omega t]The steadystate^{2} solution is a sinusoid with the same frequency as the housing. It has the compact form
[z = Z \sin(\omega t  \phi)]where [Z] is the amplitude and [\phi] is the phase angle. The phase angle, which represents how much the motion of the mass lags behind the motion of the housing, isn’t of great interest to us here, so we’ll concentrate on the expression for the amplitude,
[Z = \frac{\left(\frac{\omega}{\omega_n}\right)^2 Y}{\sqrt{\left[ 1  \left(\frac{\omega}{\omega_n}\right)^2\right]^2 + \left[2\zeta\frac{\omega}{\omega_n}\right]^2}}]where
[\omega_n = \sqrt{\frac{k}{m}}]is the natural frequency of the system, and
[\zeta = \frac{c}{2\sqrt{km}}]is the nondimensional damping coefficient or damping ratio.
Here’s a plot of the amplitude equation (after normalizing by dividing both sides by [Y]) for a few values of the damping ratio.
You were probably expecting to see those peaks near [\omega/\omega_n = 1]; that’s the condition known as resonance. What you may not have been expecting is to see [Z/Y] tend toward [1] as [\omega/\omega_n] increases. What this means is that if the shaking frequency, [\omega], is much higher than the natural frequency, [\omega_n], the amplitude of the response will be, for all practical purposes, equal to the amplitude of the shaking.
This is the behavior of a seismometer, which is built to measure ground displacement during an earthquake. Seismometers need to have a very low natural frequency, so they’re made with relatively large masses and flexible springs. During an earthquake, the seismometer’s housing shakes with the ground, while the mass inside remains practically motionless due to its large inertia and flexible connection to the housing. The relative motion between the mass and the housing, therefore, is a good measure of the ground displacement.
That’s all very well and good, you may be saying, but we were supposed to be talking about accelerometers, not seismometers. True enough. Let’s rearrange the equation for [Z] slightly:
[\omega_n^2 Z = \frac{\omega^2 Y}{\sqrt{\left[ 1  \left(\frac{\omega}{\omega_n}\right)^2\right]^2 + \left[2\zeta\frac{\omega}{\omega_n}\right]^2}}]What makes this rearrangement interesting is that the numerator of the right hand side, [\omega^2 Y], is the amplitude of the acceleration of the housing. Recall that
[y = Y \sin \omega t]Differentiating this twice with respect to [t] gives
[\ddot{y} =  \omega^2 Y \sin \omega t]so [\omega^2 Y] is the amplitude of [\ddot{y}]. (The minus sign just means that the acceleration of the housing is 180° out of phase with its displacement.)
Let’s normalize the equation by dividing both sides by [\omega^2 Y] and plot the result, this time for small values of [\omega/\omega_n]:
We see that [\omega_n^2Z \approx \omega^2Y] for small values of [\omega/\omega_n]. This is the key to the design of an accelerometer. If we make our springmassdamper system with a relatively small mass and stiff spring, we’ll get a high [\omega_n], and if the shaking frequency of the housing is low compared to that, the displacement of the mass, [Z] will be proportional to the acceleration of the housing. We can measure the displacement of the mass within the housing (using the capacitance change Prof. Hammack talked about), multiply it by the known natural frequency of the accelerometer, and we end up with the acceleration of the housing.
Stick three of them together in mutually perpendicular directions and you can, by combining the results vectorially, determine the acceleration in any direction.
There’s one last detail that needs to be accounted for: gravity. Gravity will cause the mass of an accelerometer oriented vertically to move downward the same amount as it would if it were in a weightless environment and accelerating up at one gee. An accelerometer permanently mounted in a vertical direction can be set up so its output adjusts for this and reports true acceleration. A phone’s accelerometers, however, can be in any orientation, so there’s no way to correct for that; they will report an upward acceleration of one gee even when they’re sitting stationary.
You can see this in a screenshot of the generically named Accelerometer app, a $1 iPhone app that displays the realtime outputs of all three accelerometers as well as the maximum and minimum values during a recording session. I had my phone sitting flat on a table when I took the screenshot, and the acceleration along the “zaxis”—which is apparently through the thickness of the phone—is reported to be about 1 gee.
This onegee offset, although it’s a false reading for acceleration, is valuable. It’s how the orientation of the phone is determined, which brings us back around to Prof. Hammack’s video. Now we see why something that’s supposed to be measuring acceleration pulls doubleduty for orientation, too.
Update 5/29/12
I discuss the Gnuplot commands used to generate the plots in this post.

This is a circular frequency and is measured in radians per second. You may be more familiar with cyclic frequency measured in Hertz, or cycles per second. These two ways of describing frequency are proportional to one another, and the proportionality constant is [2\pi] because there are [2\pi] radians in one cycle. Cyclic frequency is easier to measure, but circular frequency is easier to use in equations. ↩

Immediately after the shaking starts, there is some motion not described by this equation, but that motion quickly damps out, leaving just the simple steadystate motion. ↩
Carl says:
May 27th, 2012 at 10:41 pm
Re: the Wii remote,
The original Wii remote contained three accelerometers and an infrared sensor. The “sensor bar” you put on top of your TV is actually an IR emitter. The IR sensor in the remote looks at the TV and sees two IR dots that let it figure out its distance from the TV and where it’s pointed (after you use the accelerometer to determine if you’re inverted or not).
A few years after its initial introduction, Nintendo released a revised Wii remote called the Wii Motion Plus. This one has built in gyrosensors, to allow it to measure rotation and get a more accurate picture of where the remote is in space. The design of the gyros required the engineers to overcome a couple of different hurdles, so it wasn’t practical to release it at the same time as the regular remote…
Carl says:
May 27th, 2012 at 10:48 pm
Here’s a link to an interview with the Wii Motion Plus designers about the trouble they ran into with sensor drift and whatnot. It gets good on the second page.
Alan Schmitt says:
May 28th, 2012 at 3:17 am
Have you read Bill Hammack’s book? It looks quite interesting …
Bill Hammack says:
May 28th, 2012 at 8:40 am
What an excellent post!
Dr. Drang says:
May 28th, 2012 at 9:19 am
But the yell that always thrills me
And fills my heart with joy,
Is the good old OskeeWowWow,
That they yell at Illinois.
David says:
May 28th, 2012 at 2:33 pm
That 1G offset isn’t false. If the phone was not accelerating upwards, it would be in freefall.
Frans says:
May 29th, 2012 at 12:11 pm
Good engineering stuff.
Alan Schmitt says:
May 30th, 2012 at 3:50 am
To reply to my own question above, I’ve read the first story in the book, and it’s a great complement to the videos. Definitely worth buying it.
Dr. Drang says:
May 30th, 2012 at 8:47 am
Sorry, Alan, I thought your question was a rhetorical device to get us to take a look at the book. Which I did.
Alan Schmitt says:
May 31st, 2012 at 1:50 am
I find rhetorical questions to be too subtle for blog comments ;)
As it was only 5 €, I took the risk to buy the book (the Kindle version), and I’m glad I did. I’m impressed with the legibility of the schematics by the way (unusual for a Kindle book).
Alan says:
May 31st, 2012 at 11:03 am
Nice writeup. From high school physics we explored this effect using a slinky. If you hold the slinky from the top and let it extend downwards then your hand is y, the bottom of the slinky is x (and z is the distance between them). k, c, and m are intrinsic to your particular slinky.
As you move your hand up and down (at the frequency you desire) you can see and feel the response of the slinky.
Move your hand slowly and the slinky moves with you without any change in extension (so Z is 0 with no change in xy).
Move your hand very rapidly and the bottom of the slinky stays where it was and your hand moves (so Z is 1 with xy being the motion of your hand).
Move your hand at just the right speed and the slinky leaps up and down at resonance.