User Tools

Site Tools


mbed:cycling_computer

Cycling Computer

I intend to make a ludicrous bicycle computer, which will do silly things like:

  • Measure speed using the optical sensor from an old mouse
  • Measure the berth overtakings cars give with ultrasound
  • Measure acceleration using an accelerometer
  • Log GPS coordinates
  • Run a GUI on a Nintendo Game Boy Advance (although I may do this bespoke as well…)

Data

To Do

Physical

  1. Photograph bike for purposes of overlay-sketching and progress measurement
  2. Find packaging for the eletronics
  3. Decide how to mount sensors / microprocessor onto bike frame
  4. Create mount-points and place wires (unless wireless is decided upon)

Electronics

  • Wheel RPM
    1. Decide whether to use a reed-switch & magnet, wire-loop & magnet or LDR & LED/Blinkers
  • Pedal RPM
    1. As for wheel RPM
  • Airspeed
    1. Buy pressure sensors and calibrate a (remember what the hell it was called - it's in the Windows Journal files, reboot into Windows, export it all and never look back).
  • Acceleration
    1. Get an accelerometer
  • Location
    1. GPS reciever

Software

  1. Investigate software timers which fire interrupts. Simon said something about these, and I'd not heard of them. They seem a lot simpler than a PWM loopback. Though not nearly as hacky ;-)
  2. Reference Clock (see below) needs a pull-up (or pull-down) resistor. Just shorting PWM-out to INT-in won't work.
  3. Use PWM2 to verify accurate rate detection using new reference clock
  4. Display rate in rpm and kmph.

Roadmap

  1. Use optical mouse sensor to read speed (and wobble?)
    1. Probably simplest to avoid using USB mouse, try PS2 instead.

Physical Bike Properties

Rear wheel circumference at 60psi: 2m 4cm (readings were 2m14, 2m04, 2m06, 2m04.5)

Maths

Assuming that the wheel of my bike as a circumference of 1m, and that I reckon the practical upper limit for my bike is 50mph (~80kmph)1) then I can expect my bike wheel to do about 20 rotations per second. In order to sample this effectively, I should be sampling at 40Hz.

However, I won't have an analog measurement from the wheel. I will have a pulse once per rotation. I can configure the board to fire an interrupt on this pulse (by catching the rising edge, for instance). I can also connect one of the PWM modules to an interrupt and use it to generate my reference clock.

So I can have a tick() interrupt fired at 40Hz, providing an accurate reference signal, and another interrupt fired for each rotation of the wheel. By counting ticks between wheel rotations I ought to be able to work out my speed fairly accurately.

88 subs per second

A “sub”2) is approx. 6 inches. 30mph = 44 feet/s = 88 subs/s: Great Scot!

1)
I don't expect to be able to cycle at this speed, this is just the upper limit I've chosen to design my system for
2)
As in sub-way sandwich
mbed/cycling_computer.txt · Last modified: 2008/11/22 16:28 (external edit)