Monday, May 12, 2014

Internet of Treadmill(s) part 1.

So, yeah... It's been about a year and a half since I updated my blog...

Sorry. I took a year off from most of my hobbies to get my health back on track. I've been pretty successful in this regard, having lost a maximum of 120# and changing all of my medical indicators from "OMG! You're gonna die" to "pretty good for an old guy" or in some cases "optimal".

I also took up running as a new hobby and went from jogging for 30 seconds and dieing in a sweaty gelatinous mass to a sub 30 minute 5k and a sub-hour 10k. (yeah, not signing up for the Olympics quite yet, but still... I'm old, leave me alone! (And you kids get off my lawn!))

So, all in all a pretty good year.

Anyway... Enough of that.  I'm back and now it's time for another project!

You've heard of the "Internet of Things"...

Now it's time for...

(drum roll)

The Internet of Treadmills! (dun, dun, duuunnnn...)

Unlike most runners, I love my treadmill. It is a love born of the unfailing support it gave me when I was 288# when I started running c25k on the poor thing. How many of these wimpy "things" people are networking together can take that kind of abuse? None! I tell you!

Now, my treadmill has one glaring omission. The quick speed settings only have even numbered speeds. So, going 2, 4, 6, 8, 10, or 12 mph can be accomplished using a single button. But going 7 mph involves clicking the 6 mph button and then clicking the + button 10 times.

Which, really, isn't the worst thing that has ever happened to me. But you know... Clearly, this had to be upgraded. :) And buying a more completely equipped treadmill is not an option - I love my treadmill, and you don't just swap out things you love because they don't have enough buttons.

So, like anyone would do, I hit the Internet and bought some parts:
  • Raspberry Pi - I had this sitting around since it was released. So, rev 1 with no screw holes.(grrr) Running Raspbian. This will be the controller - it's excessive.
  • 8 port relay board - optically isolated and rated to 10 Amps at up to 250 volts - also excessive :)
  • tiny wifi module for the Raspberry Pi
  • a bunch of ribbon cable
  • node.js - will provide a REST API to control the GPIO pins (part 3)
  • Apache - Main web server, will have some sort of pretty interface (part 3+ - I have a bunch of plans for this) with AJAX calls to the REST API
  • Some cheap 8 inch tablet off of for the control panel.
So, in a nutshell, that's the plan. (bwah ha ha ha!)

Tonight, after a bit of disassembly and some crappy soldering:

The treadmill is now fully wired for phase 1.

From these 2 ribbon cables, I can control:
  • Incline, in steps of 2% (from 2% to 8%)and +-0.5%
  • Speed, in steps of 2 mph (from 2 mph to 12 mph) and +-0.1 mph
  • Start and stop
Now, I only have 8 ports on my current relay board, so I'll have to make some choices on what to control for now. Future plans include increasing this to 16 ports, changing out or expanding the rPi (I'll need more accessible GPIOs) and adding some additional sensors (speed via Hall effect and temperature at least), probably an RTC, maybe fan control too, maybe integration with a TV (I have a little HDMI injector thingy from Chumby that has been looking for a purpose for some time - maybe it should become a heads-up display driver), BLE for interface or HR monitor?, NFC authentication?, camera? (is it still a "selfie" if it's taken automatically?), audio interface for mid-workout heckling?, etc).

So, Phase 1 of Phase 1 is done. :) Stick around and I'll be posting more soon - probably wiring up the rPi and the relay board by the end of this weekend. The week after probably v0.1 of the control software.

Unmarked ribbon:
Brown = common
Red = 2 mph
Orange = 4 mph
Yellow = 6 mph
Green = 8 mph

Blue = 2%
Purple = 4%
Grey = 6%
White = 8%
Black = common

Marked ribbon:
Yellow + Orange = Start
Brown + Red = Stop

Black + White = up (White+red)
White + Grey = down (Black+red)

Blue + Purple = up (White+red)
Blue + Green = down (Black+red)

No comments:

Post a Comment