Voltage Divider for Ground Fault Detection - Page 1
Forum section: electronics / projects

author: Thumper_LV
author_rank: Contributor
timestamp: February 21, 2023, 06:57:56 pm
content: I've inferred that a simple voltage divider can be used to identify a ground fault condition for DC circuits. If I understood correctly, which I probably haven't, a standard divider pair of resistors are used, one connected to positive, the other negative, and the joint between the two resistors connected to ground. Now a reading can be taken...which is where my questions start.With a single voltage divider, if the ground fault is on the positive side, the output of the divider could approach the full operating voltage. So to measure with a MCU, I should use a second divider to bring the result to safe 3.3V MCU values. Given a base voltage of 40V, would 1M for both of the initial resistors, and then 1M/82k for the second divider be a good starting point?I assume the connection to earth should NOT be a simple direct one - but should have some kind of protection/filtering. What would this look like? Just a capacitor, or a ferrite, or some other magic sauce? I'm thinking a diode should have some involvement - but wouldn't that block the path for either the positive or negative depending on the direction?

author: PartialDischarge
author_rank: Super Contributor
timestamp: February 21, 2023, 07:02:58 pm
content: I'm not totally sure. You may want to set the voltage of the a floating ground to the midpoint of the DC rails, hence the resistors, but I wouldn't trust that voltage to indicate a ground fault (ie a short between any DC terminal and ground)But that depends on your specific system/application...

author: Thumper_LV
author_rank: Contributor
timestamp: February 21, 2023, 07:27:52 pm
content: I apologize for not being clear.Given a DC voltage output, that will be connected to wires that will leave the PCB and go out into the great wide world - would having a dual divider setup as I've described work for ground fault detection on those wires?And again, for such an application, how should the pathway to earth ground be made from the first divider?

author: shakalnokturn
author_rank: Super Contributor
timestamp: February 21, 2023, 11:29:01 pm
content: Do you want to detect when the secondary side of an isolated supply (no output terminal referenced to ground) is in contact with primary ground (earth)?In any case using resistors linked to earth to detect a ground fault is already referencing the DC source to earth in a way, so the starting point is knowing how well you want the DC to stay floating and what the highest measurable fault resistance must be?

author: Zero999
author_rank: Super Contributor
timestamp: February 21, 2023, 11:34:58 pm
content: Quote from: Thumper_LV on February 21, 2023, 07:27:52 pmIf the aim is to sense whether an isolated supply has become earthed, then yes, resistors can be used to detect that. A single potential divider is required, not two. Measuring thevoltage betweenthrough the earth and the node where the two resistors meet, will indicate whether there's a fault. The impedance of the fault and whether it's on the positive or negative can be gained by sign and magnitude of thevoltagecurrent.EDIT: I stupidly kept writing voltage, rather than current.

author: Thumper_LV
author_rank: Contributor
timestamp: February 21, 2023, 11:35:21 pm
content: If I understood your first question...yes. That's what I want.As for the other - I don't know how to answer. I would start with "completely floating" and maybe...anything less than 900k resistance between a conductor and ground is considered a fault. So 1M ohm would be considered open and clear.

author: Zero999
author_rank: Super Contributor
timestamp: February 22, 2023, 08:08:02 pm
content: Since all voltages are relative, there needs to be some high impedance connection between the isolated power supply and earth, in order for it to work.Here's an example of how it could be done. Both sides of V1 are connected to earth via R1, R2, these should have the same value, and an ammeter. The maximum leakage current depends on the values of R1 & R2.

author: Thumper_LV
author_rank: Contributor
timestamp: February 22, 2023, 08:17:35 pm
content: Using an ammeter defeats the goal here - which is to use a MCU.I haven't seen anyone say my theory two voltage dividers is incorrect. So I'm assuming I'm on the right track.So I repeat my original question - how should I make the connection to earth ground? I guess I'll expand on that and say I want to make that connection with the greatest amount of isolation/protection/separation possible.

author: jonpaul
author_rank: Super Contributor
timestamp: February 22, 2023, 08:36:08 pm
content: Normally "ground fault détection" is defined as the flow of excess leakage current due to insulation failure between mains ( 120v, 240v) line or neutral and ground or earth.The trip current depending on the application eg medical, patients connected, UL, etc.100 uA...5 ma RMS can be typical.The current is the common mode, sensed by a special CT and GFI IC.GFI Circuits breakers and mains outlets cost $10..30 ea in USA.I have not seen a DC GFI, nor any application besides 120/240V mains protectionJon

author: Zero999
author_rank: Super Contributor
timestamp: February 22, 2023, 09:11:53 pm
content: Quote from: jonpaul on February 22, 2023, 08:36:08 pmDC current leakage monitoring is a thing. It can be done with a Hall effect sensor and there are pre-built modules specifically designed for the purpose. In this case it's just easier to earth the power supply via a high impedance divider and monitor the current to earth via a shunt.Quote from: Thumper_LV on February 22, 2023, 08:17:35 pmThe ammeter represents whatever it is you're using to measure the current. It could be a low value, relative to R1 & R2, shunt resistor and an instrumentation amplifier connected to an ADC.QuoteIt will work, but the problem is it's more complicated and the mismatch in resistor values will result in a considerable offset. I suppose the offset can be nulled in software, but you need to be sure there's no leakage current when this is done.QuoteRefer to my previous schematic.EDIT:I've think I've just realised what the problem is.Do you need to detect earth faults on both the positive and negative sides of the 40V supply or just one side?How is the microcontroller powered? Is the 3.3V rail completely isolated from the 40V supply, or does it share the negative side?If the power supplies are not isolated, then use the circuit I posted with a low value shunt resistor and a suitable differential amplifier to sense the current and feed it into your ADC input.If the 3.3V is isolated, then the shunt resistor can be replaced by two lower value resistors connected as a potential divider, to sense the current, so you were on to something when you mentioned to dividers.

author: Zero999
author_rank: Super Contributor
timestamp: February 22, 2023, 11:40:39 pm
content: Thinking about this again, the MCU power supply must be isolated, except for some high value biasing resistors.I had a play with LTSpice.R1 & R2 form a potential divider as per the previous circuit. R3 is the current sense resistor. R4 & R5 bias the MCU's power supply around earth. They can be any value, as long as they're both the same. The capacitors perform filtering and ensure the brief transient spikes taking by the sample and hold circuit don't affect the reading.The voltage seen by the ADC will be 1.65V, when there's no leakage, near 0V, when there's direct short from + to earth and near 3.3V, when there's a direct short from - to earth. The voltage across R3 and therefore seen at the ADC input is equal to the leakage current multiplied by the resistor value.

author: uer166
author_rank: Super Contributor
timestamp: February 23, 2023, 12:24:00 am
content: Quote from: jonpaul on February 22, 2023, 08:36:08 pmJust because you personally haven't seen it doesn't mean it doesn't exist. RDC-DD (6mA DC GFCI for mains application for EV chargers according to IEC61851) are more-or-less standardized parts.

author: Thumper_LV
author_rank: Contributor
timestamp: February 23, 2023, 01:31:56 am
content: Making some progress...Looking at your new schematic I see three separate earth connections. That by itself I don't understand - I'm concerned having just one!In terms of current - I'm less interested in knowing how much current is coming from the earth than I am in a low resistance path between either positive or negative of my power to earth. I may be using the wrong terms or using the wrong concepts - but to me "current" means there's a quantity of work being done while "low-resistance" (less than 1M ohm) or voltage between points means there's a path or potential for work.I don't care if there's 0.00001ma on the earth connection - I care very much if there's anything less than 1M ohm between earth and my conductors. Did I state that correctly?As far as offset - I'm certainly not locked into any particular resistor value. I picked those because 1M seemed like a good starting point for minimal current involvement and then 82k for the divider bottom to shift 40V to around 1.8 as a midpoint baseline. My minimal requirement is to reliably detect the presence, or absence, of a short-to-grount on the output. As a bonus, I'd like to be able to know whether that fault is on the positive or negative. Anything more is a bonus which I may or may not make use of.And I need to do this without, or at least protecting against, exposing my circuitry to extraneous junk coming back up through the earth connection.

author: Zero999
author_rank: Super Contributor
timestamp: February 23, 2023, 08:41:54 am
content: Quote from: Thumper_LV on February 23, 2023, 01:31:56 amThere are only two connections. R_Leakage is purely there for the purposes of the simulation. I strongly recommend downloading LTSpice and having a play.QuoteCurrent depends on the imbalance in resistances between the + and - side of the supply and earth. You can't measure resistance, without current, due to Ohm's law.You haven't said how the MCU is powered?Please post a schematic.

author: Thumper_LV
author_rank: Contributor
timestamp: February 23, 2023, 06:06:06 pm
content: I've never used LTSpice - tried playing with it a couple times and never understood it. Downloading your example gives me a starting point - thank you. Just leads to more questions but I'm going to stare at that layout to see if anything clarifies.Anyway - the MCU is to be driven by a separate 3.3V power supply. My intent currently is to generate both the 3.3V and the 40V from an initial mains connected 24V power supply. So...I suppose both power supplies' 0V would be common if that makes a difference. In other words - I *think* your schematic is pretty close to what I'm envisioning. So now I'm asking:Ok - why *two* earth connections? The one for the test point is obvious. Why the earth connection on the MCU side?The selection of 43k for the earth connection - that translates 40V to 1.6V. If 40V is my high point, why wouldn't I use 82k to give me 3V, which would allow for easier sensing without amplification?I'm still asking if all that should be physically used for the earth connection is a simple resistor - without any further filtering/protection?

author: Terry Bites
author_rank: Super Contributor
timestamp: February 23, 2023, 06:23:12 pm
content: Measure the difference between the iso+ and iso- currents at the DC-DC conv outputs. If the current ain't the same in both legs of the iso side current loop its going elswhere and breaching the iso barrier.Shunts + HCPL-7800s ?A couple Allegro thingys?

author: Thumper_LV
author_rank: Contributor
timestamp: February 23, 2023, 06:25:12 pm
content: Would that apply if both sides were shorted to ground? I don't think I can simply compare the currents against each other.

author: Terry Bites
author_rank: Super Contributor
timestamp: February 23, 2023, 06:33:36 pm
content: Its analogous to the GFCI transformer.It would detect either a fault from iso+ or iso- to earthyness gnd or other unwanted breach loop.I cant see an other way of doing it.

author: Thumper_LV
author_rank: Contributor
timestamp: February 23, 2023, 07:22:11 pm
content: I still don't understand.If both positive and negative are shorted to earth - then I would expect the current on each to be the same. Therefore comparing them isn't a reliable method of determining if there is a fault.The application is for a PCB while will, among other things, be controlling a number of other electronic devices. This is not a safety circuit to prevent shocks - this is core function of operation. I must know if either or both conductors have a path to earth. If it's biased in one direction or another again I don't care - what I care about is as long as there is more than 1M resistance between earth and my circuit my MCU says status is healthy while anything less than 1M to earth indicates a problem.I still am concerned about connecting my circuit directly to ground via just a resistor. Is there anything else I should do to protect my system?

author: Zero999
author_rank: Super Contributor
timestamp: February 23, 2023, 09:04:29 pm
content: Quote from: Thumper_LV on February 23, 2023, 06:06:06 pmBecause the MCU senses the difference in voltage between its 0V reference and the ADC pin.QuoteThe voltage can be either positive or negative. 82k would give a range of +/-3V. In the circuit I posted, the reading is offset by 1.65V, allowing both positive and negative voltages to be read.QuoteA simple resistor will do. I would recommend putting the microcontroller on a completely isolated power supply.If you just need to detect a threshold impedance of 1M, then get rid of the ADC and use a comparator circuit. I've done this myself before, but it was for 12V, not 40V, which made it much easier.Here's an example using the LM393. It's a similar circuit to the one I used before. The comparator is powered from the 40V via a 30V zener diode. It won't work as drawn with the comparator powered off 24V because the voltage on R4 is too high. D2 clamps the input voltage to 30.6V to avoid damaging the LM393 and R10 limits the current. The outputs are isolated, via opto-couplers which helps to protect the MCU.The yellow plot is the value of R_Leakage+ and R-Leakage- connected in parallel. The spike is the very high resistance, when the simulation switches from R_leakage+ to R_Leakage-. The green is the sum of the leakage currents.

author: Thumper_LV
author_rank: Contributor
timestamp: February 23, 2023, 11:37:42 pm
content: I'm starting to understand why most existing commercial offerings implement this function at a central power supply level and not at each individual connection - which would certainly be nicer for field techs.Staring at it...staring at it...eyes glazing...re-reading comments...This might actually be a complete answer to my question. Thank you!But to double check...I'm looking at the graph, having loaded it in LTSpice, and since I've never used this before I have some very novice questions:1. Seeing the graphs of the voltage, if I'm understanding correctly, at about 12uA of current the optocoupler will trigger? I'm inferring that based on the time when the trigger activates - and then looking at the current draw graph - and then visually approximating their place.2. Since I'm still totally ignorant of LTSpice - can you please show me how I can simulate both -/+ active at the same time?3. How much current will be drawn with no short to ground? In other words, how much "parasitic" load am I placing on my power supply with this setup that I'll have to account for with battery backup - when every uA counts for something? I'm guessing 3mA?And...back to my original question. I *think* I see that this offers very good separation for the MCU from the field wiring - which I asked for and appreciate. So now I'm trying to make a semi-intelligent comparison in methods. This method appears to offer isolation and takes the "decision-making" off the MCU, doing it in hardware - and then whether I use one or two inputs to monitor the optocouplers is up to me. Now - I'm still thinking that a simple voltage divider connected to the built-in ADC of the MCU would be simpler. Not better - just simpler. Am I wrong? Based on the responses I've received to this question it seems I must be - but I still don't understand why.

author: Zero999
author_rank: Super Contributor
timestamp: February 24, 2023, 09:11:55 pm
content: Quote from: Thumper_LV on February 23, 2023, 11:37:42 pmYes.QuoteI don't understand. Do you mean both positive and negative leakage? The circuit only measures the difference in currents. If you put 1k resistors from both the positive and negative side of the 40V supply to earth, there won't be any leakage because the currents will cancel.QuoteMost of the current flows through R6 and R9 because the comparators are configured to have low output when no current is detected. Swapping the inverting and non-inverting inputs and the opto-coupler outputs so they pull-up will reduce the power consumption to purely the LM393 and R1 to R5.QuoteIn order to just use an ADC input, the MCU's power supply needs to be referenced to the middle of the 40V supply. I hinted at this in my previous post, but didn't articulate it very well. It's what R5 and R6 do in theother circuit. Adding an instrumentation amplifier is another option. Anyway it's safer to use a separated supply for the MCU.Here's the circuit again changed to use less power, when there's no leakage. I've also plotted more of the voltages. The pink and purple are the positive and negative thresholds and the orange (com, short for common) the voltage on the earth/ground, relative to the 0V of the 40V supply.EDIT1: Added R2, which I missed off.EDIT2: Whoops I missed off R10 and put D2 in the wrong place!

author: Thumper_LV
author_rank: Contributor
timestamp: February 25, 2023, 06:57:08 am
content: Quote from: Zero999 on February 24, 2023, 09:11:55 pm

author: Thumper_LV
author_rank: Contributor
timestamp: February 26, 2023, 07:33:29 am
content: Can this use a dual comparator like the LM393BIDR? Or is it better to keep them independent?

author: Zero999
author_rank: Super Contributor
timestamp: February 26, 2023, 09:43:21 pm
content: Yes, of course it can be a dual comparator. That was the idea. It's just LTSpice doesn't support dual parts, so requires a separate power supply for each part. Note there should also be a decoupling capacitor across the LM393's power pins, which I omitted, for the simulation.I would recommend considering a comparator which will work up to 40V, that way D1, D2 and R10 can be eliminated. The TLV1822 appears to be perfect. It uses less power than the LM393 which is also good. The only downside its it's more expensive than the LM393.https://www.ti.com/lit/ds/symlink/tlv1811.pdfAlso note that all voltages in a circuit are relative.Spice calculates all voltages and currents relative to a single 0V ground reference. LTSpice includes another symbol which generates the node com, which I've used to simulate the earth ground for leakage.

author: Thumper_LV
author_rank: Contributor
timestamp: March 01, 2023, 10:53:57 pm
content: Trying to translate this to KiCAD - and actually understand what we're doing.Next question is the 47k resistors going to the two optocouplers (I'm going to try using a dual version - LTV827S). Looking at the LiteOn LTV-827S, I see (I think) a 1.2 forward voltage and 20mA forward current. Wouldn't a 2k resistor be appropriate?Having worked up the schematic I've added a summary for future reference (please confirm this is accurate). I don't know how to inline an image here.

author: Zero999
author_rank: Super Contributor
timestamp: March 02, 2023, 06:56:39 pm
content: Quote from: Thumper_LV on March 01, 2023, 10:53:57 pmThat looks sensible to me, except for the higher forward current.Nowhere on the data sheet does it say the forward current must be 20mA. It's just the current, the forward voltage is specified at. Other characteristics are specified at different currents. For example the collector current is given with a forward current of 5mA. I chose 47k to keep the current and therefore power dissipation low. The minimum current transfer ratio is 50%, so as long as the forward current is at least double the collector current, then it will work.

author: Thumper_LV
author_rank: Contributor
timestamp: March 02, 2023, 07:11:44 pm
content: Ok - but I'm still confused. But perhaps my confusion has moved to a different area.I'm slowly getting into my head that current levels for LED's may not, and perhaps typically do not, directly line up with datasheets. So if the Vf shows 1.2 typical, 1.4 max, measured at If=20mA, I don't actually need 20mA unless I need maximum brightness for some reason - which also justifies reducing LED life. I think I got that right.But...on the datasheet I'm looking at (I'll attach it so we're discussing the same thing) I show collector current minimum of 2.5mA and maximum of 30mA. You said minimum double of collector current for target forward current - so the goal should be 5mA. I accept that...but now the math doesn't work for me.( 40VDC - 1.2VDC ) / 0.005mA = 7760ohm resistor, or 8k. If I use a 47k I get 0.83mA - which I'd love for power consumption but the paperwork says it won't work. Or does it?

author: Zero999
author_rank: Super Contributor
timestamp: March 02, 2023, 07:26:36 pm
content: Quote from: Thumper_LV on March 02, 2023, 07:11:44 pmNowhere does the data sheet say the collector current needs to be a minimum of 2.5mA. It just says the collector current will be no lower than 2.5mA and no greater than 30mA, when IF=5mA and VCE=5V.QuoteYou've got that backwards.Quote0.83mA for the forward current is fine for a 3.3V supply and 10k load resistor on the phototransistor.

author: Thumper_LV
author_rank: Contributor
timestamp: March 02, 2023, 07:49:25 pm
content: Quote from: Zero999 on March 02, 2023, 07:26:36 pmPage 10, Transfer Characteristics, Collector Current, 2.5mA minimum. What am I reading incorrectly?QuoteSo...collector current should be double the forward current?QuoteI accept this as coming from authority. Any difference if using 5V supply (which I'm considering now)?

author: Zero999
author_rank: Super Contributor
timestamp: March 02, 2023, 09:07:06 pm
content: Quote from: Thumper_LV on March 02, 2023, 07:49:25 pmRead the entire row. It also says VCE= 5V and IF= 5mA. The data sheet provides a list of specifications under certain conditions. Many of them aren't applicable to your application. You want VCEto be close to zero, not 5V, when the phototransistor is on.QuotePlease re-read the post.https://www.eevblog.com/forum/projects/voltage-divider-for-ground-fault-detection/msg4732046/#msg4732046QuoteUnless Rle is increased to compensate for the higher voltage, the collector current will be higher, so the forward current would also need to be a little higher to ensure saturation i.e. VCEbeing close to zero.

author: Thumper_LV
author_rank: Contributor
timestamp: March 02, 2023, 09:21:27 pm
content: Quote from: Zero999 on March 02, 2023, 09:07:06 pmThank you. I don't fully understand - I need to study basic transistor theory (which means I'm totally floundering here) - but I accept this and will follow directions.QuoteI thought I initially quoted that back to you - but you said I had it backwards. Then I reversed it - and obviously got it wrong again. I probably expressed myself poorly - after all English is only my primary language. See my comment above regarding lack of basic transistor understanding.QuoteThanks again.

author: Zero999
author_rank: Super Contributor
timestamp: March 02, 2023, 09:35:00 pm
content: Quote from: Thumper_LV on March 02, 2023, 09:21:27 pmAs I'm sure you're aware, IR from an LED turns on phototransistor, but there's more to it than that. Like any transistor, a phototransistor has three regions of operation: cut-off (when no light is shining on it), active (it's partially on, behaving like a current source and saturation (current is flowing through the transistor, with low voltage drop). The characteristic you've cited is for the active region, when there's 5V between the emitter and collector and 5mA flowing through the LED, the current through the transistor will be between 2.5mA and 30mA.The current transfer ratio, similar to the hFE in a normal BJT, but is the ratio of the collector current, to LED forward current, rather than base current. Your opto-coupler has a current transfer ratio of 50% to 600%, hence why the collector current can be anywhere between 2.5mA to 30mA, with 5mA flowing through the LED.You want the photo transistor to be in the saturation region, when the LED is on and cut-off, when the LED is off. The LED has to be bright enough to turn the phototransistor on enough, so the voltage drop across it is low enough to pull up the voltage across the emitter resistor, close enough to 5V to activate the microcontroller's input.

author: Thumper_LV
author_rank: Contributor
timestamp: March 02, 2023, 09:42:38 pm
content: Quote from: Zero999 on March 02, 2023, 09:35:00 pmI think you edited your post. And...you were right. But I'm very slowly getting there. Painfully - for all involved.So far everything makes sense...except for the math/experience that tells you how a 47k resistor will work here. I don't understand that part at all.

author: Zero999
author_rank: Super Contributor
timestamp: March 02, 2023, 09:48:49 pm
content: Quote from: Thumper_LV on March 02, 2023, 09:42:38 pmYes, I did edit, but after I noticed you'd replied, I moved my edit to a new post.The 47k sets the forward current to 0.83mA and you originality had 3.3V on the MCU side and with a 10k pull-down, 0.33mA would flow through the phototransistor, which is fine given a minium current transfer ratio of 50%. Now with 5V, the phototransistor will have to pass 0.5mA, so there's a slight risk it might not turn on enough with an LED current of 0.83mA. You can either up the LED current, or reduce the transistor current.

author: Thumper_LV
author_rank: Contributor
timestamp: March 02, 2023, 10:09:53 pm
content: Quote from: Zero999 on March 02, 2023, 09:48:49 pmI changed my mind again - forget about 5V. I'll stick with 3.3V - I think. Maybe. I've been going down the rabbit hole with implementing power supplies - when I discovered prepackaged power supply components. Then it looked like only the 5V models were UL - until I opened my eyes and found other suppliers. So I'm back to playing with 3.3V since it seems like that gives me more MCU options.Ok - back to the question at hand. You're confirming my math is right - that makes me feel at least a little better. I even understand your statement about a current transfer ratio. What I still don't understand is exactly where you decoded that information from the datasheet.Hmm...page 10 shows the 50%-600% transfer ratio - but that's at 5mA and 5V which we're trying to reduce. I look at the next page and see a "rank table" - which I'm inferring means only "Grade A" components will work at 50%, anything inferior is far less sensitive (did I get that right?). Going back...re-reading...No, I'm not "aware", at least, not enough to consciously use the information yet, that transistors are 3-stages. I'm used to thinking in terms of two states, on/off, because I work with large relays and not these fun tiny toys. All I'm thinking about with regard to a "transient" or partial state, for which I guess the proper term is "active"?, is I should be avoiding that state and either keep the switch off or supply it enough to be fully on. Which I'm just barely starting to understand may not be necessary or even desirable.So - are you saying that with this optocoupler, at 0.83ma, while the LED isn't fully on it will be bright enough for the photocell to sufficiently "turn on" (I should probably say something like saturate, bias, conduct, or something else more technical) to allow enough current to pass for the MCU to see a high state?

author: Zero999
author_rank: Super Contributor
timestamp: March 02, 2023, 11:47:50 pm
content: I don't have time to post a detailed reply at the moment.Basically if the transistor is biased so it passes say 0.5mA, it will pass that as long as the voltage and resistance of the power supply will allow. If not it will go into the saturation region and be fully on. Suppose the CRT is 100% and you have 0.5mA through the LED. If you connect a 5V supply to the transistor, it will also pass 0.5mA. If you add a 1k series resistor, it will still pass 0.5mA, with 0.5V being dropped across the resistor. If the resistor were increased to 2k, 0.5mA would still flow causing a drop of 1V across the resistor. If the resistor were increased to above 10k, then current would fall below 0.5mA and the transistor would become saturated, with very little voltage dropped across it.In short, don't stress over the data sheet too much. Give the LED plenty of current, to ensure the phototransistor turns on enough to activate the MCU input.EDIT:Here's a schematic showing the different BJT operating regions.Q1 & Q2Cut-off. When the base isn't connected to anything, only a tiny leakage current flows. Note that if the base is connected to the emitter, the collector current will fall further. This is because, when the base was left floating, some of the leakage though the collector-base junction was biasing it slightly on.Q3 & Q4Active/linear. The collector current is set by the base current and doesn't change much, when the collector resistor or voltage is changed. A large proportion of the supply voltage is dropped by the transistor and some across the collector resistor.Q5 & Q6Saturation. If the base current is increased further, or the collector resistance increased, the transistor will saturate. The collector current is mainly determined by the collector load resistor, rather than the base current and the transistor only drops a small voltage.The above modes are just as relevant to your a transistor. It's just the base current is internally generated by light shining on the base junction. In case of an opto-coupler, the amount of light is determined by the LED forward current.You want your phototransistor to be in the cut-off or saturation region, depending on whether the LED is off or on. The load resistor has to be low enough on the phototransistor side to ensure the leakage current doesn't cause the voltage across it to rise high enough to trigger the MCU's input pin or result in an invalid logic level and he LED forward current needs to be high enough to drive it into saturation.