On Sat, Aug 15, 2009 at 8:03 PM, hgraf wrote: > On Sat, 2009-08-15 at 19:22 -0400, solarwind wrote: >> I just thought of another idea: >> >> Rip open an old mouse and extract the phototransistor and infrared >> LED. Mount each on the two forks of the bicycle so that they face each >> other. When the spoke gets in the way, the light to the >> phototransistor gets cut off and can be detected by the >> microcontroller. >> >> Would this work? > > Yes, for a short while. Optical is never a good idea IMHO for something > like this because it will get dirty (just one puddle would be enough) > and stop working. > > TTYL > (I am designing a bicycle speed sensor right now for a client.) Everyone uses reed switches for bicycle wheel-speed sensors. Optical sensors are power-hungry and fragile (any dirt and they will fail). Hall effect sensors are power-hungry and expensive. There are "low power" ones, but they just duty cycle the sensor and could easily miss a spoke magnet going past. Reed switches are simple and use zero power. (Put the pullup on a micro output so you can switch it off as soon as the switch triggers. Switch it back on at the end of the debounce timeout.) Debouncing is the trick. Yes, the switches bounce, and also some spoke magnets can trip twice per revolution. A fixed period is not a great debounce, because you have to cover a wide range of activation times at different speeds. Bicycles have some momentum, so I would suggest using 25% of the previous wheel period, within upper and lower bounds. All bicycle speed sensors that I know of use reed switches or GPS. Oh, and I had a mechanical speedometer on my bike when I was younger. Regards, Mark markrages@gmail -- Mark Rages, Engineer Midwest Telecine LLC markrages@midwesttelecine.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist