# High-side current sensing diagram

I have a load that can be connected or disconnected from a +5V source (let's assume there is a switch). My target is to trigger an output to high-level voltage if the load is connected, and trigger it to low-level if it's disconnected. So far, the only idea that came into my mind is a current sensing circuit. I've tried with the following circuit The problem is that, for high-side, it is not working properly (maybe cause op-amp input voltages are too close to supply?). I know there are specific ICs for high sensing, but my idea is to build it without ICs. How would yo do it?

1. The current sensing must be on the high-side.
2. Output must be 0V if load is disconnected.
3. Only 5V supply voltage is available.
4. The load current may range between 0 and 500 mA.
• A load current of zero is unrealistic because the sensing circuit will then sense its own current and believe the load is connected. You have to be more realistic. – Andy aka Aug 1 '17 at 17:24
• Ok, so I accept suggestions. The ultimate aim of this circuit is to detect whether an USB device of any kind (that's the load), which does not necessarily have to drain 500 mA, is connected or not, and then send a trigger to another circuit that will handle the logics. – Alreiber Aug 1 '17 at 17:37
• What op amp are you using? As you say, the inputs are near 5 volts, so if you're using 5 volts for the op amp supply, are you using a rail-to-rail input amp? What does your data sheet say? – WhatRoughBeast Aug 1 '17 at 17:40
• I'm afraid not. I'm using LT1078. – Alreiber Aug 1 '17 at 17:51
• The idea doesn't seem to be coherent. You don't want to use a dedicated IC (ZXCT1009, INA180/181/199, etc, a $0.59 part), yet you use another IC - operational amplifier,$5-\$10 each. While the desire to learn is very commendable, re-discovering and re-inventing wheels might be impractical. There was a lot of engineering men-hours and wisdom invested in the high-side current monitors. – Ale..chenski Aug 1 '17 at 18:45

I guess I can't avoid the temptation. Try: simulate this circuit – Schematic created using CircuitLab

In both examples above, you want to use an ultra low current supply, rail-to-rail i/o opamp, with low offset voltage and current. I think the LT1494 may be at least interesting here. The opamp needs to be in control with the inputs near the top rail (the bottom rail won't matter much.)

The opamp supply's current will be just equal to the current in $R_2$ (plus its own stray requirements, which is why you want a very low supply current opamp), sinking it through $R_3$. Since the input node voltages are approximately equal to each other, this means the current in $R_2$ is $I_{LOAD}\cdot \frac{R_1}{R_2}$. So the left side's voltage across $R_3$ is just a proportional output where $V_{prop}\approx I_{LOAD}\cdot\frac{R_1\cdot R_3}{R_2}$. The exact value depends. But in this case I don't think precision isn't terribly important to you.

The right side uses this developed voltage to drive a BJT indicator output. This output is the exact opposite of what you say you want. But I'm sure you can work out how to invert it.

[I selected $R_5$'s value to be pretty high (mostly because I'm thinking about keeping the added circuit's current load fairly low and I didn't want to add much load to the voltage developed across $R_3$.)]

I've set this to generate an active output when the load current rises over about $10\:\textrm{mA}$. You specified zero, but you know that is impossible here. Some reasonable value has to be used. I picked this. You can pick something else, if you want.

Of course, the dedicated ICs (such as those mentioned by Ali Chen) are probably a better way to go.

Using your Schematic, selecting a rail to rail input opamp and adding a resistor from the positive differential input of the Opamp to GND. With this resistor you should ensure only a few milivolts voltage drop on R1. This voltage drop define the minimal load that you can detect with the Rschunt.

Vout will be hi only if Vdrop(Rshunt)>Vdrop(R1).

Your circuit seems to lack negative feedback to me. If you want to do it this way, you could try a differential amplifier to amplify the voltage across the sense resistor, while (hopefully) ignoring the large common mode signal (the supply voltage). But CMR in these circuits depends on resistor matching, and then you also have to think about the various bias currents and so on - as well as selecting an amplifier that works well rail to rail.

But you are solving a problem which has already been well solved; there are specific ICs for this purpose. Some are three pin devices - you simply put two pins across the sense resistor and add one resistor to ground from the third pin, and you get a well-behaved sense voltage referenced to ground across it. All for less than a dollar. Unless this is some kind of academic exercise I don't know why you would spend time doing it any other way.