Variable Constant Current Supply using Parallel Op Amps

dl324

Joined Mar 30, 2015
18,331
That actually helps me understand what I'm doing. I'm going to look into common-mode with regards to amplification circuits and learn more.
You should also note that the circuit simulator you're using, and LTspice, don't always give results that can be believed.

Looking at the schematic for LM741, you can see why an input voltage of a few millivolts won't work.

From Texas Instruments:
1768661786097.png
You have 5 transistor junctions that need to be properly biased for the input stage to function.

LM358 from Texas Instruments:
1768662561530.png
It was designed to operate from a single supply. Since the input stage is PNP, ground is allowed. You still need to stay a couple volts away from the positive supply because you have 2 BE junctions and a current source that need to be biased properly.

When operated from dual supplies, a resistor is needed between the output and the negative supply to minimize crossover distortion.
 
Last edited:

Thread Starter

Kitt.Rainbolt

Joined Jan 16, 2026
36
You should also note that the circuit simulator you're using, and LTspice, don't always give results that can be believed.

Looking at the schematic for LM741, you can see why an input voltage of a few millivolts won't work.

From Texas Instruments:
View attachment 362232
You have 5 transistor junctions that need to be properly biased for the input stage to function.

LM358 from Texas Instruments:
View attachment 362233
It was designed to operate from a single supply. Since the input stage is PNP, ground is allowed. You still need to stay a couple volts away from the positive supply because you have 2 BE junctions and a current source that need to be biased properly.

When operated from dual supplies, a resistor is needed between the output and the negative supply to minimize crossover distortion.
So those transistors in the LM741 all need a voltage differential to the rail in order to start conducting, and that voltage is higher because of the multiple transistor stages. I'm very new to electronics. I have a DSP background. I will come back to this thread once I've studied up.
 

dl324

Joined Mar 30, 2015
18,331
So those transistors in the LM741 all need a voltage differential to the rail in order to start conducting, and that voltage is higher because of the multiple transistor stages.
Yes. But that applies to all analog circuits.

When you follow datasheet restrictions, you can usually just consider an opamp as a 3 terminal device (ignoring supply and any offset null capability). When you're operating outside of, or near, them, or want to understand how the restrictions were derived, you need to study the innards of the box.

Your mistake was using an opamp not designed to work with a single supply in a single supply circuit. You had plenty of headroom from the positive rail, but none from ground. I noticed this when redrawing your schematic and took the liberty of substituting an opamp that would work.

No one has pointed out that LM741 is a very old design. At the time that it was designed, it was the greatest thing since sliced bread. It's still an adequate design if you use it as it was intended. I have dozens of LM741 in my stock because I used them when I was first learning electronics, and still use them. Plus I have a lot of Tektronix equipment that used them whenever nothing better was required.

LM358 weren't designed too many years after the LM741, but they were designed for single supply applications.
 

Thread Starter

Kitt.Rainbolt

Joined Jan 16, 2026
36
Yes. But that applies to all analog circuits.

When you follow datasheet restrictions, you can usually just consider an opamp as a 3 terminal device (ignoring supply and any offset null capability). When you're operating outside of, or near, them, or want to understand how the restrictions were derived, you need to study the innards of the box.

Your mistake was using an opamp not designed to work with a single supply in a single supply circuit. You had plenty of headroom from the positive rail, but none from ground. I noticed this when redrawing your schematic and took the liberty of substituting an opamp that would work.

No one has pointed out that LM741 is a very old design. At the time that it was designed, it was the greatest thing since sliced bread. It's still an adequate design if you use it as it was intended. I have dozens of LM741 in my stock because I used them when I was first learning electronics, and still use them. Plus I have a lot of Tektronix equipment that used them whenever nothing better was required.

LM358 weren't designed too many years after the LM741, but they were designed for single supply applications.
I'm beginning to understand that theory helps me understand the basics, but memorization and repetition will help me develop skill. I have a hard time reading larger circuit diagrams because I haven't yet learned to identify common topologies and mentally partition things into smaller chunks.
 

dl324

Joined Mar 30, 2015
18,331
I'm beginning to understand that theory helps me understand the basics, but memorization and repetition will help me develop skill.
I'd add reading the datasheets for components you plan to use and understanding the limitations of 50-year-old designs.

Some/many just throw relatively expensive, over-specified parts at all problems. I prefer to use components that are good enough. I learned electronics in the mid-70's and still use many parts from that era (LM741, LM358, LM324, LM393, LM339, LM311, LM301, LM308, LF356, LM3900, CA3080, etc).

I bought some dual and quad rail-to-rail opamps a few years back to see what all of the fuss was about. The supply voltage range was surprisingly small, and I haven't built any real circuits that needed them. Unfortunately, their datasheets didn't include schematics for the internals.
I have a hard time reading larger circuit diagrams because I haven't yet learned to identify common topologies and mentally partition things into smaller chunks.
I find it difficult to force myself to read schematics that don't conform to widely accepted practices.
 

Thread Starter

Kitt.Rainbolt

Joined Jan 16, 2026
36
I'd add reading the datasheets for components you plan to use and understanding the limitations of 50-year-old designs.
...
I find it difficult to force myself to read schematics that don't conform to widely accepted practices.
I've started doing so! I ordered some of those lm358s based on learning what to look for in the datasheet. Re: nonconforming schematics, I can imagine how difficult that is - I'm a C++ programmer and I know how hard it can be to detangle a newbie's spaghetti code. Thanks for doing that on my behalf, it means a lot.
 

Thread Starter

Kitt.Rainbolt

Joined Jan 16, 2026
36
Okay. I learned LTSpice basics and put together an updated schematic including the Arduino I will be using to control and monitor current delivery.
Arduino Controlled Current Supply.png
The arduino will send CV (0 to 1v) to ArduinoDAC and indirectly monitor current through the load via ArduinoIn.
The lm358 can deliver enough power for my load, but not enough power for the arduino's 9v input. I chose to use the extra lm358 channel in conjunction with an npn transistor to create a 9v power source. LTSpice file attached (also attached lm358 models)

edit:
Things I'm worried about:
- I'm new to npn transistors. The arduino will draw anywhere between 10mA to 500mA. My transistor can handle 500mA, but I'm not sure if transistors have like.. a minimum base->emitter current?
- Is crosstalk in opamps something we only really worry about when we're not doing mainly DC? Should I use a decoupling cap somewhere on the arduino's power input since it's a spikey load?

Also, does this seem to be a more well-formed circuit diagram?
 

Attachments

Last edited:

panic mode

Joined Oct 10, 2011
4,992
your supply is 27VDC. Arduino Vin is targeted as 9V. that means transistor will need to drop 18V. if the load is 100mA, that means transistor will dissipate 18V*0.1A=1.8W as heat. that would require suitably large transistor and a heatsink. the problem here is high voltage drop. when dealing with high voltage drop heat is a major problem. common solution is to use switching regulator as they are much more efficient and produce hardly any heat.
 

dl324

Joined Mar 30, 2015
18,331
I learned LTSpice basics
Also, does this seem to be a more well-formed circuit diagram?
I'm not a fan of LTspice schematics. They always look a bit amateurish to me. Starting with the resistor symbol - not enough humps. I was taught to use exactly 3 humps on each side. The transistor symbol is too large. The power connections on the opamps are often distracting.

0.5M and 500 ohms aren't standard values. We typically use the R designator for most/all resistors.

I would have tried to avoid the wire bend on the pot, aligned R3 with ArduinoPWR, centered battery, and spaced columns of components more evenly horizontally. The Meg suffix should just be M and the R suffix on the 500 ohm resistor is unnecessary. Ground should always point down. Repositioning the directives would allow the schematic to be shorter. You shouldn't use generic devices (NPN) for simulations (or schematics).
The lm358 can deliver enough power for my load, but not enough power for the arduino's 9v input.
You don't say which Arduino you're using. Don't most/all of them also operate directly from 5V (applied to the USBVCC input)?
I'm new to npn transistors. The arduino will draw anywhere between 10mA to 500mA. My transistor can handle 500mA, but I'm not sure if transistors have like.. a minimum base->emitter current?
The transistor will never be saturated, so base current will be amplified by beta. As long as base current is less than about 25mA, the circuit will work. However, power dissipation in the transistor will be an issue. P = IV = 0.5A * 18V = 9W. No transistor will handle that without a heatsink, and no small signal transistor will handle even with a heatsink.
Is crosstalk in opamps something we only really worry about when we're not doing mainly DC? Should I use a decoupling cap somewhere on the arduino's power input since it's a spikey load?
You should always use decoupling caps on opamps (and all IC's). I might put a cap on the pot wiper.
 

crutschow

Joined Mar 14, 2008
38,516
If you aren't worried about efficiency, you can reduce Q1's power dissipation by adding a power resistor in series with its collector.
For example, a 30Ω, 15W resistor will drop 15V at 500mA, leaving a drop of 3V across the transistor, so it has to dissipate a maximum of only about 2.7W at its peak dissipation point (300mA).
 
Last edited:

Thread Starter

Kitt.Rainbolt

Joined Jan 16, 2026
36
your supply is 27VDC. Arduino Vin is targeted as 9V. that means transistor will need to drop 18V. if the load is 100mA, that means transistor will dissipate 18V*0.1A=1.8W as heat. that would require suitably large transistor and a heatsink. the problem here is high voltage drop. when dealing with high voltage drop heat is a major problem. common solution is to use switching regulator as they are much more efficient and produce hardly any heat.
Okay. My power comes from multiple rechargable 9v batteries in series and I was originally worried about uneven current drain from doing this, but maybe its better to just do a center tap.

The (qty 4) nominal 9v batteries are actually 7.2v, so I could just tap halfway through the series to create a 14.4V power rail and swap the batteries around every so often. I wonder if I could use a relay or a few transistors to switch between them based on level of charge?
 

panic mode

Joined Oct 10, 2011
4,992
just use switching regulator. this will waste very little energy ensuring long battery life. and you can keep the batteries in series.

things like LM2596 are beasts and you get assembled module for a buck or two. if only powering Arduino project (potentially "high current") adjust it for 7.5Vor 8V output and you are all set. OpAmp will be happy with resistor and zener.
1768938494644.png
 

Thread Starter

Kitt.Rainbolt

Joined Jan 16, 2026
36
This is a potential problem. A fully charged 7.2V NiCd will be around 8.4V. 4 in series would be 33.6V. That would exceed the absolute maximum supply voltage of 32V for LM358 (and many other opamps).
I got li-ion rechargable 9v batteries with usb charge ports. I can use 3 of them if they turn out to be higher voltage than expected. The load resistance is likely going to be more like 5-10k so I have the headroom to choose any voltage between ~25v to 30v
 

Thread Starter

Kitt.Rainbolt

Joined Jan 16, 2026
36
just use switching regulator. this will waste very little energy ensuring long battery life. and you can keep the batteries in series.

things like LM2596 are beasts and you get assembled module for a buck or two. if only powering Arduino project (potentially "high current") adjust it for 7.5Vor 8V output and you are all set. OpAmp will be happy with resistor and zener.
View attachment 362462
I was thinking about using a buck converter! I think I'll use something like this on the final product. In the meantime I'll tap the cells to get an intermediate rail for the proof of concept.
 

Thread Starter

Kitt.Rainbolt

Joined Jan 16, 2026
36
I'm not a fan of LTspice schematics. They always look a bit amateurish to me. Starting with the resistor symbol - not enough humps. I was taught to use exactly 3 humps on each side. The transistor symbol is too large. The power connections on the opamps are often distracting.

0.5M and 500 ohms aren't standard values. We typically use the R designator for most/all resistors.

I would have tried to avoid the wire bend on the pot, aligned R3 with ArduinoPWR, centered battery, and spaced columns of components more evenly horizontally. The Meg suffix should just be M and the R suffix on the 500 ohm resistor is unnecessary. Ground should always point down. Repositioning the directives would allow the schematic to be shorter. You shouldn't use generic devices (NPN) for simulations (or schematics).
You don't say which Arduino you're using. Don't most/all of them also operate directly from 5V (applied to the USBVCC input)?
The transistor will never be saturated, so base current will be amplified by beta. As long as base current is less than about 25mA, the circuit will work. However, power dissipation in the transistor will be an issue. P = IV = 0.5A * 18V = 9W. No transistor will handle that without a heatsink, and no small signal transistor will handle even with a heatsink.
You should always use decoupling caps on opamps (and all IC's). I might put a cap on the pot wiper.
Is there some sort of online bluebook for diagram symbols? I am open to the idea of modifying my LTSpice models. I already did it to get the + on top of the op amp, it would be trivial to reduce the op amp size. I don't know about hiding the power on the op amp. At this stage in my electronics journey, I think having that power visible will help me keep track of things. I don't know if LTSpice supports other suffixes - the "Meg" suffix bothered me too. I wonder if spice directives aren't case-sensitive so they had to use m and Meg instead of m and M?

Regarding standard values - I'm just using what I have on hand. I can run parallel 1M and 1K resistors to acheive those, but I'll double check that I don't have a way to do this with 2 standard resistors instead of 4.
 
Last edited:

panic mode

Joined Oct 10, 2011
4,992
one can enter 1k or 1K and both are treated as 1k (1000 Ohm).
one can type 1m or 1M and in both cases it appears as 1m (0.001 Ohm)
i dislike 1Meg and rather type 1000k. Funny thing this is one piece of software where case sensitive should have been implemented.
 

dl324

Joined Mar 30, 2015
18,331
I got li-ion rechargable 9v batteries with usb charge ports. I can use 3 of them if they turn out to be higher voltage than expected.
Those batteries were a nice idea, but the implementation is poor. The output voltage is very near 9V, but the capacity is very likely exaggerated and the batteries will likely self-discharge in a month or two. I bought 10-20 of them and am dissatisfied.

Also, they have switching noise that the NiCd batteries you currently have don't.
Is there some sort of online bluebook for diagram symbols? I am open to the idea of modifying my LTSpice models.
Not really. The Eagle editor I use has 4 humps on resistors. That's still too many, but it's better than 2 and I'm not inclined to change them. I did modify some components I used often that were bad to horrible (like the 555 timer and inverters that were too large).
it would be trivial to reduce the op amp size
Now that you mention it, the opamp symbol is too small.
I'm just using what I have on hand. I can run parallel 1M and 1K resistors to acheive those
If you're doing that, I'd indicate that on the schematic so others don't comment on the non-standard values. The closest 5% value to 500 is 511.

one can type 1m or 1M and in both cases it appears as 1m (0.001 Ohm)
i dislike 1Meg and rather type 1000k.
I didn't know that. But, then, I'm not a big fan of LTspice. I use the simulator between my ears more.
 

crutschow

Joined Mar 14, 2008
38,516
I'm not a big fan of LTspice. I use the simulator between my ears more.
We're aware of that.
But does that simulator show you all the currents, voltages, and waveforms of every component and circuit node? :rolleyes:
it would be trivial to reduce the op amp size.
But you would have to do that for every model, since every op amp model uses there own symbol.

If interested, below is my modified LTspice resistor symbol which has 3 humps on each side.
I also added a dot next to the terminal that has a positive voltage when current is going into that terminal. This indicates which direction the current is flowing when plotting the resistor current.
1768952407922.png

Remove the .txt extension when adding it to your CMP folder.
 

Attachments

Last edited:

Thread Starter

Kitt.Rainbolt

Joined Jan 16, 2026
36
We're aware of that.
But does that simulator show you all the currents, voltages, and waveforms of every component and circuit node? :rolleyes:
But you would have to do that for every model, since every op amp model uses there own symbol.

If interested, below is my modified LTspice resistor symbol which has 3 humps on each side.
I also added a dot next to the end that has a positive voltage when current is going into that end. This indicates which direction the current is flowing when plotting the resistor current.
View attachment 362478

Remove the .txt extension when adding it to your CMP folder.
Nice! I'll definitely use that. Much better than the insidious 2 hump model.
 
Top