Accelerometers
Accelerometers, made abundant and affordable by the cell phone industry, are one of the most common sensors found in embedded devices these days. As their name implies, accelerometers sense acceleration, in one, two, or three axes. This is useful for things, such as pedometers, as you can sense the vibrations from a footstep, and they can also be used for sensing orientation by measuring the acceleration due to gravity on the different axes.
Hooking it up
Let's take a look at interfacing with the analog devices' ADXL345 accelerometer. It can measure acceleration about three axes on a configurable scale of +/- 2 g, 4 g, 8 g or 16 g (where 1 g is the acceleration due to gravity near the Earth's surface, equal to about 9.8 m/s2) about three axes. Both SparkFun and Adafruit sell breakout boards for the ADXL345 (https://www.sparkfun.com/products/9836 and http://www.adafruit.com/product/1231). We'll demonstrate with the SparkFun board, but the Adafruit board will function just the...