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
Photograph bike for purposes of overlay-sketching and progress measurement
Find packaging for the eletronics
Decide how to mount sensors / microprocessor onto bike frame
Create mount-points and place wires (unless wireless is decided upon)
Electronics
Wheel RPM
Decide whether to use a reed-switch & magnet, wire-loop & magnet or LDR & LED/Blinkers
Pedal RPM
As for wheel RPM
Airspeed
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
Get an accelerometer
Location
GPS reciever
Software
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
Reference Clock (see below) needs a pull-up (or pull-down) resistor. Just shorting PWM-out to INT-in won't work.
Use PWM2 to verify accurate rate detection using new reference clock
Display rate in rpm and kmph.
Roadmap
Use optical mouse sensor to read speed (and wobble?)
-
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!