How do you hook up a rotary incremental encoder to a Arduino Leonardo? Can someone please post a diagram or some instructions?
PS my encoder has 5 pins
Ground, +5V, Index, A channel, B channel
How do you hook up a rotary incremental encoder to a Arduino Leonardo? Can someone please post a diagram or some instructions?
PS my encoder has 5 pins
Ground, +5V, Index, A channel, B channel
Since you know what the pins are, you probably also know the identity of the bugger and the data sheet can tell you how it operates and that will tell you how to hook it up. Beyond that, it's up to you.
If you want help, you have to supply a starting point.
Paul
Google "arduino rotary encoder" for hundreds of examples and tutorials.
Thank you guys for the reply. I understand the 5V connection, and I know A and B have to go to Digital 2 and Digital 3, but where do I put the index?
jblack155:
Thank you guys for the reply. I understand the 5V connection, and I know A and B have to go to Digital 2 and Digital 3, but where do I put the index?
Since you write that it is an incremental encoder, the index will supply one pulse per step of the encoder. You don't need to connect it anywhere if you are not using it as an incremental encoder.
If you want to use it, then the A abd B will tell you the direction of the movement and index will tell you there has been one step in that direction.
Of course, the A and B will tell you the same thing, plus the direction.
Paul
Thank you Paul. That clears it up. BTW what is the best way to supply the 5V to the Leo? My batteries are 1.5V each. Can I supply 1.5V x 3 = 4.5V?
BTW2 do you know why the Digital #4 pin does not have a ~? All the others are labelled ~1, ~2 etc.
jblack155:
Thank you Paul. That clears it up. BTW what is the best way to supply the 5V to the Leo? My batteries are 1.5V each. Can I supply 1.5V x 3 = 4.5V?BTW2 do you know why the Digital #4 pin does not have a ~? All the others are labelled ~1, ~2 etc.
No clue, and this is what you get when you post in different forums concerning the SAME project. What you ask makes NO sense, unless someone bothers to look up your other posts and discover what you are asking about relates to the other postings.
Paul
The index pin tells you when the shaft is at the "zero" position, defined by the index sensor.