Struggling to get Rotary Encoder Reading - Page 1
Forum section: electronics / beginners

author: meshtron
author_rank: Regular Contributor
timestamp: August 22, 2024, 02:58:11 pm
content: 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 isthe encoder in questionandhere 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 ishere). Datasheet for the actual LS7366R chip ishere.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.

author: Grandchuck
author_rank: Super Contributor
timestamp: August 22, 2024, 03:29:45 pm
content: Open collector output

author: CaptDon
author_rank: Super Contributor
timestamp: August 22, 2024, 03:53:40 pm
content: 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?

author: Grandchuck
author_rank: Super Contributor
timestamp: August 22, 2024, 03:59:55 pm
content: Quote from: CaptDon on August 22, 2024, 03:53:40 pmAh yes, I re-read and saw the 1k pull ups. Now, why only 0.6 volts?

author: Andy Watson
author_rank: Super Contributor
timestamp: August 22, 2024, 04:12:54 pm
content: 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.?QuoteNeed more information to debug this - so you're going to have to do something

author: meshtron
author_rank: Regular Contributor
timestamp: August 22, 2024, 06:19:16 pm
content: 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?

author: floobydust
author_rank: Super Contributor
timestamp: August 22, 2024, 06:30:04 pm
content: 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.

author: meshtron
author_rank: Regular Contributor
timestamp: August 22, 2024, 06:39:53 pm
content: 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.

author: meshtron
author_rank: Regular Contributor
timestamp: August 22, 2024, 07:31:59 pm
content: 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.

author: meshtron
author_rank: Regular Contributor
timestamp: August 23, 2024, 01:20:54 am
content: 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).Thanks for the input from you all! (Yet another) lesson learned.

author: meshtron
author_rank: Regular Contributor
timestamp: August 23, 2024, 04:58:52 am
content: 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.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: August 23, 2024, 11:41:48 am
content: Quote from: meshtron on August 23, 2024, 04:58:52 amNext 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.

author: Ian.M
author_rank: Super Contributor
timestamp: August 23, 2024, 12:05:49 pm
content: Next problem is operating theLS7366Rencoder 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.

author: meshtron
author_rank: Regular Contributor
timestamp: August 23, 2024, 01:01:05 pm
content: Quote from: Doctorandus_P on August 23, 2024, 11:41:48 amI 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!

author: meshtron
author_rank: Regular Contributor
timestamp: August 23, 2024, 01:05:25 pm
content: Quote from: Ian.M on August 23, 2024, 12:05:49 pmAgreed 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.