Monday, February 22, 2016

An Engineer's OCD

Let's face it, I'm a bit of a metrics geek. About as soon as I learned how to read, I memorized stats on all the planets. How far from the sun, orbit duration's, size, etc. Numbers and how things interact with each other have always fascinated me.

All of my off-road bicycles have wheel sensors on them. GPS receivers do a surprisingly lousy job measuring distance in tight and twisty terrain. A wheel sensor communicates wirelessly with the GPS unit and provides ground truth. The metrics geek in me would accept nothing less.

When I built up my quasi-fat bike last fall, I transferred the Garmin wheel sensor from the bike I decommissioned. It refused to work properly. I replaced the battery. No improvement. I tried a different magnet. No luck. The sensor synced up well via the Ant+ link, but it would always record way more distance than I rode. Much of the time my speed would show up on the Garmin at twice what I was actually travelling. I figured it was an old Garmin GSC-10 sensor that had a spotty reliability record to begin with, so it must have gone bad. I ordered a new Wahoo sensor.

I mounted the new sensor, synced it up, figured that would be it. Except exactly, the same, thing, still, happened! SOB! This became an obsessive issue now. There is no way a stupid magnet/reed switch sensor is going to thwart me. This is 100+ year old technology, and I could design a wireless link from scratch. What was different about this new bike that all manner of sensor and magnet combinations wouldn't work that worked flawlessly on other bikes?

Let's look at how these speed (or cadence) sensors work. If you use one, listen in a quiet room as you spin the wheel. You'll hear a faint poink, poink, poink as the wheel rotates. It is the mechanical reed switch in the sensor opening up each time the magnet moves away.

A reed switch is nothing more than two piece of springy metal overlapping each other with a small gap between them. Put a magnet near one end, the magnetic flux wants to flow through the metal and cause the two "reed" ends to attract each other and close the gap. It is a magnetically actuated switch. Electronics in the sensor module detect each closure (which is each wheel revolution) and sends this to the Garmin GPS via an encoded radio message.

It turns out you need a north or south pole to pass by one of the ends of the reed switch. You can't put a magnetic pole in the middle, as this doesn't cause flux to flow through the reeds to make a magnetic circuit that closes the switch. A spoke magnet presents a north or south pole to the reed switch. Thus the magnet must pass exactly over the end of the reed switch to trigger it. Sensors have a mark where this spot is.

But a reed switch really has two ends, and either end can be triggered by the spoke magnet.  If you passed a magnet's north pole along the length of a reed switch, it would turn on once passing over the first end, turn off in the middle, then turn on again passing over the second end of the reed switch. Manufactures don't tell you about this. They mark only one end.

When I sat down to carefully listen to the sensor, I didn't here a poink, poink, poink. I heard a poink-poink, poink-poink, poink-poink. Ah-ha! It is double actuating each time the magnet came by. But why?

It turns out the carbon rigid fork has some fundamental geometry differences from the suspension forks on my other mountain bikes. The suspension forks have a lot of offset built into the drop-out. This allows the fork leg mounted sensor to be positioned such that the magnet passes by perpendicularly. But on my new Carver, the offset is built into the angle of the fork legs. This pushes the sensor much further forward relative to the wheel axle, so the magnet now sweeps more top to bottom than across the trigger point. The magnet was just passing through the unintended trigger area of the sensor!

A little fudging ensured the magnet only passed through the intended trigger area. A test ride confirmed I now measured ground truth! It's embarrassing how many times I fussed with this before figuring it out.

I slid the magnet closer to the axle to ensure it would not trigger the upper sensitive area
while being just far enough into the lower sensitive area without missing triggers.

I wish challenges I deal with at work had fixes this certain. Sometimes you think you've got to the root cause, only to find the problem comes back to bite you in the ass.