From: Ian L. <fla...@gm...> - 2006-03-22 01:49:02
|
I'm planning on using Robostix as a part of a control system for a robotic arm, and wish to use encoders to determine the arm's position. Does anyone have experience using encoders with Robostix? If so, what types/brands/etc. have worked for you, and do you have any code I might be able to take a loo= k at? In addition, does anyone know how many encoders could possibly be used with Robostix (I'm assuming this is limited by the number of possible interrupts, but am not sure how many pins in the "Interrupts" group can actually be used as interrupts. Thanks in advance. -Ian |
From: Dave H. <dhy...@gm...> - 2006-03-22 06:13:17
|
Hi Ian, On 3/21/06, Ian Lenz <fla...@gm...> wrote: > I'm planning on using Robostix as a part of a control system for a roboti= c > arm, and wish to use encoders to determine the arm's position. Does anyon= e > have experience using encoders with Robostix? If so, what types/brands/et= c. > have worked for you, and do you have any code I might be able to take a l= ook > at? In addition, does anyone know how many encoders could possibly be use= d > with Robostix (I'm assuming this is limited by the number of possible > interrupts, but am not sure how many pins in the "Interrupts" group can > actually be used as interrupts. Thanks in advance. Actually, you generally don't need to use interrupts unless the encoder is going really fast. I've used these: http://www.acroname.com/robotics/parts/R253-WW02.html on an ATMega32. The motors run about 60 RPM, and the encoder disk has 32 stripes on it. If you full quadrature, that's 128 counts/rev, which at 60 RPM is 128 counts/second. I set it up to poll every millisecond, which is 8 times over sampled. At millisecond sampling, you could easily go up to 512 counts/sec (so 240 RPM). You could probably sample much higher than once every millisecond as well. The polling approach allows many encoders to be used, and is less susceptible to noise issues. I've attached the Encoder.h and Encoder.c file that I used in my bot. It was done as an inline function so I could include it right in my timer tick ISR. My definitions for the various pins and masks was in Hardware.h and looks l= ike: //-------------------------------------------------------------------------= - // Encoder Inputs // #define ENCODER_R_A_PIN PIND // INT0 =3D Port D pin 2 #define ENCODER_R_A_BIT 2 #define ENCODER_R_A_MASK ( 1 << ENCODER_R_A_BIT ) #define ENCODER_L_A_PIN PIND // INT1 =3D Port D pin 3 #define ENCODER_L_A_BIT 3 #define ENCODER_L_A_MASK ( 1 << ENCODER_L_A_BIT ) #define ENCODER_R_B_PIN PINC #define ENCODER_R_B_BIT 5 #define ENCODER_R_B_MASK ( 1 << ENCODER_R_B_BIT ) #define ENCODER_L_B_PIN PINC #define ENCODER_L_B_BIT 2 #define ENCODER_L_B_MASK ( 1 << ENCODER_L_B_BIT ) -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ |
From: Jean-Francois R. <jf....@re...> - 2006-03-22 18:53:06
|
Hi Ian, I use a lot of rotary and linear encoder in my project. For a low cost encoder, that does not have a resolution of more than 2500 line, you should look at the US Digital product line (http://www.usdigital.com) I've developed a software quadrature decoder, but it was too slow for our application that use 1 um linear glass scale. For a robot that use low resolution rotary encoder it should not be a problem. Anyway, I've just uploaded the code I developed to decode quadrature on the AVR to our web server. I hope it will be useful to you. You can get it there: http://www.realfafard.com/fafard/index.php?id=31 On Tue, 2006-03-21 at 20:41 -0500, Ian Lenz wrote: > I'm planning on using Robostix as a part of a control system for a > robotic arm, and wish to use encoders to determine the arm's position. > Does anyone have experience using encoders with Robostix? If so, what > types/brands/etc. have worked for you, and do you have any code I > might be able to take a look at? In addition, does anyone know how > many encoders could possibly be used with Robostix (I'm assuming this > is limited by the number of possible interrupts, but am not sure how > many pins in the "Interrupts" group can actually be used as > interrupts. Thanks in advance. > -Ian -- Jean-Francois Richard <jf....@re...> Real Fafard Inc. |