Author Topic: Rotary Encoder Replacement  (Read 1878 times)

0 Members and 1 Guest are viewing this topic.

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Rotary Encoder Replacement
« on: June 22, 2024, 12:35:40 am »
I purchased another Agilent 54831M scope with a broken rotary encoder (and missing knob that I’ll need to 3D print).

It’s 16 detents and not a push switch.

Most likely I’ll need to find an alternate and retro fit it, but thought to try asking if anyone knows the manufacture or recognize the part number. A Google search didn’t reveal any significant matches when I tried 0321 or 1-2-16.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Rotary Encoder Replacement
« Reply #1 on: June 25, 2024, 03:35:52 am »
I've continued searching for this encoder, however, I haven't had any luck with the exception of someone selling used ones on eBay for around $75.

My assumption at this point is finding a replacement that I can retro fit in. Unfortunately I can't take any voltage measurements due to needing the entire oscilloscope assembled, and I didn't see any silkscreen markings to indicate voltages.

Earlier I took some resistance measurements to get an idea of the pin configuration, but could use a bit of help.

Since this is a Win95 based scope, I'm assuming this larger size encoder is due to older technology and not because it's a high power circuit. Does anyone disagree?

With this being said, I'm guessing most modern sized encoders will electrically work, but I'm uncertain about pin configuration.

Attached are the pins arbitrarily marked by me (1, 2, and 3) and found all the encoders have pin 1 common (Initially I thought this was Vcc, but, after looking at pin configurations online, I believe this is ground).

Pin configurations as I turn the knob are as follows (keep in mind it's a 16 detent):

At position 0 (shaft turned so the flat side is horizontal and the round part is on the bottom) - none of the pins have continuity

One click clockwise - pin 1 and 2 shorted

Another click clockwise - 1, 2, and 3 are shorted

Another click clockwise - 1 and 3 shorted

another click clockwise - no pins shorted (it seems to start over where it was at position 0 because another click clockwise shorts pins 1 and 2 again.

With these measurements, does a certain configuration I should look for when buying a replacement?
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1666
  • Country: au
Re: Rotary Encoder Replacement
« Reply #2 on: June 25, 2024, 06:16:52 am »
With these measurements, does a certain configuration I should look for when buying a replacement?
That looks like a conventional quadrature encoding. 
You may find the convention for CW-CCW varies, in which case you swap the quad pins.

Does this spin 360', no stops, for 16 ppr ?  What is the bushing dia and shaft dia ?>

Is that locked to a legend, or is 12 or 20 or 24 ppr going to be ok too ?

Mouser show a small screw bush  3315Y-112-016L ? Tho the image does not quite match the part ID ?
lcsc have some 16 step switches, but they look mostly absolute Gray coded. (You can flip most to Quad with a 3ip XOR gate, but that needs power/gnd)
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2084
  • Country: us
Re: Rotary Encoder Replacement
« Reply #3 on: June 25, 2024, 02:32:57 pm »

Pin configurations as I turn the knob are as follows (keep in mind it's a 16 detent):

At position 0 (shaft turned so the flat side is horizontal and the round part is on the bottom) - none of the pins have continuity

One click clockwise - pin 1 and 2 shorted

Another click clockwise - 1, 2, and 3 are shorted

Another click clockwise - 1 and 3 shorted

another click clockwise - no pins shorted (it seems to start over where it was at position 0 because another click clockwise shorts pins 1 and 2 again.

With these measurements, does a certain configuration I should look for when buying a replacement?

That seems to me to be a very odd pattern.  Well, the pattern looks normal, but not with a detent at each position.  I think the typical encoder would have both switches open at every detent (the same number of "pulses" per revolution as detents per revolution), or both switches either open or closed at each detent (twice as many detents as pulses per revolution).  The picture below shows the pattern for the latter type, with detents shown as vertical dashed lines.  But yours has a detent at each change of state of either switch.  So it would be four times as many detents as pulses.  A "pulse" is one complete cycle of  both switches, which would be four state transitions.

I've never seen an encoder like yours, but perhaps it provides a way of narrowing the search.  But I don't know if pulses-vs-detents searches are possible.  It doesn't look like Digikey would be helpful.

If you are getting these readings when you turn the knob, in what sense is the encoder "broken"?
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Rotary Encoder Replacement
« Reply #4 on: June 25, 2024, 03:06:14 pm »
Uh oh, sounds like this encoder may be unique; not something I was hoping to hear.

The encoder shaft is broken and why it needs to be replaced. This was one of the three issues listed when I purchased this scope (the main issue I easily fixed, the second is a damaged BNC which I haven't dug into searching for a replacement yet, and the third is a missing knob and broken encoder shaft). The knob can be 3D printed, the BNC I'm holding my breath, and this encoder I'm now concerned with.

The encoder turns endlessly in both CW and CCW and the shaft length is (going by memory and having measured a good one) 0.55". The part numbers differ slightly and it seems the only difference is: the black shafts have detents and the blue shafts don't.

Replacing it with 16 detents isn't exactly imperative, however, it won't be consistent with the other same model unit, so I'd prefer 16 detents. The biggest concern now is whether the pulses match a modern encoder.

If I can't find one, I'll have to resort to paying $75 from the seller on eBay plus S&H.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2084
  • Country: us
Re: Rotary Encoder Replacement
« Reply #5 on: June 25, 2024, 03:13:56 pm »
I searched on Digikey for 4 ppr encoders, and found this one:

https://www.digikey.com/en/products/detail/cts-electrocomponents/288X232R161B2/270037

As long as the shaft length is long enough, you can always cut it down to size with a Dremel tool. And if it has a push button, that wouldn't hurt anything.

But if it's just the shaft that's broken, could you cut off what remains down to a flat plane, and epoxy a replacement shaft?


 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Rotary Encoder Replacement
« Reply #6 on: June 25, 2024, 03:36:56 pm »
Cutting the shaft to length isn't an issue (I included shaft length just to provide details of my part). I considered exactly what you suggested with epoxy, but question the longevity of the epoxy holding.

More than likely it will hold, but removing this PCB is such a pain that I'd hate to deal with the shaft breaking again in the future.

The mechanical aspect of the encoder I somewhat grasp. When point A touches a pin before B, it's one direction; and when B touches a pin before A, it's the other direction.

As for PPR, how can I tell whether the same pins will conduct per each detent? I would have assumed in all cases two pins are always conducting, it just matters which one touched first in the eyes of the IC that reads the pulses.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2084
  • Country: us
Re: Rotary Encoder Replacement
« Reply #7 on: June 25, 2024, 04:04:09 pm »
It turns out Digikey also stocks the no-push-button version, which is the one you would want:

https://www.digikey.com/en/products/detail/cts-electrocomponents/288T232R161A2/203827

You would need to study the datasheet to see if this is even the matching orientation for what you have - 288T vs 288X or 288V.  Then, it identifies the pins as A, B and C, with C being the common ground connection.  And it has a truth table that shows which pins (A or B) go low as you turn the knob, presumably in the clockwise direction.

https://www.ctscorp.com/Files/DataSheets/Encoders/encoders-288-datasheet.pdf

But if it looks like it will physicall fit, you may have to just buy one and see if it produces the same pattern as yours.  I would expect that these switches follow an industry standard for pinout, but I can't guarantee that.

Edit: Actually, it looks like the pinout is different from yours.  You have the common at the end, and this one has the common in the middle.

Edit2:  However, if the encoder is held in place by the nut and washer, then you might be able to make the pinout whatever you need - just connect the encoder terminals to wires, and then to the board, but just not straight across.
« Last Edit: June 25, 2024, 04:23:40 pm by Peabody »
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Rotary Encoder Replacement
« Reply #8 on: June 25, 2024, 04:54:30 pm »
Quote
Edit2:  However, if the encoder is held in place by the nut and washer, then you might be able to make the pinout whatever you need - just connect the encoder terminals to wires, and then to the board, but just not straight across.

This was part of the retrofitting I planned. My main concern is finding one that produces the same pattern when turned, followed by fitting in the PCB hole, then detents, and a shaft length that's correct or too long and needs to be cut.

I agree on industry standard, but this being a Win95 based scope, and possibly an Agilent part, who knows. Worst case I buy the $75 $90 + $12 S&H or whatever one from eBay, but with the scope purchase cost, parts, upgrades, etc... it puts me at what I could have purchased a working one for in good condition.

I'll take a look at the links you provided.

Also, mine has a tab that fits into a hole on the PCB. Most likely this is to secure it better than just the nut, however, soldering wires from pin to pads is probably enough extra mechanical security, so I'm not worried about this tab either.

Update: if I understand the datasheet correctly, if A = 1 and B = 0, this means A is connected to ground only in this state. If this is the case, you may have found the correct pattern since (from what I interpret) matches the pattern I listed from measurements.
« Last Edit: June 25, 2024, 05:38:49 pm by bostonman »
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1666
  • Country: au
Re: Rotary Encoder Replacement
« Reply #9 on: June 25, 2024, 09:08:27 pm »
Replacing it with 16 detents isn't exactly imperative, however, it won't be consistent with the other same model unit, so I'd prefer 16 detents. The biggest concern now is whether the pulses match a modern encoder.

If I can't find one, I'll have to resort to paying $75 from the seller on eBay plus S&H.

16ppr is less common, but they can be found.
The ones in #5,#7 looks quite good, it is incorrectly tagged 4ppr, on the Digikey columns so missed a 16ppr search.
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2084
  • Country: us
Re: Rotary Encoder Replacement
« Reply #10 on: June 25, 2024, 10:26:07 pm »
Replacing it with 16 detents isn't exactly imperative, however, it won't be consistent with the other same model unit, so I'd prefer 16 detents. The biggest concern now is whether the pulses match a modern encoder.

If I can't find one, I'll have to resort to paying $75 from the seller on eBay plus S&H.

16ppr is less common, but they can be found.
The ones in #5,#7 looks quite good, it is incorrectly tagged 4ppr, on the Digikey columns so missed a 16ppr search.

Oh no, it's 4PPR.  It's 16 detents per revolution, but only 4 pulses per revolution.  Four detents per single pulse.

 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1666
  • Country: au
Re: Rotary Encoder Replacement
« Reply #11 on: June 25, 2024, 10:45:21 pm »
Replacing it with 16 detents isn't exactly imperative, however, it won't be consistent with the other same model unit, so I'd prefer 16 detents. The biggest concern now is whether the pulses match a modern encoder.

If I can't find one, I'll have to resort to paying $75 from the seller on eBay plus S&H.
16ppr is less common, but they can be found.
The ones in #5,#7 looks quite good, it is incorrectly tagged 4ppr, on the Digikey columns so missed a 16ppr search.

Oh no, it's 4PPR.  It's 16 detents per revolution, but only 4 pulses per revolution.  Four detents per single pulse.

They really should stop worrying about cycles in quadrature encoders and instead focus on edges.
Most vendors talk about the number of resolvable positions when they talk about pulses and detents, which is what the user sees.
CTS call this 'combination'

No one really cares how many electrical full cycles might have happened.
Even the CTS data sheet does not mention PPR, but they do talk about pulses, claiming a 4 bit Gray Code is a single pulse    :palm:
The CTS webpage has newer 11/12 series parts following the more modern convention of detents = resolution, it's the older ones they mangle.
« Last Edit: June 25, 2024, 10:52:13 pm by PCB.Wiz »
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2084
  • Country: us
Re: Rotary Encoder Replacement
« Reply #12 on: June 25, 2024, 10:48:08 pm »
Update: if I understand the datasheet correctly, if A = 1 and B = 0, this means A is connected to ground only in this state. If this is the case, you may have found the correct pattern since (from what I interpret) matches the pattern I listed from measurements.

Traditionally, the truth tables are based on the assumption that the pin is held high with a pullup resistor when its switch is open, and is grounded when the switch is closed, pulling the line low.  But of course it could be the opposite setup with pulldown resistors and Vcc.  So really you just need to know when the switch is closed, which means the pin in question (A or B) is connected to the common pin.  So rather than assuming a voltage, you would just test for continuity in resistance mode on your meter.

If your encoder is an incremental quadrature encoder, as it certainly seems to be from your description, then the one I found will very likely work.  Both should have a common pin and A and B pins, and produce the same pattern.  The pinouts of C, A & B may be different.  But I think that can be solved  using wires that crossover going to the board.  But the logic pretty much has to be the same.  Starting from no continuity to any pin, turning CW first connnects A to the common, then B connects, then A disconnects, then B disconnects, and you 're back to the beginning.

It would seem to me that you could buy the cheap part from Digikey for about $10 including shipping, and if it works you've saved a bunch of money.  If it doesn't, you're out $10.  And you can confirm when you get it that the output is the same.  But I still urge you to study the datasheet to see if it's the right size and orientation.

 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2084
  • Country: us
Re: Rotary Encoder Replacement
« Reply #13 on: June 25, 2024, 11:07:39 pm »

They really should stop worrying about cycles in quadrature encoders and instead focus on edges.
Most vendors talk about the number of resolvable positions when they talk about pulses and detents, which is what the user sees.
CTS call this 'combination'

No one really cares how many electrical full cycles might have happened.
Even the CTS data sheet does not mention PPR, but they do talk about pulses, claiming a 4 bit Gray Code is a single pulse    :palm:

Yes, I was uncertain what a "pulse" was, and still don't think it's a good term.  But basically for coding purposes you have to know what exactly goes on between two detents.  You want whatever that is to be a delta of 1 when decoded, but it could be a full "pulse" - a full cycle of both switches, which is four switch transitions.  Or it could be two transitions.  Or as in the OP's case, it could be one transition.  He has to get one like his original or he'd end up getting a delta of 2, or even 4, on each detent.   Or he'd have to rotate through two detents to get a delta of 1, or even four detents.  That's assuming he can't change the firmware.

Anyway, I think the disgram below shows what he has, based on his description.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1666
  • Country: au
Re: Rotary Encoder Replacement
« Reply #14 on: June 25, 2024, 11:11:34 pm »
Anyway, I think the disgram below shows what he has, based on his description.

Yes, one detent per edge is the most common quad encoder.  Anything else confuses users.
 

Offline enut11

  • Frequent Contributor
  • **
  • Posts: 984
  • Country: au
  • Love building/modifying/restoring test equipment
Re: Rotary Encoder Replacement
« Reply #15 on: June 26, 2024, 01:03:38 am »
Cutting the shaft to length isn't an issue (I included shaft length just to provide details of my part). I considered exactly what you suggested with epoxy, but question the longevity of the epoxy holding.

More than likely it will hold, but removing this PCB is such a pain that I'd hate to deal with the shaft breaking again in the future.


A better way to fix a broken plastic shaft:
Carefully drill a center hole in both parts. As it is difficult to align the holes perfectly, make one oversize. Use a steel pin and epoxy to finish the repair.
an electronics nut from wayback...
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Rotary Encoder Replacement
« Reply #16 on: June 26, 2024, 03:08:04 am »
Here is some irony.

Trying for a long shot while at work, I dug into an old box of parts that will eventually be discarded and found an encoder (part number: 25LB22-Q) that appeared very similar to mine. It had 16 detents, shaft looked like a good length, etc...

I brought it home and tried fitting it onto the board. With the exception of the back side circuit board on the encoder being a little long and the shaft slightly shorter (only by a mm or two), the thing fit perfectly. It even has a little plastic tab which ALMOST fit into the hole on the circuit board, but I managed to fit it after a little filing. With a dab of epoxy, it should sit nice and tight without the possibility of wiggling.

Attached are measurements I took. This time I put both encoders aside each other to match pin measurements with the top being the shaft facing upwards and pins (labeled by me) going left to right 1-2-3 (I included a visual in the attachment).

Click 1 and 3 are the two that are different, however, if I'm thinking about this correctly, the connections would be as follows (pin numbering as I'm calling it in my attachment):

Original pin 1 is connected to new encoder pin 3
Original pin 2 is connected to new encoder pin 1
Original pin 3 is connected to new encoder pin 2

If my wiring list is correct, and the encoder seems to fit perfectly, the question is: can this encoder be reverse meaning it really thinks it's turning CCW when turned CW, or is this something I'll need to figure out once it's assembled?

« Last Edit: June 26, 2024, 03:13:13 am by bostonman »
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1666
  • Country: au
Re: Rotary Encoder Replacement
« Reply #17 on: June 26, 2024, 03:29:44 am »
If my wiring list is correct, and the encoder seems to fit perfectly, the question is: can this encoder be reverse meaning it really thinks it's turning CCW when turned CW, or is this something I'll need to figure out once it's assembled?
You can reverse the apparent direction by swapping the 2 quad pins.
 

Offline tunk

  • Super Contributor
  • ***
  • Posts: 1021
  • Country: no
Re: Rotary Encoder Replacement
« Reply #18 on: June 26, 2024, 12:34:04 pm »
A better way to fix a broken plastic shaft:
Carefully drill a center hole in both parts. As it is difficult to align the holes perfectly, make one oversize. Use a steel pin and epoxy to finish the repair.
You could make a 3D printed template to center the drill.
Filing the end flat may also help.
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Rotary Encoder Replacement
« Reply #19 on: June 26, 2024, 02:30:38 pm »
Quote
You can reverse the apparent direction by swapping the 2 quad pins.

So it needs to be tested to confirm the rotation direction? Would I be better off building a test circuit and comparing both encoders rather than assemble the entire scope?
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2084
  • Country: us
Re: Rotary Encoder Replacement
« Reply #20 on: June 26, 2024, 02:43:35 pm »
The data in your new PDF does not match what you posted in reply #1 for the "original" encoder.  Have you changed the pin numbering?

Edit:  Anyway, I agree with your conclusion:

Original pin 1 is connected to new encoder pin 3  -  B
Original pin 2 is connected to new encoder pin 1  -  A
Original pin 3 is connected to new encoder pin 2  -  C

If you connect it that way, you don't need to test for direction.  It can't really be wrong.



« Last Edit: June 26, 2024, 02:57:35 pm by Peabody »
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Rotary Encoder Replacement
« Reply #21 on: June 26, 2024, 03:36:37 pm »
Quote
The data in your new PDF does not match what you posted in reply #1 for the "original" encoder.  Have you changed the pin numbering?

Maybe I didn't explain correctly and/or added confusion - sometimes I have a habit of leaving out an important detail.

Originally I measured the encoders still on the PCB which I accessed from the rear (i.e. back side of the encoder) of the PCB. First I figured out which position none of the pins were connected, placed them all in the same position (flat side horizontal with the curve on the bottom), and learned which pin was common to all the encoders. I arbitrarily numbered them 1, 2, and 3 (again from the back side of the encoder).

Yesterday I placed the 'new' encoder and the 'broken' encoder that I removed from the PCB side-by-side, laid them with the back side on the bottom and shaft pointing up rather than taking one set of measurements from the back side and another from the front. The pins were facing me and I arbitrarily labeled them 1, 2, and 3; this allowed me to make sure I measured the same pins at the same points.

In the PDF I attached yesterday, I drew a (poorly) laid out description showing this and adjusted all the measurements according to this pin measuring configuration.

Quote
If you connect it that way, you don't need to test for direction.  It can't really be wrong

Is this true? What if the pins are tied together during a specific click, but A touched ground before B rather than B touching ground first.
« Last Edit: June 26, 2024, 03:38:38 pm by bostonman »
 

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2084
  • Country: us
Re: Rotary Encoder Replacement
« Reply #22 on: June 26, 2024, 04:33:53 pm »
The software will detect the pin transitions when they take place, and will keep track of the previous state.  So if we define the A pin as the one that first connects to the C pin when turning the knob CW, then if you connect the A pin of the new encoder to the hole where the A pin of the old encoder was connected, the direction has to work the same as it did with the old encoder.  But of course you can rig up a circuit to confirm that if you like.

The key to decoding the encoder is the previous state.  If you have a transition, and now pin A is connected to pin C, you have a +1 increment from a CW turn if previously neither pin was connected to C.  But if the previous state was with both A and B connected to C, then you've had a -1 CCW transition.

 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1666
  • Country: au
Re: Rotary Encoder Replacement
« Reply #23 on: June 26, 2024, 07:56:20 pm »
Quote
You can reverse the apparent direction by swapping the 2 quad pins.

So it needs to be tested to confirm the rotation direction? Would I be better off building a test circuit and comparing both encoders rather than assemble the entire scope?
If the scope is a dog to assemble, then certainly a quick side by side circuit check with LEDs will be great.
Then you can prove you have it correct.  8)
 

Offline bostonmanTopic starter

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Rotary Encoder Replacement
« Reply #24 on: June 27, 2024, 12:48:06 am »
My thought was pull up resistors with both leads connected to a scope. Then I could look to see which pulse occurs first.

If it's software controlled where it looks for the previous stage, then the idea I had to conduct a bench test may not work unless I get some micro - and I lack knowledge/experience with getting an Arduino or Pi to interface (or even getting a program onto one).

Disassembling the scope is a pain, but I've also learned the more something gets disassembled and assembled, the better chance of something breaking. :)

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf