Unformatted text preview: start timer running / ) $ $ 1 42 Change value of “on” time to change analog average Need to determine the rear wheel velocity average output = ( on + off ) / ( period ) Use sensor to detect wheel moving How do we decide on the period of the pulses?
Using two timers Determine speed of a bicycle
Attach baseball card so it pokes through spokes
Number of spokes is known
Count clicks per unit time to get velocity One to set period (auto-reload)
One to turn it off at the right duty cycle Baseball card sensor is a shaft encoder click!
t bike wheel baseball card set timer to go off at each edge start timer running How many segments should be used? Instead of spokes we’ll use black and white segments
Black segments absorb infrared light, white reflects
Count pulses instead of clicks wheel infrared
detector More segments give finer resolution
Fewer segments require less processing
Tradeoff resolution and processing pulse " ' 3 5
Use interrupt on GPIO pin Microcontrollers come with built-in I/O devices Every interrupt, increment counter Timers/counters
Etc. Use timer to set period for counting
When timer interru...
View Full Document
- Fall '09
- Pulse-width modulation, Interrupt, duty cycle, rear wheel, brake pedal, rear wheel velocity