Opto-coupler choices driving me insane! - Page 1
Forum section: electronics / beginners

author: HwAoRrDk
author_rank: Super Contributor
timestamp: January 25, 2016, 03:30:31 am
content: I'm getting a big headache caused by the seemingly infinite choices available for opto-couplers.I just can't seem to find something that suits my needs without getting confounded at every turn.First of all, the thing that is the biggest source of confusion: current transfer ratio. I think I understand the principle; that there is a ratio between current sent through the input LED and the current passed through the output transistor. But, I simply don't know what to choose, or even what would motivate any specific choice. Do I want 12.5%, 50%, 80%, 100%, 160%?!? So many choices, so confused!I have a feeling what may influence my choice here is my usage scenario, so I suppose I'd better summarise it:I have a number of physical switches that originally directly switched current to some small DC motors. What I am planning to do is interpose a microcontroller-equipped module which will instead 'intelligently' drive the motors on its own, and relegate the switches to being 'manual override' user inputs to the MCU. The existing circuit is 12V, so I am using the optos to both translate voltage levels (to 5V) and to isolate from noise.So, all I need my optos to do is transmit simple on/off signals. No high frequency serial data, no analogue element - just on/off, high/low. When a switch goes 'on' and input is +12V, I want 5V 'high' out.On the output side of the opto-couplers I will be interfacing with both a 74-series shift register and an 4000-series OR-gate, if that makes any difference.Apart from that business, my other requirements are:Through-hole DIPAvailable in quad and single package (I need 9 channels - 2x4 + 1x1)Cheap and ubiquitousThings that are not a concern:Any particular level of voltage isolationSpeed/frequency or response time capabilityI would love if anyone could help me make a choice, 'cause this is driving me mad!

author: alsetalokin4017
author_rank: Super Contributor
timestamp: January 25, 2016, 04:33:26 am
content: Here you go, use these: ACPL-847-000E (quad)(available in quad and dual packages, $1.60 each for the quad version from Mouser)

author: boffin
author_rank: Unknown
timestamp: January 25, 2016, 04:37:11 am
content: PC817s are cheap and cheerful (4 pin DIP)

author: alsetalokin4017
author_rank: Super Contributor
timestamp: January 25, 2016, 04:54:57 am
content: PC817 @ $0.48 x 9 = $4.32ACPL-847-000E @ $1.60 x 2 = $3.20 + ACPL-827-000E @ $0.96 = $4.16Not including sockets....

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 25, 2016, 05:08:19 am
content: General purpose?4N35CNY17H11A1etccccccccccccc.These examples are pretty much all the same devices, anyway. Very generic.Selection is more about V ratings (Vceo, isolation) and speed than for CTR or current ratings. Though if you have weak sources, you may want to save a few mA and shop for something with a higher CTR, perhaps even a darlington type (actually large CTR). Expect low CTR (10-60%) for faster devices, for a number of reasons (though if you're seeing numbers like 0.01%, you're probably looking at a bare photodiode type, which will need extra hardware to be useful... probably avoid that for now).Without any fancy addons, these will give you a turn-on edge speed in the single microseconds, and turn-off in the 10-200us(!) range.Design the LED's current limiting resistor, and phototransistor's pull-up/down resistor, so that minimum CTR is observed. That is, for a 12V input, CTR min 40% at 2mA, and just using 2mA as operating current, for no particular reason, then you'd need (12 - 1.2V) / (2mA) = 5.4kohm on the LED, and (2mA) * (40%/100%) = 0.8mA on the transistor, and from 5V you'd need (5V) / (0.8mA) = 6.25kohm pull-up/down.Obviously(?), the resistor can be placed from VCC to collector (emitter to ground), or emitter to ground (VCC to collector). It's isolated, it doesn't care.Tips to get better speed, lower skew:- Use a higher CTR. I mean, *use*, not just buy (though that might help too?). In other words: use a smaller load resistor than calculated. But don't go too low, because some day you'll assemble a board with a sub-par (but within specs) device, and you won't have a fully saturated output anymore.- Avoid darlington types. The pair of transistors takes considerably longer to turn off (the duration is called storage time, and the effect is due to recombination, which is slow in electrical terms, and multiplied by one transistor driving another internally.)- Add a base-emitter resistor (if base pin provided). Typical value >= 47k. This reduces CTR quite dramatically, especially at low currents (the B-E junction is a photodiode, and you're shunting away the current that's turning on the transistor), but also bleeds away the stored charge (so you don't have to wait for recombination to do the job). This can get a 4N35 down to 1-2us (somewhat symmetrical rise/fall).- Get a photodiode version instead. 6N136 (or SFH6345, the noise immune version) has an extra "VCC" pin, which allows operation at higher voltage = lower capacitance, and uses a regular moderately-fast transistor, instead of a particularly slow phototransistor. These get down to 0.5us or so.- More and you're looking at much more involved things, like photodiodes with TIAs, or integrated chips (e.g., 6N137). Or different technology altogether (e.g., ADI's iCoupler series which are integrated magnetic isolators).None of which I'm guessing will be a problem, so don't worry about it.Do keep in mind that microseconds hurt when dealing with electrical stuff. You might not need it to shut down within microseconds of pressing a button, say (I recommend a response time of < 20ms for something human-interface-related -- meat processors are so slow that they'll still consider that "quick" and "responsive"), but if you're already waiting 200us for a darlington to turn off, that's 0.2ms you aren't getting back elsewhere, and if this is under control of something else (electronic), you might want the next step up.But beyond that, yeah, there's very little to worry about. There are four pin singles (and respective pairs and quads), there are kinds with base pins (and more), there are high voltage and high current varieties, and more peculiar kinds like FETs, SCRs, PV arrays and etc. You'll probably only be concerned with the DC bipolar kind.Tim

author: boffin
author_rank: Unknown
timestamp: January 25, 2016, 05:09:32 am
content: As you'd be using a lot more PC817s the price goes down due to qty .

author: HwAoRrDk
author_rank: Super Contributor
timestamp: January 25, 2016, 05:28:10 am
content: Thanks alsetalokin4017 and boffin for the suggestions. It hadn't actually crossed my mind to use 9x single-channel ICs. I suppose I was under the impression they would take more board space, but doing the math, it seems not.But, my main question still stands... I have no idea which variations to use, and why! For example, the Sharp PC817: my preferred vendor (Farnell) stocks 5 variations of this! They all superficially appear to have the same specs listed, but the part numbers differ due to something to do with CTR ranking... whatever that is!I see both suggestions have a nominal CTR of 50%. Could someone explain why 50% would be a good value choice?For the Avago quad channel part, assuming an '817' would be the equivalent for single-channel, is the HCPL-817-W0LE also a good choice? They are half the price of the PC817s.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: January 25, 2016, 05:47:37 am
content: Thanks for the lengthy response, Tim.Quote from: T3sl4co1l on January 25, 2016, 05:08:19 amSo, if I understand correctly, if you were restricted with how much current you could pass through the input side LEDs, one would choose a certain minimum CTR (perhaps even > 100%) in order to get the necessary current through your output?If that's so, I guess that concern doesn't apply in my case, because I'm not limited in that respect at all. Input current can be whatever I want it to be - just need to choose the appropriate resistor value.So, again, disregarding weak input limitations, why 50% CTR? Why not 100%? Is it because 50% varieties are the most ubiquitous and cheapest?Quote from: T3sl4co1l on January 25, 2016, 05:08:19 amI will be doing the latter, as I want non-inverted output.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 25, 2016, 03:00:04 pm
content: CTR varies enough within just one part (manufacturing/aging/temp variations) that I don't even register a "50-100%" range as significant.Going for a modest current like 10mA, with a standard (E6 or so) resistor value near there, is basically all you could ever want.Tim

author: HwAoRrDk
author_rank: Super Contributor
timestamp: January 26, 2016, 05:31:36 am
content: Alright, so, going for 50% CTR "just because" - common, cheap, etc.The Avago HCPL-817-W0LE I found earlier was actually a 'wide' DIP version, so the next cheapest regular-width DIP was a Fairchild FOD817, so I think that'll do nicely.I found thisVishay application notethat guides through calculating the correct resistor values for a given opto specification. I have attempted to follow through the section on the first page regarding 'IC Logic Design', plugging in the specs of the FOD817. This is my attempt at working through it...They start off with de-rating the min. CTR to account for temperature, age, and tolerance. According to my reading of the FOD817 datasheet graph, the CTR is reduced by approx. 10% at 60C. Other figures direct from the Vishay example, as I assume they're good rules of thumb.De-rated min. CTR:50% x 0.90 x 0.80 x 0.75 = 27%Next comes the transistor pull-down resistance. I had to go and look at the datasheets for the shift register and OR-gate and took the smallest 'low' voltage and largest 'high' voltage input thresholds, which were 1.35V and 3.5V, respectively. I'm not quite sure where they get the 1.6mA and 8mA figures from, but I decided to go with them.Transistor pull-down max. value:1.35V / 1.6mA = 843 OhmTransistor pull-down min. value:3.5V / 8mA = 475 OhmPicking a standard resistor value somewhere in the middle of those two figures gives me 680 Ohm.Next, working out the transferred current. For some reason they add a 20% safety margin for 'high' state voltage, so let's do that:3.5 + (3.5 x 0.2) = 4.2VTransistor current:4.2V / 680 Ohm = 6.18mALED current:6.18mA / 27% = 22.9mANow finally to work out the LED resistor value. Forward voltage for the FOD817 is 1.2V, and only seems to vary very little with temperature change, so I guess that doesn't need to be accounted for. Here I'm not quite sure where their 'VOL' figure comes from - something to do with their assumption a TTL device is controlling the LED? - but that doesn't apply for me, so I assume I can substitute zero there in my case.LED resistor value:(14V - 1.2V) / 22.9mA = 559 OhmThe nearest standard resistor value to that is 560 Ohm.So, does this all seem okay?

author: KL27x
author_rank: Super Contributor
timestamp: January 26, 2016, 07:16:04 am
content: For thru hole, you might as well just buy 10x single optocouplers. They will fit the exact same footprint and pinout, either way (they are made like that), and you will usually get a price break at 10+ units from a major distributor.Your requirements are pretty simple.Quote1. Go to Digi/Mouser/Newark/et al website2. Narrow down your absolute requirements.3. Sort by price4. Go with the first one on the list that is in stock and which looks like it will work for you??

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 26, 2016, 04:18:10 pm
content: Hmm, I don't recall single optos being narrow enough to fit into longer DIP footprints, I'd want to check the dimensions before committing to that..Tim

author: wraper
author_rank: Unknown
timestamp: January 26, 2016, 04:23:39 pm
content: Quote from: alsetalokin4017 on January 25, 2016, 04:54:57 amPC817 cost about 10 cents for a few and 5 cents if you need 100 of them.EL817 6 cents (ex vat) for 10+http://www.tme.eu/en/katalog/?idp=1&search=pc817&cleanParameters=1QuoteCertainly need to use them for reduced long term reliability.

author: boffin
author_rank: Unknown
timestamp: January 26, 2016, 08:49:12 pm
content: Cheapest I found on DigiKey for a 4 or 6 DIP optoLTV-817 (which is the same as a PC817 - which is what I suggested originally)http://www.digikey.ca/product-detail/en/LTV-817/160-1366-5-ND/385836C$0.28670 @ qty 100 (Prices in Canadian Peso)If you just want them to muck around with; buy some Chinese ones from Aliexpresshttp://www.aliexpress.com/item/ORPC817B-PC817-DIP-4-opto-9-50pcs-lot/32573785969.htmlUS$2.95/50, or about 6c each.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: January 27, 2016, 04:38:09 am
content: So, nobody got any comments on the math I tried to work through on the component values for 50% CTR optos? I just want to know that if I choose a 50% one that I'm not going to end up doing stupid things with regard to current draw, etc.Unfortunately, whatever Digikey or Mouser have is irrelevant for me, as their shipping charges would be nearly as much as my entire BOM.Basically, my choice is limited to whatever Farnell have, as they have free shipping for online orders. And ain't nobody got time to wait 3-4 weeks for stuff from China.Regarding fitting 4x single optos in the footprint of a DIP-16 - interesting idea - I think it mightjustbe doable. The datasheets of the ones I've looked at so far all say that max. width will be 5.1mm, so while technically there might be 0.02mm overlap, one can probably assume the majority of ICs will be slightly under their max. dimension. Good to know it gives options with board layout at least.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: January 27, 2016, 06:02:23 am
content: Yes, those numbers seem okay.I might go with lower LED current just to save a little power, and because you don't need anything for speed. In which case the load resistor needs to be proportionally larger as well, but that's fine.Tim

author: KL27x
author_rank: Super Contributor
timestamp: January 27, 2016, 10:43:01 pm
content: QuoteQuoteSanity check. I just pulled out my DIP optocouplers and they can be chained like a centipede as far as you want with 0.1" hole spacing. There's even a little wiggle room left over.Per my calipers, they are actually only 4.6mm in width.These are just run o the mill open drain AC input optocouplers that were w/e Mouser was selling cheapest at the time. I assumed they were all made like this, considering optocouplers by nature have to provide isolated ground for each unit, anyway; so larger packages save money (mostly in the labor of assembly, per my quick look into cost comparison of the components, themselves) in quanity, but otherwise 4x single and a quad in DIP packages is functionally and physically identical. Whereas other transistor arrays can also save redundant source pin connections in larger packages; hence, the "lego-block centipede" is not a replacement for a Darlington array. I have purchased quad DIP optos for volume boards (and used up singles in the same PCB), but there is no reason to stock multiple DIP optos for prototyping, AFAIC. In fact, I think I might have paid a little more for the quads, per opto-isolator.In fact, most DIP chips seem like they are made to stack end on end with space left over with 0.1" spacing. The pins on the very end being "half pins." It's just in the case of optocouplers, this results in the same pinout.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: February 09, 2016, 04:08:51 pm
content: I need some further advice. I've just realised I have an additional demand being placed on the opto-couplers I will be using.Because I am using two opto channels as a pair to detect direction of current flow on a circuit (because originally, the switches changed the polarity of the circuit to change direction of the motor), when the circuit is switched, one of the pair of optos will be subject to a significant reverse voltage. It suddenly occurred to me that I didn't consider that when choosing an opto-coupler.I checked the data sheets of the FOD817 as well as a bunch of alternatives, and it seems virtually all opto-couplers are rated for a maximum reverse voltage of 6V. But, my typical reverse voltage will be 12-14V! Frequently and repeatedly too!Now, when the datasheets say 'maximum reverse voltage' of 6V, what do they mean? Are they specifying the actual breakdown voltage point, where anything above 6V will incur significant current flow? Or are they simply specifying a reliability/durability threshold? That is, typical reverse breakdown voltage is higher, but if you don't want any chance of bad things to happen, don't go above 6V? For the former, I suppose I'm not overly worried about reverse current flow, assuming it doesn't light the LED (noob question: it can't, right?) and/or eventually kill the LED.So, do I need to worry about this?If I do, would a remedy be to place an additional plain ol' 1N4148 (which I believe are typically rated with VRof 50-100V) diode in front of each opto-coupler's cathode pin? (And of course re-calculate my resistor values to take into account the voltage drop from the diode.)

author: boffin
author_rank: Unknown
timestamp: February 09, 2016, 04:27:47 pm
content: in parallel/opposite to the opto isolator if you're using small voltages (<3v) ; or in series if you're using higher source voltages (>3v)

author: HwAoRrDk
author_rank: Super Contributor
timestamp: February 09, 2016, 08:00:44 pm
content: I found the following graph in aFairchild app note.Indicates that reverse breakdown voltage is typically about 13V. Uh-oh! Assuming this is representative of the IR LEDs in their range of opto-couplers (or even other manufacturers)... I'm gonna kill the LEDs in my opto-couplers, aren't I?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 09, 2016, 09:03:25 pm
content: An antiparallel diode will do a fine job, assuming that doesn't screw up your circuit.Voltage ratings are in terms of "don't apply more than so-and-so". Which means, like, from a constant voltage source.Sometimes, a maximum current rating is provided as well, which you might think should be entirely exclusive of the voltage rating. For example, a CMOS logic IC might have input pins rated for -0.3 to VDD+0.3 V. The 0.3 comes from the worst case (minimum) Vf of the input protection diodes. If you connect a voltage source of VDD+0.3 to an input pin, you don't want the diodes getting forward-biased (because the current might be 1uA or 1mA or 100mA -- it's a steep exponent!). But the chip might also have the current rating, |Iin| < 10mA. You'd never expect to draw 10mA from an input pin, as long as the voltage limits are followed (even at maximum temperature, you'd expect to need >= 0.5V beyond the rail to draw 10mA). So, what they're actually meaning is, if you exceed one but stay within the other, you'll still be okay.And, a maximum rating is different from a breakdown rating, because breakdown is measured at some reverse-bias current, while the maximum voltage includes a safety factor. This doesn't help you much, because a typical LED might handle the 5V it's guaranteed for, and not much more; or it might handle 30V or more. But you'd never know, because no one ever measures LED breakdown.So, proper design dictates using a diode to protect it. Antiparallel is preferred; series is probably okay, but it does require that the diode's reverse leakage (and reverse recovery charge during switching) also flow through the LED, which again begs the question about reverse behavior, but it's at least reasonable to assume that a suitable diode (say 1N4148) will leak way less than could possibly damage the LED, even if it's not technically rated for any reverse current.An empirical design methodology would measure a slew of various LEDs (well, the LED part of the optos) from different manufacturers and bins/date codes/etc., and do the statistics to determine actual, exact voltage and current limits for a suitable condition (like, 3 sigma from mean). But, there's no guarantee that the manufacturer won't change their part later (or production beats you do it, by purchasing unqualified parts).Tim

author: HwAoRrDk
author_rank: Super Contributor
timestamp: February 09, 2016, 09:57:00 pm
content: I think I might have to use series diodes, as parallel will not so much "screw up", but rather (I guess) have side effects. With parallel diodes I would have a split path for current flow: through both the LED and through the partner LED's protection diode. I'm not sure about the maths - will this just halve the current flow through each? If so, would I compensate for that by simply adjusting my current limiting resistor's value?If I understand you correctly, stated 6V max. reverse voltage is not likely a breakdown rating, but rather to provide a safe margin for manufacturing tolerances, etc. And also that precise breakdown voltage will depend on reverse current? I guess it shows that in the graph I posted earlier, but it seems to vary very little with reverse current.I looked up thedatasheetfor a 1N4148 diode and it states the reverse leakage is in the nanoamps range (25nA @ 20VR) - surely that's so minuscule as to be irrelevant?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 10, 2016, 07:57:02 am
content: Circuit?It sounds like your opto LEDs are in anti-parallel, which serves the same purpose.Tim

author: HwAoRrDk
author_rank: Super Contributor
timestamp: February 10, 2016, 12:32:59 pm
content: Here is the switch input circuit. Just the LED part of the opto-couplers shown for brevity.Yes, they are anti-parallel.But I don't see how that layout (and, now I think about it, parallel protection diodes) can inherently avoid the problem, because as my voltage is greater than the (assumed) breakdown voltage of the LEDs, won't the current always seek that path in addition to the 'correct' path through the 'forward'-facing LED?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 10, 2016, 05:59:25 pm
content: Current depends on voltage. If the voltage is too low to draw a lot of current, then...Tim

author: cdev
author_rank: Super Contributor
timestamp: February 17, 2016, 03:58:42 pm
content: Which opto-couplers offer the fastest response with very short 3.3 volt pulses?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 17, 2016, 04:24:47 pm
content: How fast is "fastest"?Optos don't look good above 10Mbps (~100ns pulse width), fiber optics aside.Tim

author: cdev
author_rank: Super Contributor
timestamp: February 17, 2016, 09:25:28 pm
content: This is 1pps from a GPS chip that I want to have available to its computer's GPIO, and the problem is - if I use the output from the module as is, it causes RF noise for some reason, a little blip once a second. So i want to opto-isolate it.Its not an official 1PPS output, its a 'bodge wire' so to speak connected to the pin where 1PPS appears , added by me. Its a $10 USB GPS dongle - the kind that doesn't normally have 1PPS.Its quite a decent GPS, especially for the price, and pulls in satellites really well. It just was not meant to be used for 1pps -before I waste people's time here I need to put it on my scope and see what's going on. This problem predates my owning a real oscilloscope.Opto-coupler seems like the thing most likely to make it noise free. Just a very short wire going to the CP2102 (another non optimal solution) radiates a little RF blip throughout the house.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: February 21, 2016, 05:48:39 pm
content: Okay, so back again.I realised I was being a dumbass and worrying about nothing with the reverse voltage business.So, I ordered a few opto-couplers and began to do some experiments on breadboard. Unfortunately, I began to blow the opto-couplers left and right. The LED sides were dead. Huh, what gives? Maybe too much current, so changed the resistors to allow the bare minimum - 10K both sides. No dice, optos still failing after a while. Okay, maybe I do need to handle reverse current after all?Put some 1N4148s in series. But blew another couple of optos! Alright, in parallel then. Nope, more dead components.I was tearing my hair out at this point, double-checking everything in my test circuit. WTF, do I have a bad batch of opto-couplers or something?I mentioned my problem to a relative and they told me how I could make absolutely sure to prevent reverse voltage problems using 3V zener diodes in parallel. I was about to order some zeners (and more optos!) when, after staring for too long at the same circuit diagram I posted last, I suddenly realised what my problem was!The ****ing switch is not perfect, and on the odd occasion (particularly when mashing on the buttons) is making a short circuit path through a pair of optos. The LEDs were being killed by excessforwardcurrent, not reverse!I can't change anything about the switch, so I thought I need to put some current limiting in elsewhere. I think on the ground pin off the switch - perhaps a 1K resistor. So that'll make 11K total (assuming I continue to use 10K) on the LEDs in normal operation, which doesn't affect much, and in case of switch shorting, max of about 10mA through the LEDs. Sounds good?