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.

Saturday, December 22, 2012

"Life" on Canvas

So, it _finally_ snowed on Wednesday.

This has been a very mild Fall.  So, I haven't been messing around with inside projects too much.

But last night I did do a little implementation of the "game" Conway's Game of Life ( in JavaScript using the canvas tag.

It doesn't do much, it's randomly seeded and the edges aren't really handled properly.

If you click on the canvas, it will unleash a glider.  :)

You can zoom with ctrl+ and ctrl- (browser zoom).

Monday, March 19, 2012

My 2¢ on bcrypt vs ___

The topic came up today "Don't use bcrypt, use this instead".

In my opinion, as a practical matter (and as a non-cryptographer), this conversation doesn't actually matter at all.

  1. Cryptographers (as a whole) rarely fully agree on anything anyway - this is no different.  
  2. No one is suggesting that bcrypt is fatally flawed, just that someone thinks there might be better options.
  3. "Use bcrypt" is perfectly good advice to give to people who were planning to:
    1. Use clear text
    2. Use ROT13 (2 rounds :) )
    3. Make up their own "crypto" (ROT13 then XOR with MAC address, etc)
    4. Use an unsalted hash
    5. Use crypt
    6. Encrypt passwords (versus hash)
    7. Use a salted hash with a globally shared salt
    8. Use a salted hash with individual salts
  4. "Use bcrypt" is still perfectly good advice even if PBKDF2 or scrypt are indeed better.
  5. bcrypt is (thankfully) becoming quite widely available.  And some people are even using it! :)

At the end of the day - you can modify your message to be, "Use bcrypt or scrypt or PBKDF2", if you really want.  But "Use bcrypt" is still perfectly valid advice.