Sunday, October 2, 2011

Mobile Wireless Level

I love the challenge of climbing hills and the satisfaction of being successful.  I'm often curious about the grade of the hills I ride.  I really have no idea what grade they are or what grade I find challenging.  If I knew the grade of an unconquered hill is only 1% more than a hill I've already climbed, it might help me push harder.

So I want to measure the grade of the trails I ride.  I always record my rides with GPS and that records altitude.  Applications such as Google Earth can take that data and draw a path with elevation.  Google Earth will then calculate the grade of sections on trail.  That sounds good, but GPS data can be off by 2+ meters in the horizontal direction and about double that in the vertical.  On a mile long hill climb maybe the grade calculated from the start and end points would be close enough.   But the grade calculations for a short length of trail could be way off.  And I'm only concerned about short steep hill climbs.  I would think calculating based on the both the inaccurate horizontal and vertical GPS data would make the grade calculations extremely inaccurate.

So it occurred to me to go out to the trails and measure the hill grades by hand, writing the results down.  I could use a plumb and protractor, or a digital level.  But this is a bit too manual for me, and it would be tedious to get this data on a map.

What I need is to collect data while I ride, just like I do with GPS, only I want actual level information.
But since a unicycle's frame pivots on its wheel, it moves independently of the grade it's rolling on.  So I can't use my uni.  However, a bike frame stays in sync with the trail grade as it rolls, assuming the wheels don't leave the ground, there's no suspension, and no tire compression.
ZOMG!  Bikes have a purpose after all! ;-)

Months ago I attached a Wii Remote with a Nunchuk to my bike to use as a level.  Both of these devices have accelerometers in them and can be used to measure angles.  The wiimote's data can be read using Bluetooth, and as a software engineer it wasn't too difficult to write an application to log from it.  In testing, I found the nunchuk I had gave me data at twice the resolution of the wiimote, but still only gave readings at about 1.8 degree increments. On a side note, I also noticed another nunchuk I had was actually the same as the wiimote, at 3.6 degree increments.  Hmm.  Anyway, I rode around the neighborhood and recorded some data.  Unfortunately because the wiimote and nunchuk measure position using accelerometers, they're dual purpose, and their values bounce all over the place as they shake.  This is good information for the Wii, but not for my purposes. Even riding carefully gave me extremely shaking and therefore useless data.  The other annoyance with the wiimote is it implements the Bluetooth Human Interface Device (HID) profile.  I can interact with this using my laptop, but not with my Dell PDA.  So I'd have to carry a laptop with me in a backpack to log data.

What I really need is a digital wireless level that implements the Bluetooth Serial Port Profile (SPP).  After an extensive search I found a digital protractor with an accuracy of 0.01 degrees that had an RS-232 interface and mounting holes.  Brand new this thing costs almost $350.  But I was able to find it used on eBay, shipped for $73.  It's branded by many companies, but the model is always the Pro 3600.
With an RS-232 interface I could still make it wireless by buying or building a Bluetooth SPP adapter.  Then it would be simple to log data with my PDA.  I ended up building my own, by buying some parts and using some I already had.  I saved $30-40, but spent a lot of time.  But it's good to keep exercising my novice electrical engineering skills.

Using an baby seat rack I had never installed on my bike, I was able to mount the level and Bluetooth adapter.
So now I can log both GPS data from my Holux GPS receiver and trail grade data from my Bluetooth enabled Pro 3600 protractor to my Dell Axim PDA.  By the way, this PDA is one of the few models that can simultaneous have two Bluetooth connections open at once.  It's specifically why I bought this one off eBay almost two years ago.
Holux M-1000 GPS receiver
Dell Axim x51 PDA
With a single logging program running, I can log from both devices, associating the GPS with the trail grade data.

I still need to do some more testing with the Pro 3600 protractor.  Hopefully it will not be as jittery as the Wii components.  On the trails, I plan to walk with the bike.  I think I can keep a more consistent pace and avoid vibrations this way.

Once I collect trail data, my plan is to use the grade information to calculate and replace the GPS altitude positions.  This way I can still use Google Earth to render the trail for me, and I can view grade information there.  Here is an example of how Google Earth can show the trail grade:

Hopefully I'll be posting some results soon!

No comments:

Post a Comment