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
Rotary Encoder + Extras ID: 377
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Rotary Encoder + Extras ID: 377
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?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.
-
- Posts: 3
- Joined: Sun Dec 16, 2012 7:23 pm
Re: Rotary Encoder + Extras ID: 377
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.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Rotary Encoder + Extras ID: 377
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.The problem that we are encountering is that the encoder only outputs 2 basic values, 1 and 0.
http://www.adafruit.com/datasheets/pec11.pdf
- zener
- Posts: 4567
- Joined: Sat Feb 21, 2009 2:38 am
Re: Rotary Encoder + Extras ID: 377
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.
-
- Posts: 3
- Joined: Sun Dec 16, 2012 7:23 pm
Re: Rotary Encoder + Extras ID: 377
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.
- zener
- Posts: 4567
- Joined: Sat Feb 21, 2009 2:38 am
Re: Rotary Encoder + Extras ID: 377
Have you put a meter, scope, or LEDs on the encoder outputs to verify they are transitioning?
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Rotary Encoder + Extras ID: 377
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?
Does this mean that you removed the encoder from your circuit and connected it directly to an arduino?
Please be positive and constructive with your questions and comments.