Yet another circuit I need your help with! - Page 1
Forum section: electronics / beginners

author: Drake122
author_rank: Contributor
timestamp: March 07, 2018, 09:44:45 pm
content: Hey guys!I found this current sensing circuit as part of GreatScott's DIY overcurrent protection project. It amplifies the voltage drop across a small resistance. I tried to simulate it in EveryCircuit, but I still don't get what happens. The voltage on the inverting and non-inverting output stay 11.4 volts even if I change that 1k load resistance to almost 0 to send a high current. The circuit does indeed the works, on the output I get mA instead of uA. So my question is, what gets amplified, I don't see any increase on the non-inverting side, but maybe its just the software's limitation and it does increase the voltage by a really small ammount and that gets amplified.

author: Benta
author_rank: Super Contributor
timestamp: March 07, 2018, 10:01:41 pm
content: Seems your simulation SW is crap.At just a glance, the circuit should work fine.

author: Drake122
author_rank: Contributor
timestamp: March 07, 2018, 10:17:15 pm
content: Its called EveryCircuit. And it does work. But since I can't see it on the sim, what is happening? Am I right in assuming that the voltage drop on the sense resistor is added to the non-inverting input?

author: rstofer
author_rank: Super Contributor
timestamp: March 07, 2018, 10:46:13 pm
content: If you short out the 10 mOhm resistor, it is as though there is no current flow. What does your simulation give for this condition? With the 10 mOhm in the circuit, it is as though you are getting maximum current flow. Then what does the output look like. In the simulation, measure every node voltage under both conditions.Otherwise, it's back to Kirchhoff's Current Law and some node equations.

author: Wimberleytech
author_rank: Super Contributor
timestamp: March 07, 2018, 10:51:46 pm
content: QuoteThe amplifier amplifies the voltage across the 10m ohm resistor. The voltage on the inverting and nin-inverting input SHOULD stay at about 11.4 volts.V = 12*20k/21kThe opamp gain forces the inverting input to equal the non-inverting input.

author: Wimberleytech
author_rank: Super Contributor
timestamp: March 07, 2018, 10:55:28 pm
content: Quote from: Drake122 on March 07, 2018, 10:17:15 pmIt would be cool if we all used LTSPice. If you told me to do this a year ago, I would have rebelled, but I am now in love with LTSPice and rarely use my other simulator--even though it is a great SPICE and offers easier manipulation of models and such.I have simulated your circuit with LTSPice and achieved predictable results!

author: Audioguru
author_rank: Super Contributor
timestamp: March 07, 2018, 11:29:04 pm
content: Your negative image is a nuisance to modify.The opamp is not powered (it needs a plus and minus supply).The opamp has a low gain of only 21 times.Look here:

author: Nerull
author_rank: Frequent Contributor
timestamp: March 08, 2018, 12:28:59 am
content: The opamp does not need a separate power source in the simulation, it has its own built in.OP is trying to replicate this circuit, since he didn't bother posting it:https://cdn.instructables.com/FWD/SW5D/J5MQQ58B/FWDSW5DJ5MQQ58B.LARGE.jpg

author: Audioguru
author_rank: Super Contributor
timestamp: March 08, 2018, 12:38:26 am
content: I see that the original circuit has the opamp as a differential amplifier.The Instructable (some are written by kids who are only 10 years old) is wrong because it has an LM358 with one of its inputs above its Common Mode Voltage Range.That is whyeveryschematic should show its supply voltage.

author: Nerull
author_rank: Frequent Contributor
timestamp: March 08, 2018, 12:48:20 am
content: The circuit produces the exact same results in LTSpice and EveryCircuit, the simulation is not the issue except that EveryCircuit displays few significant digits in its values. The circuit amplifies the voltage difference across the 10mOhm shunt, and that voltage difference is quite small - smaller than EveryCircuit can display. It is calculating the proper voltage difference, it just isn't showing it to you. Insert the voltmeter component to show small voltages.Also realize that the inputs of a opamp, properly connected as an amplifier, will be essentially equal. Notice that there is a resistor connecting the output and the negative input, so that the voltage at that input is not only due to the voltage drop across the shunt resistor, but also due to the output of the opamp itself. That is the feedback circuit which sets the gain of the amplifier. The opamp will attempt to adjust its output until there is no difference between the output terminals. The larger the voltage drop across the shunt, the more voltage the opamp will need to output to keep its terminals equal.In this particular circuit, the terminals will have equal voltage if the opamp outputs 20 times the shunt voltage, whatever that may be. So, within the limits of its specs and power supply, the opamp always multiplies the shunt voltage drop by 20.

author: Inverted18650
author_rank: Frequent Contributor
timestamp: March 08, 2018, 01:12:48 am
content: Drake, I also have EveryCircuit on my iPhone so I can help you with the simulation if needed. You can also change the default opamp settings. The default is 100kV/V and you can tailor it for your selected part number.

author: Zero999
author_rank: Super Contributor
timestamp: March 08, 2018, 07:15:38 pm
content: Quote from: Drake122 on March 07, 2018, 09:44:45 pmYour circuit is working as expected.As mentioned above, both of the op-amp's inputs will be at the same voltage, due to negative feedback.If you subtracted the -input from the +input, then you'll find it's a very low voltage, dependant on the open loop gain of the op-amp. For example, if the output voltage is 0.2V and the op-amp has an open loop gain of 500 000, there will be only 0.4µV between the +input and -input, which will be too small to measure with an ordinary multimeter.Another interesting circuit to build is the inverting amplifier. If you measure V2, you'll find it's very close to zero. Obviously, you'll need to power this circuit from a bipolar power supply, e.g. +12V, 0V and -12V.https://www.electronics-tutorials.ws/opamp/opamp_2.html

author: Drake122
author_rank: Contributor
timestamp: March 08, 2018, 09:01:14 pm
content: Yet an other question came up, targeted @Inverted18650, you said you use EveryCircuit as well, but you guys can chip in as well.So, I guess I don't know how MOSFETs work, cause I don't get why this simple circuit doesn't work as I expected. Applied +5V to the gate, why isn't it fully opened? Also, what are those values? the width, length, kp, vto, lambda, none of them are on any datasheet for mosfets.

author: Wimberleytech
author_rank: Super Contributor
timestamp: March 08, 2018, 09:36:11 pm
content: Quote from: Drake122 on March 08, 2018, 09:01:14 pmIt appears to be working properly as an enhancement mode N-channel MOSFET. You have turned it on by driving the G-S voltage to 5 volts.The simple model for an NCH MOSFET operating in saturation is as follows:Ids = (kp/2)(W/L)(Vgs - Vto)2(1 + lambda*Vds)Vto is the threshold voltage and will be given in a datasheet.Channel width and length will not be given in a datasheet, nor will the channel-length-modulation parameter, lambda

author: Nerull
author_rank: Frequent Contributor
timestamp: March 08, 2018, 10:00:37 pm
content: Those are parameters you'd have to calculate or measure directly. The generic spice model of a mosfet isn't all that useful, typically manufacturers will provide full spice models of each specific mosfet which are much more accurate but to use those you'd need to dump EveryCircuit and move to something else. The default parameters are very much not suited to a power mosfet with low RDS.http://everycircuit.com/circuit/5927322113015808/Cranking your channel width up is one way to get it to act more like a switch, but if you really want to play with mosfets it might be time to learn LTSpice.

author: Inverted18650
author_rank: Frequent Contributor
timestamp: March 08, 2018, 11:09:13 pm
content: Quote from: Nerull on March 08, 2018, 10:00:37 pmNailed it. I do not have the required physics level knowledge of the fets to fully understand how to adjust all the settings in EC. I only change the width, as stated above, to make it switch on and off with a measured on resistance.