Last winter the Red Hat video team came to my house to record some footage for both internal and external use. On one of the internal videos they look at my home automation system, point the camera at a wall tablet, and figure out that I'd not used my treadmill in over two years. So there were really two options (1) remove the year from the display so it would never look like we were slacking for more than a year, or (2) find a way to get motivated again.
Recently we both started using Twitter, so it seemed like a natural progression to hook the treadmill to twitter and have it publicly embarrass us for slacking off.
We called it 'twedmill' ('tweadmill' perhaps is more correct, but just sounds like a factory that weaves twead jackets). Here is how it works:
The treadmill itself is pretty standard; it's from Trimline and has a fancy
computer. When I looked inside and saw a PIC I was tempted to interface direct
to the computer, but didn't really have the time to get around to that.
Although the treadmill does things like have a variable incline and measurement of heart
rate, all I really care about it making sure we were using it, for how long,
and how far we got.
Under a cover in the base are the PWM controllers, motors, and the belt drive to the treadmill deck. The treadmill itself measures the belt speed by having a single magnet on the wheel and a small sensor next to it, one revolution giving one pulse. So to keep things simple I just hot-glued a spare reed switch I had around so the same magnet would trigger it. The reed switch happily copes with the treadmill even on top speed, so no real need for anything more fancy.
I didn't have anything that could accurately measure the diameter of the roller, so
by counting pulses at various speeds and comparing to the onboard
display it worked out at 8122 pulses/revolutions per (uk) mile (so that's
about 198mm of travel per pulse, making the diameter of the
roller about 63mm).
I use a 1-wire network in the house to measure temperatures, watch the doorbell, and control the central heating system, so I wanted to use the same system to deal with the treadmill. So the reed switch connects to a DS2423 counter (Unfortunately it seems the DS2423 is discontinued now). The DS2423 was only available in a surface-mount package, so I found some converters on ebay to save having to design a PCB just for three components. The DS2423 connects into a 1-wire hub in node0, then to a 1-wire USB adapter on our main server, currently running Fedora 10.
The software used in based on the source code from 'digitemp'
as it includes
cnt1d.c to read the counter values. Every ten
seconds the jabber treadmill bot switches to the right network segment
on the 1-wire hub then polls the counter of the DS2423 to see
if the treadmill has moved. Once the treadmill has stopped moving for
a while the software stores the total distance travelled and time in
a database, sends an email, and uses the perl Net::Twitter module to
post a mesage to twitter. (It can also draw a graph showing speed over
time, but that turned out to be not very interesting)
For the future I'd quite like to hook directly into the treadmill computer, perhaps giving two way control of the treadmill programs, as well as recording the incline and heart rate. Another idea has been to use the current treadmill speed to decide which music video to play next based on bpm (the tv is connected to an old XBOX running XMBC so could easilly be remotely controlled to switch videos). Or perhaps link it to google streets for a virtual jog through some random town. Finally, you currently have to select who is using the treadmill before (or very quickly after) using it using the touch panels in the house; which seems like a good excuse to play with some RFID in our shoes, perhaps also using that to select a playlist of music videos per person.