Author Topic: Troubleshooting an optical encoder  (Read 3494 times)

0 Members and 1 Guest are viewing this topic.

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Troubleshooting an optical encoder
« on: January 29, 2019, 07:43:20 pm »
Hello
I have a 600 pulse per revolution optical rotary encoder which I bought a few months back. I first thought it's dead on arrival as it was outputting no signals (connections were correct). I decided to check it with an oscilloscope a few days later in our uni lab and it was magically working fine  :phew:
I just thought there might have been a bad connection or something the first time around. I played with it for a few hours and got everything to work, even used a trick to get 2400 pulses per rev which was really nice. I didn't have all the parts I needed for the project so I put the encoder aside. Today I finally have gotten the rest of the project working (mechanical side) and went back to use the encoder, but to my surprise, there was no signal on the output again! I have ordered a new replacement which can take a few weeks to arrive so I want to troubleshoot and fix this one if possible. I searched a bit but couldn't find any detailed description or PCB layout or schematic or anything about how the device actually works (some of the chip markings are removed which is super annoying  :-//). if anyone has any information about how these devices work or has a schematic of them, it would be very helpful. I think it's an analog light sensor (similar to LDR) which is then converted to digital signals using a voltage comparator or similar but that's just my theory. Thanks a lot everyone
 

Offline jmelson

  • Super Contributor
  • ***
  • Posts: 2851
  • Country: us
Re: Troubleshooting an optical encoder
« Reply #1 on: January 29, 2019, 07:53:00 pm »
Many encoders need a "pull up" resistor to some positive logic level, like 5 V.  Just a 1 K Ohm resistor from the +5 supply to the outputs will do it.
Otherwise, just check that the power and ground are connected to the right pins.

Jon
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Troubleshooting an optical encoder
« Reply #2 on: January 30, 2019, 03:06:48 am »
Thanks jon
Although I didn't have any pullup resistors in the lab a few months ago, it had worked flawlessly, maybe I just got lucky.

I connected two 1k pullup resistors to VCC (5V) and it seems to have fixed the issue for only one of the phases (phase B or the green wire) but there is still no response from phase A. It seems unlikely but I can't think of anything else at this point. which kind of renders it useless for the application I had for it. I don't have many different value resistors but 10k didn't seem to fix it either ... there's a chance I might have killed one of the phases? (I never connected anything backwards, and did not connect the phases to any supply rail (VCC or GND) directly, connections were always correct and outputs (phases) were only connected to input pins of arduino). If anything could die, I'm guessing it would be the output pass element? the sensor itself is unlikely to die in this situation but still possible. Any ideas on how to check what's wrong with it?
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Troubleshooting an optical encoder
« Reply #3 on: January 30, 2019, 03:57:48 am »
Upon further inspection, the chip markings are not removed, just really hard to read (needs the tongue in the right angle   :-/O). The soldering quality is also terrible and there is white powderi stuff which I assume to be a flux of some sort (didn't completely clean with 70% IPA) with really excessive solder on some parts and practically non on the others.


I fixed the connection on the 3rd pin thinking that was the issue, but nope! phase A (white) is stuck in pullup mode ... the circuit for 2 phases doesn't seem to be identical either (one of them has a diode on the output, one of the goes to a capacitor while the other one doesn't etc)


The big 3 pin THT package is a TL750 (750l05C) LDO.
The small sot 23 packages are also marked Y1 which I googled to find the SS8050 NPN transistor which sounds about right as an amplifier (or switch) in this case.
if anyone can make sense of why the phases are different and how they work, please let me know!
« Last Edit: January 30, 2019, 04:02:08 am by OM222O »
 

Offline Kasper

  • Frequent Contributor
  • **
  • Posts: 791
  • Country: ca
Re: Troubleshooting an optical encoder
« Reply #4 on: January 30, 2019, 08:11:24 am »
I think I wrecked an encoder once by using too small of a pull-up resistor and running too much current through it.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Troubleshooting an optical encoder
« Reply #5 on: January 30, 2019, 10:15:11 am »
but there is still no response from phase A....
If anything could die, I'm guessing it would be the output pass element?

From the pic you can see some components of A and B, compare voltages each side of the 100Rs, transistors, 4k7s.
« Last Edit: January 30, 2019, 10:23:52 am by StillTrying »
.  That took much longer than I thought it would.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Troubleshooting an optical encoder
« Reply #6 on: January 30, 2019, 10:38:30 am »
as I mentioned, some parts of the the circuit are not the same, for example the one single diode, or the extra capacitors on one side etc (The only component on the other side is the sensor). but I will compare the parts that are similar. I'm guessing the 1Y component is dead as currently it's the most obvious part that can fail. (LDO clearly works, it's not easy to kill a diode with these low power circuits, passive components practically never die except under worst case conditions which wasn't the case here but NPN transistors ... they can die for a ton of reasons even at these low power circuits).
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Troubleshooting an optical encoder
« Reply #7 on: January 30, 2019, 12:40:34 pm »
I didn't have any luck with checking the voltages, they were all over the place.
However I made a poor man's "oscilloscope" using the arduino's ADC (just analogRead the pin in the loop) to check the output values again (I don't have access to uni labs for a few days) and this is what I got for the working phase:


Also the fact that it doesn't go all the way upto 1023 is the LDO which drops the voltage down a bit, but it's clearly a logic level signal going high and low very quickly.

now this is what I get for the broken phase:


The signal is not amplified at all! it's clearly going high and low but in a much more analog fashion that usable data. the circuit is clearly biased in the midway point (about 512) and going up to about 530, and downto 500 which I'm assuming is the raw signal output from the sensor.
This really confirms the fact that I've killed the NPN transistor there. (please post if you know a method to test it in the circuit just to make sure it's dead). I tried having a look on https://uk.rs-online.com/web/ and they don't have the SMD version of the transistor.(Mouser, digikey, etc are out of question as they would charge an arm and a leg for shipping with an order like that). do all other jelly bean NPN transistors work? or is there some parameter I should pay attention to when buying one? I really want to get this circuit working asap, thanks.
 

Offline jeremy

  • Super Contributor
  • ***
  • Posts: 1079
  • Country: au
Re: Troubleshooting an optical encoder
« Reply #8 on: January 30, 2019, 01:08:23 pm »
I don’t think it’s likely that a random 2n3904 (or MMBT3904, etc) would kill it, so might as well try.

FWIW, I’ve used this relatively cheap encoder several times with great success: https://www.digikey.com.au/product-detail/en/cui-inc/AMT102-V/102-1307-ND/827015
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Troubleshooting an optical encoder
« Reply #9 on: January 30, 2019, 01:20:24 pm »
"This really confirms the fact that I've killed the NPN transistor there. (please post if you know a method to test it in the circuit just to make sure it's dead)."

With the pull up, can't you check the emitter-base and emitter-collector voltage changes are inverting,

On the 2nd low amplitude plot the little blips give the impression the other phase is working about ~90 deg off which is correct, so yes, just something to do with the output stage.

I often cobble a TH component onto a SMD place. :)
« Last Edit: January 30, 2019, 01:24:29 pm by StillTrying »
.  That took much longer than I thought it would.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Troubleshooting an optical encoder
« Reply #10 on: January 30, 2019, 02:18:28 pm »
https://uk.rs-online.com/web/p/bjt-bipolar-transistors/7115146/

These seemed very close to the original ones used.
Placed an order for them which should arrive tomorrow. I will post an update, as well as the working project if everything goes smoothly! thanks a lot everyone for your help.
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Troubleshooting an optical encoder
« Reply #11 on: January 30, 2019, 06:11:22 pm »
https://uk.rs-online.com/web/p/bjt-bipolar-transistors/7115146/

Those 3 Amp transistors should work, 100mA or 200mA would have been enough!

It looks like there's already 4k7 collector pull ups on the PCB.
.  That took much longer than I thought it would.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Troubleshooting an optical encoder
« Reply #12 on: January 30, 2019, 06:57:15 pm »
without the external 1k pullups I wouldn't get any signal on either of the phases! again, I got lucky and it worked the second time I was playing around with it (not sure how or what caused them to) but they didn't work 2 out of 3 times  :-DD that's a really poor design in my opinion as the extra 1k pullups wouldn't even cost anything. I try to reverse engineer the board if it worked after replacing the transistor, and maybe seeing where I can improve the design. I will do that as soon as the parts arrive tomorrow. thanks a lot!
 

Offline viperidae

  • Frequent Contributor
  • **
  • Posts: 306
  • Country: nz
Re: Troubleshooting an optical encoder
« Reply #13 on: January 30, 2019, 10:19:45 pm »
You mention the white and green wires are the phases. Judging by the PCB white and red are the two phases outputs. They're both connected to identically laid out transistors via a resistor.

Edit: red and green.
« Last Edit: January 30, 2019, 11:33:10 pm by viperidae »
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Troubleshooting an optical encoder
« Reply #14 on: January 30, 2019, 10:48:57 pm »
You mention the white and green wires are the phases. Judging by the PCB white and red are the two phases outputs. They're both connected to identically laid out transistors via a resistor.

Yes but Red and Green.
« Last Edit: January 31, 2019, 03:03:48 am by StillTrying »
.  That took much longer than I thought it would.
 

Offline sarahMCML

  • Regular Contributor
  • *
  • Posts: 81
  • Country: gb
Re: Troubleshooting an optical encoder
« Reply #15 on: January 31, 2019, 12:41:53 am »
Hi,

It looks to me like the 2 middle pins of the 4 connector pins at the bottom of the second pic could do with resoldering properly at least!  Some shocking soldering on that board!

Regards,

Sarah.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Troubleshooting an optical encoder
« Reply #16 on: January 31, 2019, 08:45:04 am »
You would be quite right (but red and green) ... I can't believe I didn't spot it myself  |O There are even markings on the PCB saying that red is phase A and green is phase B. I was following the instructions listed on the product page which is clearly wrong.

https://www.amazon.co.uk/Encoder-SODIAL-Incremental-Rotary-Measurement/dp/B01HLRSLF0/ref=sr_1_16?ie=UTF8&qid=1548923921&sr=8-16&keywords=rotary+encoder

So now I realize I must have connected it "the wrong way around" the one time that it worked ... which was actually the correct way around  :palm:
Also yes sarah, I did some soldering on the board myself ... it's quite bad out of the box! I still can't believe I didn't spot that and took the amazon listing for granted, even though I pointed out the white "phase" has a completely different circuit  :-DD

What's even more confusing is the choice of their colors! if it wasn't red, eg: purple,pink,yellow, etc I wouldn't think it's VCC ... but it's red and listed as VCC on the product page! then white (which if red wasn't there would be my next choice for VCC) is actually VCC! it's so confusing!
« Last Edit: January 31, 2019, 08:47:22 am by OM222O »
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Troubleshooting an optical encoder
« Reply #17 on: January 31, 2019, 11:11:55 am »
here is a short video of the intended application:
https://streamable.com/io43n

It's a simple but accurate digital protractor :D
This is just a prototype and I will have the machined parts soon, it should decrease the parallax error (if the two arms aren't centered around the same point) as well as error on point of contact. would you be interested in a video about how I got 4x the resolution of the encoder?
I can explain it in a separate video because it's really simple and useful trick  ;D
 

Offline StillTrying

  • Super Contributor
  • ***
  • Posts: 2850
  • Country: se
  • Country: Broken Britain
Re: Troubleshooting an optical encoder
« Reply #18 on: January 31, 2019, 11:26:04 pm »
Now that you've got it working, LOL. I'd apply the 2 phases to digital inputs and plot the 2 phases to see how good it really is, I don't think I've ever come across an encodered knob that isn't easy to confuse. :)
« Last Edit: January 31, 2019, 11:28:57 pm by StillTrying »
.  That took much longer than I thought it would.
 

Offline OM222OTopic starter

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Troubleshooting an optical encoder
« Reply #19 on: February 01, 2019, 12:30:12 am »
That was the first thing I did actually, they both have full swing and the output is pretty decent! now just need to order proper arms to be milled and possibly get a better encoder to measure downto 0.01 degree haha
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf