Saturday, December 4, 2010

Treadmill Plan

As I posted earlier, I want to create a special treadmill that adjusts its speed to keep a unicycle in the center no matter what speed the rider is pedaling at.

To do this I need a system that can sense when the rider has moved, calculate the appropriate treadmill correction, and command a motor's speed.

First, the motor. Can I get a motor that is powerful enough to move a rider and can be speed controlled very quickly? I don't know much about motors. But I thought of the Segway.

It can move the weight of itself and a rider. It controls a motor so many times per second that it can balance on two wheels. So the motor(s) in it must be close to what I need.

I've seen several DIY Segway builds online, so I went back and read more about them. As it turns out, one of the DIY Segway creators also made a self balancing unicycle! That system has very similar requirements to mine! Trevor Blackwell shared his parts list in his blog.


Unfortunately the motor he used is $300 and the motor controller is $200. Maybe I can find a cheaper alternative.

A micro-controller is an obvious choice for the processing. I happen to own a Parallax Propeller demo board. It's pretty amazing with its 8 processors. And I'm familiar with it, so I think I'll try to use that.

Finally I need some way of detecting where the unicycle is on the treadmill. At first I was thinking of a series of some kind of electronic trip-wires running across the treadmill. But then I realized that since the goal is to keep it in the center at all times, tripping a wire that is not in the center means I've probably already failed. What I really need is a camera to just watch the rider from the side and detect the tiniest movement. But where am I going to get an inexpensive camera that can detect movement and doesn't take an image scientist to make sense of?
The Nintendo Wii remote of course! The wiimote has a tiny infrared camera on the front of it. You point it at the Wii's "sensor bar" which really just has a cluster of infrared LEDs at its ends.
As you point the wiimote at your TV and move it around, it sees the sensor bar LEDs and determines their coordinates in it's field of view. It determines these coordinates 100 times per second! It then takes these coordinates and the states of its other sensors and controls and sends it to the Wii using Bluetooth wireless. In normal use, the wiimote is moving around and the sensor bar's LEDs stay put. But of course it will work the same the other way around.
So if my moving unicycle had IR LEDs on it, I could use a stationary wiimote off to the side to monitor my movements.
I mainly need to detect the horizontal movement of the center of my wheel. But from the side view the center of a unicycle wheel is the axle. That gets blocked from view about 50% of the time by the rider's leg. So I think the LEDs should go on the outside of the wheel at the rim. If I can detect those, then I can calculate where the center is. Although the Wii's sensor bar only has two IR "blobs", the wiimote's camera actually has the ability to detect up to four blobs. This is great news because with the LEDs on my rim, sometimes a blob will be covered up by my leg. I need at least two opposite blobs at all times to determine the center of the wheel. With four evenly spaced blobs I should be all set.

As I mentioned, the Wii uses Bluetooth wireless to get data out of the wiimote. But the camera component in the wiimote can be removed and used directly using the well known I2C protocol. I've read that if you interface to this camera this way you can get blob coordinates out at 200 times per second!

So, my plan is to put four evenly space IR LEDs on my wheel and have a wiimote camera pointing at me from the side. My Propeller micro-controller will read the blob coordinates, calculate the center of my wheel, and determine if I'm going faster or slower than the treadmill. It will then command a motor to move faster or slower to keep me in the center. And ideally, all of this will happen 100 to 200 times per second!

According to Trevor's self balancing unicycle blog post: "When it detects itself tilting backwards it runs the wheel backwards. It does this so rapidly (200 updates per second) that it feels perfectly smooth." 200 updates per second and perfectly smooth. I like the sound of that.

I've already made some good progress with some IR LEDs, my old uni, a wiimote, and my Propeller. More details to come.

1 comment:

  1. This post is so informative and makes a very nice image on the topic in my mind. It is the first time I visit your blog, but I was extremely impressed. Keep posting as I am gonna come to read it everyday! More Details

    ReplyDelete