Go to Post I trust my life to a 3650 pound rolling chunk of metal every day that, if some silicon failed in just the right (wrong?) way, would splat me pretty quickly, but I have faith in engineering. On the other hand, it doesn't turn me upside down. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #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.
  #2   Spotlight this post!  
Unread 18-01-2006, 20:57
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Turning a gear-tooth sensor into a quadrature output encoder

Quote:
Originally Posted by Abwehr
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.
If you are interested in an external part, you'd probably be best of with a small microcontroller to handle it for you. Then you can write more software.

-Joe
  #3   Spotlight this post!  
Unread 18-01-2006, 21:35
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
Re: Turning a gear-tooth sensor into a quadrature output encoder

Yeah, I've already gone ahead and got it working on a Gumstix module, and I could always run a serial interface over to the RC if I wanted, I was just wondering whether there was some super-simple circuit I was forgetting.

All the same our team isn't going to use them, most likely, but I was curious more than anything
  #4   Spotlight this post!  
Unread 18-01-2006, 22:17
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Cañada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Cañada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Turning a gear-tooth sensor into a quadrature output encoder

Quote:
Originally Posted by Abwehr
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.
Building custom circuits out of discreet ICs is kind of passé these days. A bit of Verilog code and a small gate array, like a Xilinx Spartan 3, could easily discriminate between the two pulses. It would be very fun (for me, anyways) if teams got a FPGA demonstration board in the KOP that would allow them to easilly build such circuits.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #5   Spotlight this post!  
Unread 18-01-2006, 22:19
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
Re: Turning a gear-tooth sensor into a quadrature output encoder

Quote:
Originally Posted by Kevin Watson
Building custom circuits out of discreet ICs is kind of passé these days. A bit of Verilog code and a small gate array, like a Xilinx Spartan 3, could easily discriminate between the two pulses. It would be very fun (for me, anyways) if teams got a FPGA demonstration board in the KOP that would allow them to easilly build such circuits.

-Kevin
Leave it to Kevin to bring the control system fashion police into the matter
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Encoder Code Kevin Watson Programming 47 18-02-2008 12:56
Internal vs. External Gear teeth - same profile? sanddrag Technical Discussion 7 01-03-2005 10:44
Accelerometer vs Gear Tooth Sensors zdeswarte Electrical 4 22-01-2005 15:35
Updated Encoder Code Available Kevin Watson Programming 2 04-01-2005 01:00
gears Michael Leicht Inventor 12 16-09-2004 10:52


All times are GMT -5. The time now is 17:34.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi