View Single Post
  #8   Spotlight this post!  
Unread 25-01-2006, 17:14
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: Speed Sensor for Ball Shooter

Quote:
Originally Posted by eugenebrooks
Use an optical sensor, such as a banner sensor with reflective tape, that generates one interrupt per rotation of the wheel. Use this interrupt to measure the amount of time that it takes for the wheel to go around with one of the hardware timers, preferably a 16 bit one (timer 1 or timer 3). Use the interrupt from the overflow on the timer to increment a "high word" maintaining a 32 bit result for the time in clock ticks that it takes for the wheel to go around. You can get very high precision for the wheel speed this way with only one interrupt per rotation and any additional interrupts associated with overflow of the timer. The "period" of the wheel is then maintained by the interrupt setup, to be read in the user loop by the PID control for the wheel power, any time it needs to be read.

<edit>
There is a race condition in this scheme that you must be careful about.
<edit>


Have fun,
Eugene
Dosen't the photo sensor have only a 500us response time?