Controlling your Treadmill from Silverlight - Part 1

Introduction
If you are like me, you have a treadmill that sits in your garage collecting dust while you sit in front of your computer all day.  Well, it's time to drag that 350-pound waste of metal within reach of your computer so you can wire-up some bleeding-edge technology to it!  Yes, we are going to control your treadmill with Silverlight.  Off to the side, you will see a picture of my treadmill (at least it looked that way when I bought it).  This is the IMAGE 15.0Q Treadmill.  It's your average treadmill with speed and incline settings and a magnetic safety button to help prevent you from accidentally doing stuff like this.

Controlling your Treadmill
Some treadmills, like this one, have some type of interface that allow computers to interact with them.  Usually this is done so the vendor can sell you on some additional fitness software or a subscription to some online service.  But why do that when you can write your own?

I'm sure the higher-end treadmill models have better interfaces, but this one in particular uses a standard audio jack which uses encoded sounds to control the various speed and incline settings found on the treadmill.  For example, playing the sound encoded for speed-3, incline-7 will set the treadmill accordingly.  As you can imagine there are quite a few of these sounds.  I was able to acquire these sounds after a little prying into the JavaScript for the treadmill application provided by the vendor.

The User Interface
After acquiring the sounds, we just need to come up with a cool interface that can control how the sounds are played.  Using Blend, I was able to come up with a decent looking interface without too much effort:

Treadmill Controller

The speed and incline can be controlled through the plus and minus buttons.  As you press the speed buttons, the visualizations for speed and incline adjust accordingly.

Workout Graph
There is also a program feature which loads a workout in XML format.  The graph at the bottom is a visualization of your workout.  The green bars represent the speed and the gray bars represent the incline.  The width of each bar is determined as a percentage of time for the total workout.  In other words, the wider the bar, the longer you will be running at that speed and incline.  It's worth noting that the workout in the graph is not a very realistic workout, it was just done that way to demonstrate the functionality.  If you look closely at the left side of the graph, you will see a yellow rectangle around one of the bars.  This rectangle indicates your current workout location.

Video Demonstration
I haven't made the code available yet, but I plan to very soon.  In the meantime, you can check out a short video of the application in action:



User Scenarios
Obviously, this isn't very useful unless you could control the application from the treadmill.  However, you could probably run it well from a tablet PC.  One exciting possibility for this will be when Silverlight for Windows Mobile becomes available.  You could simply run the application from a mobile device.  That will most certainly be a project for later! 


Coming Soon
This project is mainly a proof-of-concept to satisfy my curiosity.  In my next post, I'll go into a little more detail about how the application works.  I have a few more features I would like to add before making the code available.  As always, I'm interested in your feedback!


Feedback

# Clearing a Blog Backlog

Gravatar Bunch of stuff I’ve been meaning to blog about recently, in no particular order: The SideShow Team Blog 7/28/2008 3:04 PM | ASPInsiders

# Silverlight controlling your workout

Gravatar Chris Craft created a neat Silverlight application that controls his treadmill .  Chris openly admits 7/28/2008 4:01 PM | Coding4Fun

# re: Controlling your Treadmill from Silverlight - Part 1

Gravatar Very nice! I never thought I could do that! It'd be cool if a treadmail has an RS232 interface, so I can gather some data off the treadmail. But I bet it'd be quite expensive... :(

Can you give me some examples of sound that gets sent to the treadmail? 7/28/2008 8:33 PM | Grayson Peddie

# Silverlight Cream for July 28,2008 -- #337

Gravatar Mark Monster on Mocking SL and Networking, Denislav Savkov inheriting from ItemsControl, Alex Golesh 7/29/2008 2:41 AM | Community Blogs

# re: Controlling your Treadmill from Silverlight - Part 1

Gravatar Grayson,
In the next few days, I'll be publishing a more detailed post including code and how to obtain the control sounds. 7/29/2008 8:14 AM | Page Brooks

# Controlling your Treadmill from Silverlight - Part 2

Gravatar Controlling your Treadmill from Silverlight - Part 2 7/29/2008 11:40 PM | Page Brooks

# This Week on C9: ASP.NET Maps, Apache, Sphere, Warcraft, and more

Gravatar This week on Channel 9 Dan and special guest host Nick Hodge ( on10 ) is in studio where they discuss: 8/1/2008 9:39 AM | WF Channel9 Videos, Screencasts, and Podcasts

# Controlling your Treadmill from Silverlight - Part 3

Gravatar Controlling your Treadmill from Silverlight - Part 3 8/3/2008 8:16 PM | Page Brooks

# Training with Silverlight

Gravatar Now, here is a very cool way to use Silverlight. Page Brooks has created a way for you to control your 8/4/2008 9:25 AM | The Digital Lifestyle Gadget Blog

# re: Controlling your Treadmill from Silverlight - Part 1

Gravatar How do you communicate with the treadmill? Wouldn't this be a heck of a lot easier to do with a WPF application rather than Silverlight? I'm imagining that you're communicating with the treadmill via Serial Port? Is that even possible in Silverlight? 8/5/2008 10:55 AM | Justin Chase

# re: Controlling your Treadmill from Silverlight - Part 1

Gravatar Justin,
As explained in the blog post, I am using audio signals to communicate with the treadmill. Yes it would have been a heck of a lot easier to do in WPF, but that wasn't my goal. I wanted to see if it could be done with Silverlight. Be sure to check out Parts 2 and 3 to the series. Thanks for your feedback! 8/5/2008 11:23 AM | Page Brooks

# Silverlight Gauge Control

Gravatar Silverlight Gauge Control 8/10/2008 12:14 AM | Page Brooks





 

Please add 4 and 6 and type the answer here: