Go Down

Topic: What kind of input is used to connect an encoder? (NEWBIE) (Read 740 times) previous topic - next topic

MickyMike

I need to connect a rotary encoder to Arduino.

what kind of input is used to connect an encoder, analog o digital?

Some example?

Thanks!

fungus

Advanced Arduino

MickyMike

I need to connect one like this https://www.sparkfun.com/products/9117

fungus

You can use any but most driver libraries require it to be connected to D2 and D3.
Advanced Arduino

knut_ny

Ny

MarkT

For an encoder like that, namely mechanical switch, digital inputs will do, but you have
to be wary of contact-bounce - this means you _must_ use an encoder library or code that
counts every transition on both A and B signals or risk miscounting.  (Alternatively sample
the inputs at a high enough rate to never miss one of the states).

For optical encoders with analog outputs, the best approach is signal-conditioning circuitry,
usually 74HC14 schmitt-trigger inverters to clean up the analog output to a digital logic
signal (While you could use the ADC for this, its possibly not fast enough and wasteful of
resources).

For generic encoder units you typically get open-collector logic outputs, so INPUT_PULLUP
is your friend (as it is with such rotary switches).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up