04 March 2012:
I know this is quite rough, but I figured I'd mish-mash something together since a few people in real life have asked me about the project and I figure I owe them an explanation with photographic evidence. The pictures are fuzzy and Google sites doesn't let you set custom sizes, but if you click on them you should be able to pull a CSI and "zoom in an enhance".
Having trouble keeping those New Year's resolutions? Hate the idea of wasting time exercising when you'd rather be wasting time on Facebook? The solution? A treadmill desk! The concept isn't new, but I figured I'd take a stab a mickey-mousing together my own take on it after reading about it on @davidelectron's (my professor) blog/Twitter feed (I can't remember which) a year or so back.
The original rig was comprised of nothing more than a wooden shelf rigged up to hold my laptop on the treadmill I picked up off Craigslist for $50. It's definitely wasn't ergonomically correct, and a loose support leg resulted in my laptop crashing to the ground after the entire treadmill fell over. Fortunately, Fujitsu Lifebooks are built like tanks and it's that same machine I'm using to write this.
Arriving home in Kelowna in September after a summer of construction madness down in Vancouver meant it was time to get Rev 2.0 up and running (pardon the pun) before winter set in. I was very fortunate to score a 38cm (15") color VGA touchscreen that work had lying around from an abandoned project, and had been trawling Craigslist for a cheap widescreen monitor for a main display since school let out. A few trips to Home Depot and many boxes of screws later I was off to the races (well, if other people had treadmill desks we could race online...)
I think that's about all I've got for now. If you have any questions feel free to shoot me an email from the "About" page.
First off: Yes I know these pictures are terrible. Almost as bad as my carpentry skills, but hey - they get the job done. Not a lot of measuring went on - it was basically a matter of cutting the chunks of 2x4 to fit and then screwing it all together. The keyboard shelf is at an incredibly painful angle to use - it is tilted the exact opposite direction it should be making actual typing difficult, but since I'm usually just surfing the net or watching movies it doesn't make much of a difference. In the photo above you can see the Shuttle PC I've strapped to the back support beam. The touch screen is mounted at an angle so it's easy to use, while the bigger monitor is at eye-level (I'm about 180cm tall) . On the right-hand side you can see the mouse tray (not used much because of the touchscreen). A Shuttle jog wheel controller I picked up at a garage sale for $5 really makes scrolling easy, even when running. An old case fan is mounted on a surround-sound speaker bracket and powered off of 12V stolen from inside the PC. You can't see it in the photo, but on the left-hand side of the keyboard tray there is a 3.5mm headphone jack so I can blast my 80's tunes and get caught up on my cat videos on Youtube (what did people DO before the Internet?).
Mounted on the side of the treadmill is the belt counter. I hacked this puppy together in all of twenty minutes, plus another five hammering out some code for the PIC12F675. Nothing too amazing happening here - the clear IR LED on the right shines a light on the treadmill belt, onto which I have spray painted a white square on one edge. The voltage on the photodiode on the left is amplified by an LM385 op-amp before being read by the PICs' ADC. The circuit could probably be re-jigged to get away without the op-amp, but I wanted to have a nice clean signal for the PIC to read and didn't want to spend more than a half-hour doing so. Once the value read by the ADC is above a certain threshold value the PIC sets one of its GPIO pins high for 5ms and then low for 200ms. This is slow enough for the DAQ card to read but still fast enough to make sure there's no chance a belt rotation will be missed. If you have some strange phobia of microcontrollers you could easily get to the same place with a few opamps, a comparator, and a 555 timer - but that would involve parts that weren't already sitting on my desk at the time.
Since the circuit was ad-libbed (ad-labbed?) I don't have a schematic. If you Google "Photogate Circuit" I'm sure you'll come up with plenty of workable examples to get the IR diode portion worked out. The IR diodes that I used came from my parts bin, but any pairing of a photodiode and an IR LED should work as long as they're biased correctly and they're both tuned for the same wavelength. I believe most TV remotes use didoes in the 940nm-range, so chances are that's what I used as that's probably where these came from originally.
The code for the PIC was written in CCS C and is attached at the bottom of the article. Again, nothing earth-shattering. The "if (value > 10)" statement compares the ADC value from the photodiode and switches the output accordingly. The magic "10" was determined empirically and will vary depending on the sensitivity of the diode, the reflectivity of the square on the belt, etc. If you use silver spray paint instead of white you can probably get away with a higher threshold value and skip the op-amp.
The counter output of the photogate is fed into one of the pulse inputs on this Velleman K8055 USB DAQ card I've had sitting around since the Skills Canada competition back in 2011. The card is connected to the PC and a simple VB (yeah - I know) app uses some the length of the belt and some Grade 5 math to turn the pulses from the photogate into a distance reading. The card came with example programs in VB, C#, and Java, and I am ashamed to admit that of the three I am most familiar with VB forms from past work experience. One day I'll get around to coding my own program that also logs the distance I run in a spreadsheet so that when my doctor tells me to exercise more I'll have some data to hide behind, but until that day I have a convenient read-out of the distance traveled in the task bar, and that's better than nothing.
A few photos of the original rev are on my blog.
A word on safety and breaking expensive things:
Don't fall off your treadmill desk or kill yourself trying to make one. Most people would argue that treadmills are safer than other exercise equipment, but that doesn't mean you can't get hurt. Use your common sense, and if you hurt yourself it's YOUR fault, not mine. Computers, monitors, and other electronic kit is expensive. If you break your (whatever) trying to screw it on to your treadmill that's your problem, not mine. I didn't tell you to do it, I told you what I did. Capiche?