1
\$\begingroup\$

I'm simulating a DAC which puts out 0-20mA, but in practice, the output varies depending on the load of 300 ohm resistor. If I using a 1k ohm resistor, then I get a different output current.

If you don't understand the schematic below, I can tell y'all that this circuit is a feedback circuit.

enter image description here

This is a P-gain controller. It uses two transistors - one NPN and one PNP to let the current flow through from 24V power supply.

I could use an NPN transistor only, but then the base voltage of the NPN transistor would be very high e.g 24V-0.6V. Therefore I'm using a PNP with a NPN transistor so the NPN transistor is releasing the "pressure" at the base of the PNP transistor so current can flow from emitter to collector.

enter image description here

And this is the feedback where we measure the voltage drop over the 160 ohm resistor.

enter image description here

Try to change the load of the 300 ohm resistor and change the input voltage of 1.0v to e.g. 3.3v and then change the load. Why does the current output changes? Should this circuit not be a feedback circuit?

Link to simulation

What do you think about this?

\$\endgroup\$
24
  • 3
    \$\begingroup\$ That sziklai pair adds a massive amount of loop gain. I'd say this would be hopelessly unstable in the real world. \$\endgroup\$ Apr 24, 2021 at 13:05
  • 1
    \$\begingroup\$ Your Sziklai pair is adding a lot of gain and also a significant amount of delay to the loop. This is going to be very difficult to stabilize. \$\endgroup\$
    – Dave Tweed
    Apr 24, 2021 at 13:06
  • \$\begingroup\$ @DaveTweed So what should I do? Notice that this "sziklai" contains 10k resistors. \$\endgroup\$
    – DanM
    Apr 24, 2021 at 13:06
  • 1
    \$\begingroup\$ @DanielMårtensson Well, there are a couple of problems, at least. You bring up the fact that you are seeing a load-dependent variation. Well, that's entirely to be expected. A larger-valued load will require a larger voltage drop. But this added voltage drop also generates more current in the 10 k resistors driven by the opamp output and this "steals" current away from the load. Your 160 Ohm resistor accurately measures the sum, but it doesn't measure the load current. So if more current is diverted (because the load requires more voltage drop), then the load gets less. \$\endgroup\$
    – jonk
    Apr 24, 2021 at 19:23
  • 1
    \$\begingroup\$ @Circuitfantasist No. I don't have any -24. Double click on the op-amp and you will see the settings :) \$\endgroup\$
    – DanM
    Apr 25, 2021 at 11:54

3 Answers 3

4
\$\begingroup\$

A better approach would be to use a high-side current mirror, which allows you to do your current sensing on the low side, vastly simplifying the circuit.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
7
  • \$\begingroup\$ Nice, solves the stability problem as well. \$\endgroup\$ Apr 25, 2021 at 5:29
  • \$\begingroup\$ A beautiful solution... We can see it everywhere - from classic dynamic load stages to sophisticated CFA output stages... I don't know why I have reservations about using it in such circuits with discrete elements... it still seems to me that it is intended for use in the internal structures of integrated circuits. \$\endgroup\$ Apr 25, 2021 at 6:33
  • \$\begingroup\$ Wow! Excellent solution! I like it! \$\endgroup\$
    – DanM
    Apr 25, 2021 at 9:33
  • \$\begingroup\$ Dave! What do you think about replacing your NPN with a NPN+PNP transistor, like this? tinyurl.com/ygxwxjmj \$\endgroup\$
    – DanM
    Apr 25, 2021 at 11:36
  • \$\begingroup\$ @DanielMårtensson Now you're adding that massive loop gain again, destabilising things, for no good reason. \$\endgroup\$ Apr 25, 2021 at 12:24
2
\$\begingroup\$

I'm simulating a DAC which puts out 0-20mA, but in practice, the output varies depending on the load of 300 ohm resistor. If I using a 1k ohm resistor, then I get a different output current.

According to your simulation; with a 300 Ω load the output current is 6.206 mA, but with a 1 kΩ load it is 5.999 mA (0.207 mA less). We see why this is when we look at the current going through the right-hand 10k resistors. With a 300 Ω load it is only 0.043 mA, but with a 1 kΩ load it is 0.25 mA (0.207 mA more). The reason for this is that the 1 kΩ load drops more voltage (6 V vs 1.86 V), increasing the voltage across the 10k resistors. The sensed current is the same in both cases, but it includes the current through the 10k resistors. Therefore the 1 kΩ load gets less current than the 300 Ω load because more of the sensed current is 'stolen' by the 10k resistors.

You can eliminate this loading effect by buffering the sense resistor voltage, like this:-

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
1
  • \$\begingroup\$ Try to increase these 10k ohm resistors to e.g 200k. So all you have done is to place an op-amp buffer? I like your solution :) \$\endgroup\$
    – DanM
    Apr 25, 2021 at 13:57
2
\$\begingroup\$

... in practice, the output varies depending on the load of 300 ohm resistor. If I using a 1k ohm resistor, then I get a different output current.

This means that, for some reason, your circuit does not fulfill its main purpose of maintaining a constant current.

Conceptually, the circuit solution is correct. Because the load is grounded, the current is measured through a high side "floating" current-sensing resistor... and this requires the use of a differential amplifier.

The two transistors form not exactly a Sziklai pair because the emitter of the NPN transistor and the collector of the PNP transistor are separated... but this is not so important here.

The problem here, in my opinion, is that the PNP transistor cannot be reliably cut off when the NPN transistor is cut off (I have explained why here). This problem can be solved by connecting a (few k) resistor between its base and emitter and adding a "shifting" Zener diode in series to the base resistor.

Also, the PNP transistor should be always in active mode (with some voltage drop VCE > 1 V). Search in Google with "current source compliance voltage".


EDIT: I would like to consider the Dave's circuit solution (through a current mirror) by comparing it with the OP's solution. At first glance, they are completely different, but I will try to convince you that, in a sense, they are the same.

Both solve the same topological problem - they reverse the direction of the collector current of the NPN transistor. In the OP solution, the humble PNP transistor does this because its collector current has the opposite direction to the base current. In the Dave's classic current mirror, the PNP Q3 does this. So, in regards to the current direction, both they act as *current inverters"... both they are current mirrors...

In regards to the current magnitude, the OP's "1-transistor current mirror" (like every BJT) is an amplifier (Ic = beta.Ib) while the Dave's classic current mirror is a follower. It is interesting to see how this current ampifier is made act as a follower since unraveling this mystery would be a possible scenario for the current mirror inventing (very important for understanding).

The trick is simple - the excessive base current is diverted by an additional element connected in parallel to the PNP base-emitter junction (current divider). In the simple case, it can be a resistor (as I suggested above). Only, the resistor is linear while the base-emitter junction is non-linear and its resistance should be carefully adjusted (still it is used in MOSFET current mirrors).

A diode can serve as a good diverting element since actually the base-emitter junction is a "diode"... but they are not exactly the same. The perfect diverting element is a transistor made act as a diode - the so-called "active diode" (Q2).

On April 8, 2008, I conducted three consecutive labs dedicated to this kind of transistor current sources. After that, I wrote, with the help of my students, three exciting Wikibooks stories about how they and I "invented" the famous current mirror circuit:

Building the simplest transistor current source

Fig. 1. Building the simplest transistor current source

Trying to create a diode current mirror

Fig. 2. Trying to create a diode current mirror

"Inventing a BJT current mirror

Fig. 3. "Inventing a BJT current mirror

To write them, I recorded these "lab brainstorming sessions" on a solid-state recorder and made photos in the lab.

As a conclusion

Basically, both circuits do the same - they measure the load current by measuring the voltage drop across a stable (160 ohm) current-sensing resistor. The difference is that the OP's "amplifying current mirror" is inside the negative feedback loop while the Dave's true current mirror is outside the loop. So the former can be imperfect while the latter must be perfect. From this point of view, one can reach the paradoxical conclusion that, in a sense, the OP circuit is better:)

The problem of the simple BJT mirror is that it is based on the passive compensation (without negative feedback). But the simple op-amp differential amplifier is also based on this passive principle and it requires precise matching the four resistors.

\$\endgroup\$
19
  • \$\begingroup\$ Actually, a huge problem with the design is the measuring circuit. The current drawn away from the load varies when the load voltage varies (due to load changes.) So it will never be right. What the OP should want to do is to draw a fixed current away from both sides of the measuring resistor. This means a constant current mirror situation (full Wilson would be nice) as the only real avenue. That current can be set to an acceptable "offsetting" value and it will NOT vary as the load voltage varies, then. Get the basics right, first. Then work out the rest, I think. \$\endgroup\$
    – jonk
    Apr 24, 2021 at 19:57
  • \$\begingroup\$ But I'm using a NPN that "dumps" the voltage on the gate for the PNP transistor? \$\endgroup\$
    – DanM
    Apr 24, 2021 at 20:30
  • \$\begingroup\$ What do you think about this solution? I have modify it a little bit. tinyurl.com/yhchx87f \$\endgroup\$
    – DanM
    Apr 24, 2021 at 20:30
  • \$\begingroup\$ @jonk I solved this by selecting 200k ohm resistors instead. Have a look at my URL link above this comment. Now the circuit works. \$\endgroup\$
    – DanM
    Apr 24, 2021 at 20:31
  • \$\begingroup\$ It only differs 0.1 mA if I using to large load (2k). I can accept that. \$\endgroup\$
    – DanM
    Apr 24, 2021 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.