Rotary Encoder + Extras ID: 377

by rangerchewy on Sat Feb 16, 2013 10:45 am

Recently my partner and I ordered a rotary encoder to use on our robot arm too control the stepper motor. Upon opening and testing it, it does not work fully and does not successfully control the electrical flow to the motor, causing it to randomly turn on and off. We have competition at the end of this week and would like to get a new one to replace the broken one we have received.

Thank you
rangerchewy
 
Posts: 3
Joined: Sun Dec 16, 2012 6:23 pm

Re: Rotary Encoder + Extras ID: 377

by adafruit_support_bill on Sat Feb 16, 2013 11:03 am

Upon opening and testing it, it does not work fully and does not successfully control the electrical flow to the motor, causing it to randomly turn on and off.

I don't understand. This is a sensor not a controller. Your software needs to read the pulses from the sensor to control the motor. How do you have it connected? What control algorithm are you using?
User avatar
adafruit_support_bill
 
Posts: 25398
Joined: Sat Feb 07, 2009 9:11 am

Re: Rotary Encoder + Extras ID: 377

by rangerchewy on Sat Feb 16, 2013 1:49 pm

Partner here. Yes, we have it connected as a sensor. Middle pin to ground, left and right to the interrupt pins (pulled high) on the Arduino. We tried several methods to read values from the encoder including the encoder library found at http://www.pjrc.com/teensy/td_libs_Encoder.html. The problem that we are encountering is that the encoder only outputs 2 basic values, 1 and 0. If the encoder is "clicked" into a segment the value read is a 0; if the encoder is between segments the value read is a 1. This has been verified using the serial console. The stepper motor is controlled with a stepper controller and works as expected (we tested it using inputs other than the rotary encoder). This has lead me to believe that the encoder is faulty.
rangerchewy
 
Posts: 3
Joined: Sun Dec 16, 2012 6:23 pm

Re: Rotary Encoder + Extras ID: 377

by adafruit_support_bill on Sat Feb 16, 2013 2:53 pm

The problem that we are encountering is that the encoder only outputs 2 basic values, 1 and 0.

Yes, this is normal. The output is quadrature encoded on the two output pins. The output on both pins is 0 when at a detent position . When you turn clockwise, the A pin will go high before the B pin, then low again before the B pin. When turning counter clockwise, the phasing is reversed.

http://www.adafruit.com/datasheets/pec11.pdf
User avatar
adafruit_support_bill
 
Posts: 25398
Joined: Sat Feb 07, 2009 9:11 am

Re: Rotary Encoder + Extras ID: 377

by Zener on Sat Feb 16, 2013 3:35 pm

Hmmm. I see some issues here. First of all this is a 2 channel binary encoder. Quadrature specifically. Anyway, it just puts out 0 and 1. If you are looking for some other output like 2 or 3.... You will be waiting a long time. Also this is not made for attaching to a motor. You can of course. It has a max speed spec of 60 RPM. Also there is contact bounce so you have to denounce. Maybe the library takes care of this. Don't know if that helps. If the 2 channels are transitioning then the encoder is working.
Zener
 
Posts: 2379
Joined: Sat Feb 21, 2009 1:38 am

Re: Rotary Encoder + Extras ID: 377

by rangerchewy on Sat Feb 16, 2013 10:20 pm

Right. The library that we are using and all of the other code implementations that we tried should handle reading the binary values. When using the library, myEncoder.read() returns the cumulative displacement for the encoder (since the code began executing) with clockwise rotation being positive and counterclockwise rotation being negative. In theory, turning the encoder 5 segments clockwise should increase the value of myEncoder.read() by 5. So if the value started at 0 it should now be 5 . However, the value is starting at 1 and remains 1 no matter which direction or how many times we turn it.
rangerchewy
 
Posts: 3
Joined: Sun Dec 16, 2012 6:23 pm

Re: Rotary Encoder + Extras ID: 377

by Zener on Sun Feb 17, 2013 1:24 pm

Have you put a meter, scope, or LEDs on the encoder outputs to verify they are transitioning?
Zener
 
Posts: 2379
Joined: Sat Feb 21, 2009 1:38 am

Re: Rotary Encoder + Extras ID: 377

by adafruit_support_rick on Sun Feb 17, 2013 2:13 pm

I think you stated earlier that you verified that the encoder states were transitioning. You said you verified this on the serial monitor.

Does this mean that you removed the encoder from your circuit and connected it directly to an arduino?
User avatar
adafruit_support_rick
 
Posts: 8473
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY