1

I have this encoder: https://www.mouser.com/ProductDetail/Bourns/PEC12R-4020F-S0024?qs=sGAEpiMZZMsUJpHmmVieqHTo0n9kjhYO9zCZFTxUfRg%3D&countrycode=US&currencycode=USD

and I am trying to figure out how it is supposed to be wired.

I think the A & B terminals are supposed to be wired to the input of an MCU (or other sensing IC), and the C terminal is supposed to be wired to GND.

I am not sure where the 5V is supposed to go since this component only seems to have three pins???

Here is what the datasheet shows:

enter image description here

Edit: this is how I think it is supposed to be wired. Terminals A and B are internally connected to terminal C through the switches that get closed as the encoder rotates through the contact points.

enter image description here

RGB Engineer
  • 808
  • 4
  • 19
  • 1
    I think HP used to make ICs for quadrature counting. No idea if they do, today. These days a very cheap MCU can do everything for you. I wouldn't necessarily refer to their diagram's filter circuit. It basically has a common, with an added A and B pin. Best thing, given what appears to be a little ignorance so far, is to just take it easy and get one of them and find an MCU you like. Protoboard up the connections to your MCU and experiment. You can connect the common to (+) or ground or whatever you want (another I/O pin, if you want.) Is this just to be a user-input device with a knob? – jonk Jan 27 '22 at 03:46
  • This is a really fun device to play with, by the way! You will really enjoy the learning process. – jonk Jan 27 '22 at 03:47
  • @jonk That diagram is super confusing. At first glance, it looks like you're supposed to connect the part's terminals to the points labelled 'Terminal A/B (presumably)/C'. The user is better-off designing their own debouncing filter, or using the built-in pull-up resistor and debounce in firmware – Victor Souza Jan 27 '22 at 03:54
  • @VictorSouza I tend to agree with your comment, too. I think RGB is looking for something to "just follow" and isn't ready to think on their own on this project. But I think these kinds of devices, with the right motivation, are a great segue towards more learning experiences. I suspect RGB may need some hand-holding with respect to the three pins and the many options (if to learn how to handle themselves without help, later) or else a simple solution schematic (if they don't want to learn and just want to make something.) But I love little sub-projects like this. A lot can be learned. – jonk Jan 27 '22 at 03:58
  • Please see the edits to the post. @jonk , I was not asking for my hand to be held - I was just asking for a little help clarifying a convoluted datasheet. – RGB Engineer Jan 27 '22 at 04:12
  • @RGBEngineer It's simple enough. There are three wires. One of them is a common to two switches (equivalents.) The other two are the other ends of those two switches. That's all it is, other than the fact that the switches, A and B, operate in quadrature. Just take any two SPST switches you like, wire one side of both together, leave the other two ends free. Same situation. – jonk Jan 27 '22 at 04:16
  • the encoder is just two mechanical switches – jsotola Jan 27 '22 at 04:26
  • @RGBEngineer [This](https://www.digikey.com/en/products/detail/bourns-inc/ENS1J-B28-L00256L/1089392) is what I buy, though I get them cheaper than that. – jonk Jan 27 '22 at 04:35

2 Answers2

2

That circuit is very confusing, but as I understand it, the encoder itself is everything inside the dashed line. Everything else has to be provided by the designer. More to the point, 5 Vdc doesn't connect directly to the encoder, it's there to provide power to the debouncing filters for channel A and B

Victor Souza
  • 396
  • 1
  • 9
1

The encoder should have 3 or 5 pins plus the two mounting lugs. Typically the latter would go to earth or ground, or you can leave them open for testing but it's better to do something with ESD especially if the shaft is metal.

The outer two of the 3 pins in a row are the quadrature outputs and the middle one is ground.

The remaining two pins on the other side (if present) are for a N.O. switch that is actuated by pushing on the shaft. You would (say) ground one pin and connect the other to Vdd through a resistor.

You add the parts shown in the schematic (only the pullup resistors are 100% required) and connect the A and B signals to an MCU. You can use GPIO pins and an appropriate program- it's not necessary to use an MCU with dedicated QEI hardware- in fact it may make it more difficult. If you use the capacitors and 10K resistors in conjunction with an MCU that has Schmidt trigger inputs you may be able to simplify the program a bit, since debouncing in hardware may be adequate.


Edit: your schematic looks okay, however the middle pin should be ground so it would be pin B if they are numbered in order A/B/C.

Edit': Below is the symbol I made for a particular encoder. Probably one of the first I made in Altium, not claiming it's wonderful or anything. IIRC this particular encoder is guaranteed to have both A and B open when the shaft is in a detent position, hence the diagram showing open.

enter image description here

Spehro Pefhany
  • 376,485
  • 21
  • 320
  • 842
  • Appreciate the response. I added a screenshot of how I wired it up in my schematic - does that look right to you? – RGB Engineer Jan 27 '22 at 04:14
  • The footprint goes "A, C, B" from left to right, but I just made it "A, B, C" from top to bottom for the schematic because it looked cleaner with the GND pin at the bottom. – RGB Engineer Jan 27 '22 at 04:16
  • 1
    I added an edit. The series 10K resistors to A/B are optional but help greatly with ESD and can also be used (with the caps) as a debouncing filter. Personally, I use neither if the encoder is on a PCB close to the MCU and has a good ground. – Spehro Pefhany Jan 27 '22 at 04:16