PaulStoffregen / Encoder

Quadrature Encoder Library for Arduino
http://www.pjrc.com/teensy/td_libs_Encoder.html
540 stars 239 forks source link

undercounting steps only in one direction, only when going slowly, with a linear encoder #87

Open kittles opened 1 year ago

kittles commented 1 year ago

Description

I have a linear encoder (x axis dro from a mill) which has 5000 steps per inch. I've confirmed it a quadrature encoder and i have the pinout correct. When using the encoder library with pins 2 and 3 on an elegoo uno r3, it reads correctly one direction, but in the other direction is vastly undercounts- but oddly, only if im moving it slowly. if i move the encoder head quickly in the problem direction, it counts the steps fairly accurately.

Steps To Reproduce Problem

probably cant since you dont have my specific encoder- unless you have a random chinese import sgc-6 500mm linear encoder

Hardware & Software

Board: Elegoo uno r3 Arduino IDE version: 2.0.3

Arduino Sketch

#include <Encoder.h>
Encoder my_enc(2, 3);

void setup() {
  Serial.begin(9600);
}
void loop() {
  Serial.println(my_enc.read());
}