General purpose?
4N35
CNY17
H11A1
etccccccccccccc.
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