Constant current load circuit not working - Page 1
Forum section: electronics / beginners

author: irondemigod
author_rank: Newbie
timestamp: October 14, 2023, 08:46:02 am
content: Hello!I was following a circuit i found on a GreatScott! video on a DIY constant current load to test Li-ion battery capacityhttps://youtu.be/8uBcywBUTkw?si=VhL7gNziFPHLK-8yI made the circuit exactly as the schematic showed, with the exact components, except for the opamp- I am using an LM358P instead of an LM358NBut i ran into a problem when testing itI set the potentiometer to 1V but its drawing only 140 mACurrent draw stays the same value with Vinbetween 0.39v to 5vbelow 0.39v the current changes as i adjust the potentiometer, and i cannot figure out why it is like thisAlso the output of the opamp is 3.8v, close to the 4 volts mentioned in the videoAccording to the video, a Vinvoltage of 1V should draw 1 Amp, since the resistor is 1 Ohm.Can anyone help me out on this?I have attached images of the circuit i madeIf you need other info, please ask, but i do not have an oscilloscope, only a standard multimeterThanks!

author: Terry Bites
author_rank: Super Contributor
timestamp: October 14, 2023, 09:55:23 am
content: The opamp needs to output Vgs+Vref to get the MOSFET to turn on.The opamp can barely make this swing on a 5V supply.Solution- run the opamp from a higher voltage.Note that this opamp will stop working when Vref gets near to 2V bellow the supply rail too"common mode range" limited. Worse still the opamp can't output more than supply rail -1.5V!And....This circuit may oscillate without added stability components.Have a word with Scotty.

author: irondemigod
author_rank: Newbie
timestamp: October 14, 2023, 02:11:31 pm
content: What voltage do you suggest i supply to the opamp?Also, why is V3 positive terminal connected to the 5V power supply's positive? (V3 is the battery terminals right?)The blue display power supply is meant to be replaced by the battery, i put it there to see the current draw

author: Dan123456
author_rank: Regular Contributor
timestamp: October 14, 2023, 03:12:33 pm
content: This might be a dumb question on my part but do you definitely have the MOSFET hooked up correctly (I.e. the right pins connected to the right spots? At 2:36 in Scotts video it looks like it might be hooked up differently but it might just be camera angles or me misunderstanding his circuit.Everything else looks like it is wired up correctly but, that said, it’s 2am here and I am tired so I could have missed somethingEdit: oh maybe just double check the trimpot tooI just know I have made that mistake in the past

author: irondemigod
author_rank: Newbie
timestamp: October 14, 2023, 03:14:34 pm
content: I tried the circuit with 12v power supply to opamp and it works good enough considering i havent added the filtering and compensation componentsYes the MOSFET is wired up correctly, and worksWill add the rest later, but it is working now

author: Benta
author_rank: Super Contributor
timestamp: October 14, 2023, 06:22:30 pm
content: Your load needs to be connected between the drain and V+ (not GND). Just sayin'.

author: magic
author_rank: Super Contributor
timestamp: October 15, 2023, 07:00:35 am
content: The circuit itself is a dummy load, just sayin'Everything is connected correctly. Only lack of compensation may possibly cause issues at some point.

author: Benta
author_rank: Super Contributor
timestamp: October 15, 2023, 10:49:29 am
content: Take second look.

author: larsdenmark
author_rank: Regular Contributor
timestamp: October 15, 2023, 11:36:16 am
content: As others have written: your opamp can't output voltages high enough for this to work.Also: breadboards are not really made for current close to 1 A or higher. The breadboard itself may have a resistance that is close to 1 Ohm like your shunt resistor which will disturb your current measurement.

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: October 15, 2023, 06:39:49 pm
content: I had a very similar question to this a while back.https://www.falstad.com/circuit/circuitjs.html?ctz=CQAgjCAMB0l3BWEBmAHAJmgdgGzoRmACzICcpkORKWISCkdApgLRhgBQyWjRcILZOhB9GYHOChQuPEfypyxRahEaQOfUuFwjUIdKj1E9yKNAlrY6ZGHh37kYeg5gs1YyFSNSFybfhm5AwO9hAASkwAzgCWkQAuAIYAdgDGTBwA7iA+KMKuEkLSWQZGJgjCHupZouASNYXqAOa6nrx6OWoczejo1Dk9KmDCnc016JBG-ANS6gBOiuDKC+N6Yhxh+r0C4ozTbDpqcuCHlgiZ2hIK+YvUVRc3C8S359Nem30WHHEo5S01lZJBDhoGQiFhSOx0KQsIYKBZsHhxDgEENSMgqHhjowACZMABmCQArgAbOIvLZsHC7LbiIrvbZUlqUzrVfjMhYsN7qcQVNlvGqCJwgXEEklxFjEpjYyRiEBU9QbAU7DnXQ58I4naBneYedm62lKHhwDhAAUse Falstad to help troubleshoot your circuit. Modify the "10V" to whatever voltage you plan to use at the input of the op-amap & for the op-amp reference voltage. You will likely need to modify the 147k resistor.Keep in mind most mosfets need greater than 5v to operate with a low RDS-on (low resistance mode). Most op-amps further cannot output the same voltage that is inputted into them; I think the LM358 will output 1.5v LESS than whatever the input voltage is (therefore 5v = 3.5v output from the LM358).

author: Konkedout
author_rank: Frequent Contributor
timestamp: October 16, 2023, 04:17:35 am
content: The schematics which I see in this post might work, but they are missing something. That is feedback loop compensation. Depending upon the op amp, the FET, and maybe some other variables you could get oscillation under some conditions.This oscillation is due to the MOSFET gate capacitively loading the op amp output. This causes phase lag and can degrade feedback loop stability margins.Basically you want to put a resistor (my R59) between the op amp output and the MOSFET gate, another resistor (my R63) between the MOSFET source and the inverting input of the op amp, and a capacitor (my C31) between the op amp output and the inverting input.I did not do it in the old design shown in this snip, but you can add a resistor in series with my C31 in order to get optimize the dynamic response of this sort of circuit.I recommend tuning it in simulation, but doing this requires accurate models for the op amp and the MOSFET. The values I show in this schematic snip are reasonable. I guess the main point is that if you design your circuit board to include these 3-4 extra parts, you will not find yourself stuck with pcb artwork that does not work as needed.

author: LooseJunkHater
author_rank: Frequent Contributor
timestamp: October 19, 2023, 02:24:33 am
content: Quote from: Konkedout on October 16, 2023, 04:17:35 amCan you explain the rationale for R63 and C31?

author: Vovk_Z
author_rank: Super Contributor
timestamp: October 19, 2023, 08:10:26 am
content: R63 is needed to make opamps life more safe. Voltage across a shunt may became to high because of transients (higher than power supply), so opamp input current may became to large. Opamps typically don't like it. Usually you want opamp input current to be no more than 5 mA.1 k seems like a good compromise between robustness and accuracy of a device.C31 is typically needed in all similar circuits for a stability reasons. It will be unstable otherwise.Both of them typically not shown on a ideal circuits in textbooks, but both of them are typically needed in similar circuits.

author: magic
author_rank: Super Contributor
timestamp: October 19, 2023, 08:23:46 am
content: Quote from: LooseJunkHater on October 19, 2023, 02:24:33 amThey reduce bandwidth of the control loop around the MOSFET.These components make LM324 an inverting amplifier whose closed loop gain is C31 reactance divided by R63 resistance. This falls down to unity at 16kHz where reactance of 1nF is 10kΩ. Now the right end of R63 looks like the inverting input of an opamp with 16kHz gain bandwidth product, which is less prone to oscillation with the MOSFET circuit in its feedback loop than a 0.5~1MHz opamp like a "bare" LM324. On the downside, it's also slower to react to changes in input voltage or current setpoint.

author: Terry Bites
author_rank: Super Contributor
timestamp: October 21, 2023, 07:28:10 am
content: The supply voltage must be greater than: Vbat+I*Rdson+VrefSee simplfied diagram.

author: DavidAlfa
author_rank: Super Contributor
timestamp: October 21, 2023, 09:02:41 am
content: It'll get better using 100milliOhm instead, adjust reference accordingly.Also the LM358 is the worst op-amp to use here, output is VDD-1 .5V, so the max you'll get with 5VDD is 3.5V, this can barely turn a mosfet on!Get the LMV358 (Rail to rail version) or something newer like the MCP602.A BJT is much better suited here. easier and simpler to control, Mosfets are great for switching applications, but not so great for linear circuits, specially if driven at low voltages.This circuit example will allow xcurrent regulation between ~0 and 2Amps. Transistor will need heatsink for currents exceeding 200mA (0.8W at 4V).Most medium power BJTs have 100+ hfe so the current sensing error caused by the base current will be small, 20-30mA at worst with 2A load setting.

author: Terry Bites
author_rank: Super Contributor
timestamp: October 23, 2023, 09:00:32 am
content: Yeah a LMV358 and bjt could work well, but it there will still only be a couple of 100mV of headroom.Dicey!

author: temperance
author_rank: Super Contributor
timestamp: October 23, 2023, 12:59:10 pm
content: https://www.eevblog.com/forum/beginners/constant-current-load-stability/25/Post 31 and 42