View Single Post
  #1   Spotlight this post!  
Unread 18-01-2006, 20:42
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Turning a gear-tooth sensor into a quadrature output encoder

Hi,

Given the problems I've had writing working code for direction sensing with the hall-effect sensors in the kit (and apparently Kevin Watson is having the same problems), I was wondering if there was some kind of very simple circuit I could build that translates the different pulse widths into a single digital channel (if 0, forward, if 1, reverse), thus making the programming identical to that of to that of a quadrature encoder.

What about an independently-clocked counter IC? The rising edge of a pulse starts the counting, the falling edge stops it. You could then read the count line corresponding to the highest power of two that differentiates the two types - if you get zero you have a short pulse, if one you have a long one.

I.e. get an 8 bit counter (0-255). Start a count on rising edge. Use an external clock of 1MHz to increment the counter after that. Stop the clock on falling edge. Now read bit 5 (2^6 = 64). If bit 5 is 1, you have been counting for at least 64usec and you know your direction. After reading, simply reset the counter to 0.

Or, is there a way to translate from pulse widths to an analog voltage (like the analog-to-PWM conversion in the RC in reverse?)

My expertise is more in software, so someone with a mind in hardware would probably have a better idea.

Last edited by Jared Russell : 18-01-2006 at 20:51.