Author Topic: Struggling to get Rotary Encoder Reading  (Read 624 times)

0 Members and 1 Guest are viewing this topic.

Offline meshtronTopic starter

  • Regular Contributor
  • *
  • Posts: 142
  • Country: us
Struggling to get Rotary Encoder Reading
« on: August 22, 2024, 02:58:11 pm »
Last piece of a larger semi-complex (for me anyway) project and I can't seem to understand why this encoder is behaving the way it is.  Here is the encoder in question and here is its insert sheet (datasheet-ish).  I'm using an LS7366R Encoder Buffer breakout from SuperDroidRobots and while mine is a 3-channel, the links are broken for that one so the double (same thing with one less channel is here).  Datasheet for the actual LS7366R chip is here.

I'm powering the board - which in turn powers the encoder - with 6V which is within the spec and I have plenty of current available (powered from a buck regulator, not from a board pin or similar).  I have confirmed good SPI communication with the board, trouble is it just never counts any pulses.  I thought it was an SPI/driver issue, but at some point I decided to check the encoder output pulse with my handheld oscilloscope and now (I believe) I see the problem.  While I do get a nice square wave output, it only flips between 0V and about 0.6VDC.  That's not high enough to meet the minimum for the buffer (~2.5V) so pulses never get counted.

The part I'm struggling with is why the pulse voltage is so low.  The encoder buffer board from SDRobots has some pre-soldered jumpers that connect A and B to 1k pull-ups, I believe this to be the correct setup for an open collector encoder signal.  But, even though my cable length is short (about 30CM), I'm only seeing about 10% of that voltage on the outputs.  I've tried all 3 channels on the board just in case one was wonky, identical results every time.  I also tried upping the drive voltage to the encoder to 11.1V (max I have onboard) and still got about 10% of the voltage at the outputs - not enough to trigger counts.

The only similar things I can find in online searching are for cheapo encoders with either confusing or wrong spec sheets that actually need 12V to get their internals up and running, but this is a reputable part from a reputable manufacturer so I'm thinking that's unlikely to be the case.

I can't find anything in the encoder literature to indicate if this is an optical or hall-effect encoder, but I'm assuming open collector is open collector regardless.  I could try unsoldering the A and B jumpers to see if that helps, but feels like just making change for changes sake.  Not sure what to try next and really appreciate any guidance!

EDIT1: Added LS7366 datasheet link since SuperDroid part is just a breakout.
« Last Edit: August 22, 2024, 03:25:15 pm by meshtron »
 

Online Grandchuck

  • Frequent Contributor
  • **
  • Posts: 706
  • Country: us
Re: Struggling to get Rotary Encoder Reading
« Reply #1 on: August 22, 2024, 03:29:45 pm »
Open collector output
 

Offline CaptDon

  • Super Contributor
  • ***
  • Posts: 2013
  • Country: is
Re: Struggling to get Rotary Encoder Reading
« Reply #2 on: August 22, 2024, 03:53:40 pm »
GrandChuck, obviously O.C., he stated that in his post and says he has 1K pullups tied to the supply. I wonder if the encoder is designed for 5VDC max?
Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 
The following users thanked this post: meshtron

Online Grandchuck

  • Frequent Contributor
  • **
  • Posts: 706
  • Country: us
Re: Struggling to get Rotary Encoder Reading
« Reply #3 on: August 22, 2024, 03:59:55 pm »
GrandChuck, obviously O.C., he stated that in his post and says he has 1K pullups tied to the supply. I wonder if the encoder is designed for 5VDC max?
Ah yes, I re-read and saw the 1k pull ups.  Now, why only 0.6 volts?
 

Offline Andy Watson

  • Super Contributor
  • ***
  • Posts: 2120
Re: Struggling to get Rotary Encoder Reading
« Reply #4 on: August 22, 2024, 04:12:54 pm »
0.6V is suspiciously like the forward voltage drop of a silicon junction. Do the input voltages go high with the sensor removed? Is the polarity of the supply to the sensor correct? Do the 1k pull-ups actually pull up, or down.?

Quote
..., but feels like just making change for changes sake.
Need more information to debug this - so you're going to have to do something ;)
 
The following users thanked this post: meshtron

Offline meshtronTopic starter

  • Regular Contributor
  • *
  • Posts: 142
  • Country: us
Re: Struggling to get Rotary Encoder Reading
« Reply #5 on: August 22, 2024, 06:19:16 pm »
Yeah happy to do more work, just hesitant keep blindly turning knobs. I already let the smoke out of one encoder. :)

I did confirm A and B pins on the encoder board go high with the sensor disconnected.  Maybe I need to disassemble the encoder and see what's inside?
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7450
  • Country: ca
Re: Struggling to get Rotary Encoder Reading
« Reply #6 on: August 22, 2024, 06:30:04 pm »
Confirm the encoder's full part number for what output config it has: NPN open collector, totem pole/push-pull, or line driver. In case that got mixed up.
 
The following users thanked this post: meshtron

Offline meshtronTopic starter

  • Regular Contributor
  • *
  • Posts: 142
  • Country: us
Re: Struggling to get Rotary Encoder Reading
« Reply #7 on: August 22, 2024, 06:39:53 pm »
Good call, had not checked that.  But, it is what it's supposed to be.  The note about current consumption just says it's less than 90mA btw.
« Last Edit: August 22, 2024, 06:41:37 pm by meshtron »
 

Offline meshtronTopic starter

  • Regular Contributor
  • *
  • Posts: 142
  • Country: us
Re: Struggling to get Rotary Encoder Reading
« Reply #8 on: August 22, 2024, 07:31:59 pm »
Shows 4.5VDC-26.4VDC on the spec sheet and the label on the unit.

I guess next step is to breadboard it out with my DC power supply and see what I can learn with the buffer breakout/chip removed from the equation.
 

Offline meshtronTopic starter

  • Regular Contributor
  • *
  • Posts: 142
  • Country: us
Re: Struggling to get Rotary Encoder Reading
« Reply #9 on: August 23, 2024, 01:20:54 am »
It is with great shame and humility that I report I have solved this mystery.  There is still some unknown SPI issue, but it works just like it should on another Arduino.

TIL there is an attenuator selection switch on my probe (it was on 10X, setting it to 1X brought back the missing volts).  :palm:

Thanks for the input from you all!  (Yet another) lesson learned.
« Last Edit: August 23, 2024, 01:28:53 am by meshtron »
 

Offline meshtronTopic starter

  • Regular Contributor
  • *
  • Posts: 142
  • Country: us
Re: Struggling to get Rotary Encoder Reading
« Reply #10 on: August 23, 2024, 04:58:52 am »
And holy crap!  The mysterious SPI problem turned out to be a cheapo SD Card module holding MOSI high when not in use.  What a stupid series of problems.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3855
  • Country: nl
Re: Struggling to get Rotary Encoder Reading
« Reply #11 on: August 23, 2024, 11:41:48 am »
What a stupid series of problems.

Next mistake in line is touching that x1 / x10 switch. Oscilloscopes have a very low bandwidth (Usually just a few MHz) when the switch is in the x1 position. The normal way to "fix" it is to set the signal scaling on your oscilloscope to 10x. The cases where the x1 position of a scope probe is actually useful is quite rare. I really wish my scope would have come standard with x10 probes without a switch only.
« Last Edit: August 23, 2024, 11:43:57 am by Doctorandus_P »
 
The following users thanked this post: meshtron

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13091
Re: Struggling to get Rotary Encoder Reading
« Reply #12 on: August 23, 2024, 12:05:49 pm »
Next problem is operating the LS7366R  encoder counter board at 6V Vdd.   Although the Abs. Max. DC supply voltage Vdd is 7V, its normal operating range is 3.0V to 5.5V. Outside that range it is likely to malfunction.   It may be OK today, but fail tomorrow or sometime next month or if you are very lucky be trouble-free for years.  Also the malfunction may be very subtle, e.g. occasional lost counts or double counts that leave you wondering if the encoder wiring is picking up too much noise.

It is strongly preferable *NOT* to exceed the datasheet operating limits for reliability and so you don't waste time troubleshooting any future problems.  As the min. voltage for the encoder its self is 4.5V, and its powered from the LS7366R board,  reduce the (regulated) supply voltage to 5V, which gives you 0.5V margin either way to the operating limits of their respective specifications.
 
The following users thanked this post: meshtron

Offline meshtronTopic starter

  • Regular Contributor
  • *
  • Posts: 142
  • Country: us
Re: Struggling to get Rotary Encoder Reading
« Reply #13 on: August 23, 2024, 01:01:05 pm »
What a stupid series of problems.

Next mistake in line is touching that x1 / x10 switch. Oscilloscopes have a very low bandwidth (Usually just a few MHz) when the switch is in the x1 position. The normal way to "fix" it is to set the signal scaling on your oscilloscope to 10x. The cases where the x1 position of a scope probe is actually useful is quite rare. I really wish my scope would have come standard with x10 probes without a switch only.

I will set it back on 10X and leave it.  Just had no idea it was cutting voltage to 1/10 of actual.  Now I know!
 

Offline meshtronTopic starter

  • Regular Contributor
  • *
  • Posts: 142
  • Country: us
Re: Struggling to get Rotary Encoder Reading
« Reply #14 on: August 23, 2024, 01:05:25 pm »
Next problem is operating the LS7366R  encoder counter board at 6V Vdd.   Although the Abs. Max. DC supply voltage Vdd is 7V, its normal operating range is 3.0V to 5.5V. Outside that range it is likely to malfunction.   It may be OK today, but fail tomorrow or sometime next month or if you are very lucky be trouble-free for years.  Also the malfunction may be very subtle, e.g. occasional lost counts or double counts that leave you wondering if the encoder wiring is picking up too much noise.

It is strongly preferable *NOT* to exceed the datasheet operating limits for reliability and so you don't waste time troubleshooting any future problems.  As the min. voltage for the encoder its self is 4.5V, and its powered from the LS7366R board,  reduce the (regulated) supply voltage to 5V, which gives you 0.5V margin either way to the operating limits of their respective specifications.

Agreed not ideal.  Fortunately this is a prototype that only needs to last a couple of months.  Next round I will build a custom board that will have exactly the right voltages for everything.  I already have 3 different voltages onboard but don't have the space to easily add a 4th.

But your point is well-made and it does feel icky to run anything outside it's specs.  I am surprised there aren't more options for doing what the LS7366 does too - seems like a common requirement.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf