# Beer Pedometer

Seeing the Nike+iPod fitness tools collaboration reminded me of a project I made a few years ago, the Beer Pedometer. Whereas the Apple system motivates athletes by providing a fitness history and goals (as well as providing yet another platform for flogging music) the Beer Pedometer provides motivation by calculating your energy expenditure and displaying the equivalent quantity of beer that you may consume after your run to correct the deficit. This was built using the STM Primer evaluation device which was released to showcase the STMicroelectronics STM32 series of ARM based processors. Amongst other things these contain a 128×128 colour screen and a three-axis accelerometer. It is this accelerometer that is used to count steps by looking for the rapid changes in vertical acceleration characteristic of walking. The Beer Pedometer was submitted to the 2008 STM32 design contest and somehow took 7th place. The display shows the number of pints earned, current power output (80W),  energy expenditure so far (1061.6kJ*) and the number of steps taken so far (434). The measurement in green is your current metabolic equivalent rate (MET) value which is the ratio of your current metabolic rate to your resting rate. In the display shown it is 1.0, the resting rate. This is defined as 1.1622 W/kg (Watts per kilogram of bodyweight). The MET value of common activities has been calculated for the ‘average’ person; sitting is 1.0, slow walking is 2.9 , fast walking is 4.8 and so on.

In order for the device to calculate your energy consumption it first calculates your current MET value. By entering your stride into the app and counting the number of steps taken per second your speed can be  calculated. From that your current MET is obtained from a lookup table. From this your power output can be calculated using the formula:

W = 1.1622 * m * MET

Where ‘W’ is the power in Watts and ‘m’ is your mass in kg. Cumulative energy consumption can be calculated by multiplying W by the time in seconds (Watts = Joules per second). A pint of bitter typically contains 753kJ so the number of equivalent pints can be calculated and displayed. Given my colossal bulk of 70kg, I consume 1.1622 * 70 ≈ 81Watts just by sitting here writing this blog, so I don’t actually have to move in order to earn beer. I can just wait…

*1 Joule ≈ 0.239 calories

The STM Primer development board is powered by a NiMH battery and includes a 128×128 colour screen, accelerometer, two LEDs, a buzzer and a button. It also exposes the processor’s unused GPIO lines so you can attach external hardware. There’s a USB port under the processor’s control so you can implement HID and mass storage class devices. Programming is done in ‘C’ and is achieved over a second USB port to a host PC running a free cut down version of the Raisonance ‘RIDE’ IDE. You can also program this from Linux using OpenOCD and GDB.