1

i'm using this simple schematic (using a TLP184) in order to get the status of a reed/dry contact using an optocoupler

enter image description here

There is no way to get it working, also if the connector pins are opened, from pin 4 and GND i get 2.5V.

I'm missing something? Maybe it's a silly mistake, but i can't figure out on how to solve this.

VirtApp
  • 569
  • 4
  • 23
  • Where did you get the idea to use a resistor from emitter to ground? – jonk Aug 17 '20 at 08:21
  • I've tought that the resistor can be a pulldown resistor, so i've connected it from emitter to ground. – VirtApp Aug 17 '20 at 08:23
  • I don't know that much about what you are doing. Get that right. You haven't written enough. But I think, just perhaps, that you might use that resistor as a pull-up from the collector to the +_3.3 V supply and ground the emitter. Take the output from the collector. See if that fixes anything. – jonk Aug 17 '20 at 08:25
  • The transistor is NPN which means it "pulls down" when active. Therefore the GP135 should connect to pin 6 and the resistor should be a pull-up (between pin 6 and +3.3V). Tie pin 4 directly to ground. – akwky Aug 17 '20 at 08:26
  • Ah, let me see. Let us troubleshoot from the left side, and first check if your LED is correctly biased to give the typical If of 16mA (according to datasheet TLP184). Your series biasing seems to be 1k or 2k. So If = 5V / 1k = 5mA << 16mA required. So I suggest the first thing is to change the biasing resistor to 5V / 16mA = 5/15k = 330R. – tlfong01 Aug 17 '20 at 08:31
  • Why do you need an opto coupler? Vheck R12 is 4k7 and not something stupidly higher like 4M7. – Andy aka Aug 17 '20 at 08:43
  • (1) The TLP184 datasheet I am reading says recommended condition If = 16mA. I checked that your datasheet does not seem to give recommend If, but says +-10mA somewhere. Anyway, I think it is OK to try 15mA. (2) Now let me check Ic. Spec says typ 1mA, Now your Ic = 3V3 / 4k7 ~= 1mA should be OK. but if Ic max is much bigger, there is no harm changing 4k7 to say 3k3. Anyway, you can use a multimeter/scope to verify. About the pull up/down thing. Usually pull up is preferred, for efficient reasons, but I think pull down is also OK. – tlfong01 Aug 17 '20 at 08:48
  • (3) It would be nice if you have another TLP to do swap testing, because if you get your TLP184 from eBay, there is a chance that they give you sub standard grade, with CTR < 50. – tlfong01 Aug 17 '20 at 08:48
  • 1
    @tlfong01, changed R7 and R9 to 330ohm, nothing changed – VirtApp Aug 17 '20 at 08:50
  • I once played with another opticalcoupler. I remember that the schematic (for a relay) uses If = 5mA, I did find the Ic is too small to get big enough Ic to pull down the NPN BJT next. The device manufacturerer might screen bad low CTR guys before assembly and testing. So they have guarantee CTR, But you eBay stuff has not guarantee! – tlfong01 Aug 17 '20 at 08:54
  • @VirtApp, but have you another TLP184 to swap? Do you have a multi-meter (I don't insist a scope) to check the voltages at the "test" points? I remember one more things, usually many Arduino designs assume 5V Vcc, but if you use 3V3 Rpi then often you need to adjust the biasing, or you might be in trouble. – tlfong01 Aug 17 '20 at 08:58
  • 1
    _"if the connector pins are opened, from pin 4 and GND i get 2.5V."_ - With no LED current the transistor should be off and you should get 0V across R12. So either there is a wiring error, or your optocoupler is faulty. – Bruce Abbott Aug 17 '20 at 08:59
  • 1
    Yes, i have a multimeter and also an oscilloscope and i've measured the voltage between pin 4 and GND and i'm getting 2.5V. in any case, i'll try another TLP184 – VirtApp Aug 17 '20 at 09:00
  • If you change R7 to 330R, can you use a multimeter to measure the If for 1k and 330R? – tlfong01 Aug 17 '20 at 09:00
  • Oh my goodness, I was a bit embarrassed to ask if you know how to use a multi-meter. But if you have a scope, of course you should be rich enough to buy spares to do swap testing/troubleshooting. Electronic toys are so dirt cheap these days, it is criminal not to buy more for just in case spares. Ah, jogging/supper time. See you later. Good luck, cheers. – tlfong01 Aug 17 '20 at 09:06
  • You might like to know why I suggest to use If = 15mA to 20mA. Part C of my answer to the following question has a spec for EL354 bidirectional optocoupler which mentions ***If = +-20mA*** operation, it is then I noticed that 5mA in many example designs might be for Arduino 5V Vcc and might not be good for 3V3 Rpi, perhaps CTR spec is often exaggerated. (1) https://electronics.stackexchange.com/questions/505318/how-to-properly-use-a-relay-module-with-jd-vcc-from-arduino-raspberry. – tlfong01 Aug 17 '20 at 09:19

3 Answers3

1

If you know the CTR and that is like hFE except due to coupling loss may be CTR=25% worst case, a first glance tells me looking and V/R ratios it not reliable. 5/3.3V * (1k+1k)/4.7k needs CTR>100%.

Also you need voltage gain, so with the lousy current gain with load on collector using 10Rin to get voltage gain to compensate for low CTR using common emitter, NOT emitter follower.

So invert switching on output after this if needed with logic.

Look at it as a simple NPN switch with Rb =1K and Rc>= 10k. But instead of Ic/Ib=10 , consider Ic/Ib= 0.1 then it will work.

There is no need to to use rated LED current but for long term you must use at least 10% max current. (Prevent aging)

After reading spec CTR Min is 30% Vce(sat) @ If=1mA

Use common emitter with collector R= 10km for voltage gain.

As long as Ic/Ib >30% with loss of gain when saturated. It should work.

Spec is If=1mA CTR saturated =30% min. Ib=5V-Vf=1.2V/200 = 3.8V/2K=1.9 mA. X 30% into 3.3V = Rc= 5.7k Min

Tony Stewart EE75
  • 1
  • 3
  • 54
  • 182
  • This follows this post schematics, but instead 230V on the led side, i want to use 5V. https://electronics.stackexchange.com/a/208596/207570 - your answer is not very clear to me, i didn't understood what changes i have to do to my circuit. – VirtApp Aug 17 '20 at 09:44
  • Use common emitter with 4k7. As long as Ic/Ib >10% with loss of gain when saturated. Spec is If=1mA CTR saturated =30% min – Tony Stewart EE75 Aug 17 '20 at 09:47
1

Check that node GP135 is not connected to an MCU with an internal pullup on the GPIO. That could explain your 2.5V reading (and not much else would!). Test with no other connections than the resistor first.

Otherwise, though I concur with Tony that the current through the LED should be about double for reliability (or use 10K for the load), it should certainly work typically on the bench.

Spehro Pefhany
  • 376,485
  • 21
  • 320
  • 842
0

After trying to make it work with the old configuration, my final design were modified in order to follow a standard optocoupler circuit configuration as following image: i've tested it and it seems to be working well.

enter image description here

VirtApp
  • 569
  • 4
  • 23