Go to Post I'm sure there aren't a bunch of rule makers sitting in a board room discussing "What rule can we change now to mess with the teams' heads?" Lets all just sit back and enjoy the regionals! - Rick [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-2003, 23:40
D.Viddy's Avatar
D.Viddy D.Viddy is offline
Registered User
AKA: Dylan Vester
FRC #3176 (Purple Precision)
Team Role: Programmer
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Camby, IN
Posts: 44
D.Viddy is an unknown quantity at this point
Using Digi-Key Shaft Encoders

How would I go about programming one of these, and which one would be ideal for positioning a low speed (60 RPM) shaft? Any info is appriciated. Thanx.

Digi-Key Shaft Encoder Pages:
http://dkc3.digikey.com/PDF/T031/0830.pdf
http://dkc3.digikey.com/PDF/T031/0831.pdf
http://dkc3.digikey.com/PDF/T031/0832.pdf
__________________
.................................................. .........
Dylan Vester - (Programmer)
Running a P4 1.8 Ghz
Team 998, We can't win...
.................................................. .........

Last edited by D.Viddy : 18-01-2003 at 23:42.
  #2   Spotlight this post!  
Unread 19-01-2003, 00:46
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
At 60rpm, you can use just about anything as that's only 1 rps, meaning you could, in theory, sample down to 1/40th of a rotation.

As for programming, I'd recommend having a few lines of code to turn the input into a numeric identifier for the current position. Then, just compare that position to the one from the last loop to figure out how far you've rotated in the previous 26ms. The only non-trivial part is going to be dealing with loops (ie position was 4 last time, but now is 1--you need to recognize that in this case 1>4).
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #3   Spotlight this post!  
Unread 19-01-2003, 13:32
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
Positioning or speed?

Are you trying to measure the position (angle) of a shaft, or the speed of rotation. As Rob says, they will work for speeds like yours.

If you want position or the angle, like for a steering system, then the problem with these is the low resolution. Most have 16-32 "codes" per rotation. This means you can only get the position to +/- 1/32 of a rotation (~11 deg.). To get more resolution, you could connect one with a belt or gears so that the encoder rotated more than the shaft being measured, more complex.
__________________
Don Reid
  #4   Spotlight this post!  
Unread 19-01-2003, 17:02
D.Viddy's Avatar
D.Viddy D.Viddy is offline
Registered User
AKA: Dylan Vester
FRC #3176 (Purple Precision)
Team Role: Programmer
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Camby, IN
Posts: 44
D.Viddy is an unknown quantity at this point
We are trying to feedback angle from the shaft encoder, we are looking at the 256 ticks/rev so our resolution will be fine. We don't need it perfect, just somthing like <10 degrees.
__________________
.................................................. .........
Dylan Vester - (Programmer)
Running a P4 1.8 Ghz
Team 998, We can't win...
.................................................. .........
  #5   Spotlight this post!  
Unread 19-01-2003, 17:20
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
In that case, you should be fine. 60rpm=1rps=9degrees/26ms. Therefore, in theory the Stamp could sample down to approx. 9 degree resolution. That's assuming, of course, that it hits the new position EXACTLY as the controller is sampling, but you should be able to get decent resolution none-the-less.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #6   Spotlight this post!  
Unread 19-01-2003, 17:29
D.Viddy's Avatar
D.Viddy D.Viddy is offline
Registered User
AKA: Dylan Vester
FRC #3176 (Purple Precision)
Team Role: Programmer
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Camby, IN
Posts: 44
D.Viddy is an unknown quantity at this point
Yes it all should work fine.
__________________
.................................................. .........
Dylan Vester - (Programmer)
Running a P4 1.8 Ghz
Team 998, We can't win...
.................................................. .........
  #7   Spotlight this post!  
Unread 19-01-2003, 21:37
ttedrow's Avatar
ttedrow ttedrow is offline
Herding electrons
AKA: Tim Tedrow
FRC #0281 (EnTech)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Greenville, SC
Posts: 165
ttedrow will become famous soon enoughttedrow will become famous soon enough
In real life the rule of thumb is to sample at greater than 10 times the max output Frequency. That mean that the Max encoder frequency should be no greater than .26 sec.
__________________
Sr. Design Engineer
Caterpillar Inc.
Greenville, SC

KD4EGM

FRC 281 Greenvillains
Infected with the FIRST virus in 2000

Yes, Chute Door!!!
  #8   Spotlight this post!  
Unread 20-01-2003, 02:24
D.Viddy's Avatar
D.Viddy D.Viddy is offline
Registered User
AKA: Dylan Vester
FRC #3176 (Purple Precision)
Team Role: Programmer
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Camby, IN
Posts: 44
D.Viddy is an unknown quantity at this point
.26 sec?

Don't you mean .026, That would be 26 milliSeconds.
__________________
.................................................. .........
Dylan Vester - (Programmer)
Running a P4 1.8 Ghz
Team 998, We can't win...
.................................................. .........
  #9   Spotlight this post!  
Unread 20-01-2003, 11:57
ttedrow's Avatar
ttedrow ttedrow is offline
Herding electrons
AKA: Tim Tedrow
FRC #0281 (EnTech)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Greenville, SC
Posts: 165
ttedrow will become famous soon enoughttedrow will become famous soon enough
26mSec is the update rate of the BS that we can't change so the max Freguency of our input is 260mSec or 3.8Hz. If your encoder signal is faster than this you will run the risk of missing pulses.
__________________
Sr. Design Engineer
Caterpillar Inc.
Greenville, SC

KD4EGM

FRC 281 Greenvillains
Infected with the FIRST virus in 2000

Yes, Chute Door!!!
  #10   Spotlight this post!  
Unread 20-01-2003, 13:37
crazycliffy crazycliffy is offline
Registered User
#0846
 
Join Date: Jan 2003
Location: San Jose
Posts: 11
crazycliffy is an unknown quantity at this point
so if 26ms is your sampling time. this is about 38.4Hz

then 38.4 / 10 = 3.84 Hz. = 0.26 seconds or 260 ms.

your motors should not rotate faster then 3.84Hz.


Theoretically, you only need a two folds the sample time.
This is also called the nyquist frequency, or aliasing frequency.
  #11   Spotlight this post!  
Unread 25-11-2003, 08:33
WizardOfAz's Avatar
WizardOfAz WizardOfAz is offline
Lead Mentor
AKA: Bill Bennett
FRC #1011 (CRUSH)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Tucson, AZ
Posts: 101
WizardOfAz will become famous soon enough
Send a message via AIM to WizardOfAz
sample rate for optical encoders

We are intending to use one of these, or something equivalent to measure steering angle. I've read through the posts above and I don't think the analysis above is correct.

The device generates 256 pulses per revolution. At 60 rpm, 1 rps, this is 4 milliseconds per pulse. Especially with last year's stamp, there's no chance of sampling fast enough to use this device.

With this year's processor, maybe it will work. Has anyone tried? Or measured how often an interrupt can be serviced under "normal" cpu loads? 4 ms is probably only a few hundred instructions, perhaps close to 1000. I'm a bit doubtful that you can do it without totally consuming the cpu.

If you can tolerate less angular resolution and use the 128 or 64 pulse per rev device, seems like you have a lot better chance of making this work.

Or am I missing something here?

Bill
  #12   Spotlight this post!  
Unread 25-11-2003, 08:36
Matt Reiland's Avatar
Matt Reiland Matt Reiland is offline
'The' drive behind the drive
None #0226 (TEC CReW Hammerheads)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1999
Location: Troy Michigan
Posts: 712
Matt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond reputeMatt Reiland has a reputation beyond repute
Smile

To measure steering angle (Unless you want continous rotation) remember a potentiometer works great and is 'absolute'by nature so you don't need a running count or a calibration on power up.
__________________
Robonaut Next Generation Control System Development

2003 GLR Champions (302,67,226)
2003 Buckeye Semi-Finalists(902,494,226)
2002 Nationals QuarterFinalists
2001 West MI QuarterFinalists
2000 GLR Semi-Finalists
  #13   Spotlight this post!  
Unread 25-11-2003, 09:06
Andrew Andrew is offline
Registered User
#0356
 
Join Date: May 2002
Location: Little Rock, AR
Posts: 393
Andrew is a name known to allAndrew is a name known to allAndrew is a name known to allAndrew is a name known to allAndrew is a name known to allAndrew is a name known to all
Re: Using Digi-Key Shaft Encoders

Quote:
Originally posted by D.Viddy
How would I go about programming one of these, and which one would be ideal for positioning a low speed (60 RPM) shaft? Any info is appriciated. Thanx.

Digi-Key Shaft Encoder Pages:
http://dkc3.digikey.com/PDF/T031/0830.pdf
http://dkc3.digikey.com/PDF/T031/0831.pdf
http://dkc3.digikey.com/PDF/T031/0832.pdf
If you're talking about using the mechanical encoders on these pages, make sure you use the gray scale version. The BCD will screw you up.

If you're talking about the optical encoders, then you have a couple of choices. I think you can rig the RC as a counter. One way would be to tie the encoder into a low priority interrupt and fire an interrupt on each pulse. This may become very band-width intensive though.

There are also chips available which do all the counting and demodulating for you. I haven't looked through digikey to find one, but I'm sure they sell them. I've use HPs (now Agilent's) chips, in particular the HCTL1100, which is far more expensive and powerful than you would need.

Or, you could rig up a counter circuit of your own. Depends on your electrical design skills.

If you need more resolution, you can always attach a measurement gear to your system. This has the added advantage of protecting your encoder from the shocks and abuse that your drive wheels will experience. If you do this, you need to remember to use a fine pitch gear set or an anti-backlash gear to minimize the errors introduced by backlash.
  #14   Spotlight this post!  
Unread 25-11-2003, 09:38
WizardOfAz's Avatar
WizardOfAz WizardOfAz is offline
Lead Mentor
AKA: Bill Bennett
FRC #1011 (CRUSH)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Tucson, AZ
Posts: 101
WizardOfAz will become famous soon enough
Send a message via AIM to WizardOfAz
using potentiometer as shaft encoder

Piher makes a continuous rotation pot, the N15 series. Spec sheet here:
http://www.piher-nacesa.com/pdf/n15.pdf
Mouser sells them (mouser.com). For example, mouser part# 531-N15TV-100K. They only do 340 degrees, so you need two of them to get 360 coverage.

The advantage over the optical sensors is
- direct readout (no CPU load)
- easy to program
- cheap @ $3

The disadvantages are
- poor accuracy (3% = 11 degrees)

Bill
  #15   Spotlight this post!  
Unread 15-01-2004, 10:10
WizardOfAz's Avatar
WizardOfAz WizardOfAz is offline
Lead Mentor
AKA: Bill Bennett
FRC #1011 (CRUSH)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Tucson, AZ
Posts: 101
WizardOfAz will become famous soon enough
Send a message via AIM to WizardOfAz
Re: using potentiometer as shaft encoder

Quote:
Originally Posted by WizardOfAz
Piher makes a continuous rotation pot, the N15 series. Spec sheet here:
http://www.piher-nacesa.com/pdf/n15.pdf
Mouser sells them (mouser.com). For example, mouser part# 531-N15TV-100K. They only do 340 degrees, so you need two of them to get 360 coverage.

The advantage over the optical sensors is
- direct readout (no CPU load)
- easy to program
- cheap @ $3

The disadvantages are
- poor accuracy (3% = 11 degrees)

Bill
Actually, there's another disadvantage of these Piher potentiometers - you can't get them from any of the permitted suppliers (newarkinone, future-active, digikey), so I guess you can't use them. Does anybody know of any "out" for this? Does every little $2 or $3 part I might buy at some local electronics store for the robot also have to be obtainable from the listed suppliers? What would seem reasonable to me is that there be a lower limit, maybe $5 or $10 dollars, under which you could buy electronics parts from anybody.

It's too bad if we can't use these Piher pots (for example). They are less than $3 each and make great continuous rotation sensors. I have not yet found anything similar from the listed suppliers.

Bill
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
If set screws suck . . . Madison Technical Discussion 17 22-12-2003 19:19
Who used wheel encoders CyberWolf_22 Technical Discussion 12 04-05-2003 15:37
Where to get shaft encoders D.Viddy Programming 12 17-01-2003 09:38
Motor coupling archiver 2001 19 23-06-2002 23:35
Need Help on Shaft Mounting... archiver 2001 3 23-06-2002 23:29


All times are GMT -5. The time now is 21:45.

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