Go to Post Learn the theory in the classroom and pick up the practical through clubs (FIRST, mini Baja, SAE)... you really need the scale balanced in the middle - Greg Needel [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 14-01-2006, 12:56
Avarik Avarik is offline
Registered User
#0022
 
Join Date: Jan 2004
Location: Chatsworth, CA
Posts: 75
Avarik is an unknown quantity at this point
Gear tooth sensor vs. Optical Encoders

I was wondering if anyone has tried using the gear tooth sensors from the KOP, and knows how well they work? I've used optical encoders before, and know those work well. So how does the gear tooth sensor compare, in terms of accuracy? If it matters, I'm planning on using one of these two sensors for robot speed and speed our launcher system is spinning.

Also, can the gear tooth sensors sense the direction of the spin, or just velocity?

And...while I'm at it...how does the accelerometer compare to these when trying to see robot velocity?
  #2   Spotlight this post!  
Unread 14-01-2006, 14:31
Don Reid Don Reid is offline
Registered User
#0997
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2002
Location: Corvallis, Oregon
Posts: 45
Don Reid will become famous soon enough
Re: Gear tooth sensor vs. Optical Encoders

Quote:
Originally Posted by Avarik
Also, can the gear tooth sensors sense the direction of the spin, or just velocity?
According to the datasheet, this sensor outputs a 45 us pulse for one direction and a 90 us pulse for the other. I think you can detect this difference with the uP.

If you only want to know the speed of rotation though, just the number of pulses in a fixed period of time is enough. A simplified version of the encoder code could count pulses (in an interrupt function) without worrying about the other input.
__________________
Don Reid
  #3   Spotlight this post!  
Unread 14-01-2006, 16:16
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 590
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Gear tooth sensor vs. Optical Encoders

Quote:
Originally Posted by Avarik
I was wondering if anyone has tried using the gear tooth sensors from the KOP, and knows how well they work? I've used optical encoders before, and know those work well. So how does the gear tooth sensor compare, in terms of accuracy? If it matters, I'm planning on using one of these two sensors for robot speed and speed our launcher system is spinning.

Also, can the gear tooth sensors sense the direction of the spin, or just velocity?

And...while I'm at it...how does the accelerometer compare to these when trying to see robot velocity?
The gear tooth sensors work, but it very difficult to get the difference between forward and backwards rotation. As was said, the way to tell is the length of the pulse that is returned. The time in/out of an interrupt service routine is pretty long - especially if you have to save the floating point data area and the temp data areas.

I've been very successful using them to detect pulses, but the direction is very unreliable. In EasyC and WPILib they are currently just counting pulses. I hope to have a new version out soon that will count up and down for clockwise/counterclockwise.

Brad
  #4   Spotlight this post!  
Unread 14-01-2006, 23:16
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: Gear tooth sensor vs. Optical Encoders

Quote:
Originally Posted by Avarik
I was wondering if anyone has tried using the gear tooth sensors from the KOP, and knows how well they work? I've used optical encoders before, and know those work well. So how does the gear tooth sensor compare, in terms of accuracy? If it matters, I'm planning on using one of these two sensors for robot speed and speed our launcher system is spinning.

Also, can the gear tooth sensors sense the direction of the spin, or just velocity?

And...while I'm at it...how does the accelerometer compare to these when trying to see robot velocity?
We used the kit gear tooth sensors last year, mounting them in recommended circuits on PC boards we laid out and etched. We had no problems with them. We never considered picking up the direction signal, but if you want to do this without concern for problems with the interrupt service latency you can build some custom electronics that looks at the pulse width and selects one of two outputs to send the pulse out on, one for forwards and one for backwards. A little electronics work, but do-able.
  #5   Spotlight this post!  
Unread 15-01-2006, 13:06
Avarik Avarik is offline
Registered User
#0022
 
Join Date: Jan 2004
Location: Chatsworth, CA
Posts: 75
Avarik is an unknown quantity at this point
Re: Gear tooth sensor vs. Optical Encoders

Alright, thanks! That was very helpful.

I set these sensors up with interrupts, right? Or is that not possible with the analog inputs..?

And can someone point me to the documentation please?
  #6   Spotlight this post!  
Unread 15-01-2006, 13:43
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
Lightbulb Re: Gear tooth sensor vs. Optical Encoders

Quote:
Originally Posted by Avarik
Alright, thanks! That was very helpful.

I set these sensors up with interrupts, right? Or is that not possible with the analog inputs..?

And can someone point me to the documentation please?
The interrupts on the analog inputs only tells you when the analog conversion is complete. That will not help you for measuring the GTS.

You want to use an External Interrupt. Several of the digital lines are wired to external interrupts on the user processor. When you configure these interrupts, you specify which edge you want to be active. If you leave this configuration alone, then you will receive one interrupt for each pulse and you can measure the speed from the GTS with a timer.

If you are interested in measuring the direction as well, you can add an instruction in your Interrupt Service Routine (ISR) to switch the active edge. This way when the signal changes again, you will get another interrupt. In this case, you will get 2 interrupts per pulse from the sensor.

You can use the timer and some integer math to measure the time between the rising and falling edge to allow you to determine the direction of the gear, then you can also measure the time between one rising edge and the next to determine the speed of the gear.

To time the events, you can simply setup a counter to a speed that will not overflow for the measurements you'd like to make, but that also will give you good resolution. Each time you get an interrupt, save the value in the counter. Also, before saving it, subtract the last timer value that was saved from the current timer value. This will give you the change in time. Save that as well. You can then use the numbers elsewhere in your code to compute the speed. If you want to compute direction as well, the you'll need to store two old values.

Best of luck!
-Joe
  #7   Spotlight this post!  
Unread 15-01-2006, 13:58
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
Lightbulb Re: Gear tooth sensor vs. Optical Encoders

Quote:
Originally Posted by BradAMiller
The gear tooth sensors work, but it very difficult to get the difference between forward and backwards rotation. As was said, the way to tell is the length of the pulse that is returned. The time in/out of an interrupt service routine is pretty long - especially if you have to save the floating point data area and the temp data areas.

I've been very successful using them to detect pulses, but the direction is very unreliable. In EasyC and WPILib they are currently just counting pulses. I hope to have a new version out soon that will count up and down for clockwise/counterclockwise.

Brad
Brad,

When using interrupts on this microcontroller, remember that it has no floating point support in hardware. It only has 8 bit integer support. The larger the integer you use, the more instructions are required to do anything with it. Floating point is even worse.

In general, when writing an handler, you want to split the work into two pieces.

In the actual Interrupt Service Routine (ISR), you want to do the least work that you can get away with. In this case, simply subtracting from the last stored value and then storing off the timer value for next time. You want to do only what must be done to save the information about what happened.

The other half of the processing is done in a Deferred Procedure Call (DPC). In here, you can do your floating point division to figure out the actual speed. At the end of your ISR, you need to set a bit in memory somewhere that you will check in you code elsewhere... probably in the user_routines_fast() function. If the bit is set there, then you want to call your DPC function to finish the work on the new raw data.

Using this structure, you will avoid saving off the floating point registers when entering your ISR, will have more accurate timing, and far less interrupt time overall. This will make the rest of your processor more responsive and you will be able to handle far more interrupts on the processor without problems.

Good luck!
-Joe
  #8   Spotlight this post!  
Unread 17-01-2006, 10:18
Joohoo's Avatar
Joohoo Joohoo is offline
Registered User
FRC #0340 (G.R.R.)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 2005
Location: Rochester
Posts: 241
Joohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really niceJoohoo is just really nice
Send a message via AIM to Joohoo Send a message via Yahoo to Joohoo
Re: Gear tooth sensor vs. Optical Encoders

Quote:
Originally Posted by BradAMiller
I've been very successful using them to detect pulses, but the direction is very unreliable. In EasyC and WPILib they are currently just counting pulses. I hope to have a new version out soon that will count up and down for clockwise/counterclockwise.
One way to make this work is to trigger a timer and since one direction sends a 20something microsecond pulse and the other sends about a 83 microsecond pulse have the timer go for 60 microseconds and the check if the pulse is present you can then add or subtract to your count accordingly
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
VEX Optical Shaft encoders in FRC sanddrag FIRST Tech Challenge 8 04-10-2005 07:52
Hollow Shaft optical encoders magical hands Control System 2 24-03-2005 09:12
Accelerometer vs Gear Tooth Sensors zdeswarte Electrical 4 22-01-2005 15:35
gears Michael Leicht Inventor 12 16-09-2004 10:52
Coupling the drill motor with out the 15 tooth gear Chopper_Dave Motors 1 17-01-2004 01:06


All times are GMT -5. The time now is 04:35.

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