3
\$\begingroup\$

Yesterday I asked a question here asking for help on inverting an input voltage (0-VCC V) around a fixed voltage. For my case, I had a 5V DC source and the fixed voltage is supposed to be 2.5V, therefore the circuit is supposed to take an input voltage, e.g. X, and output 5-X V.

I’ve received a lot of answers, but the one that I found the simplest was a Current Mirror circuit. I am familiar with these types of circuits on their own, but I don’t understand how it can output the 5-X V I need.

Circuit

From @td127 that answered: “It's a current mirror where the input current flows through R4 and Q1 and is duplicated in R5 and Q2 which provides an output inverted with respect to input.”

I am quite familiar with basic electronics knowledge, but I just can’t figure it out. How would I go about understanding it?

\$\endgroup\$
12
  • \$\begingroup\$ "the one that I found the simplest". Yes, but hardly accurate. Without feedback, the output voltage will be inaccurate and will vary with temperature and depend on the actual transistors you happen to pick. Can your application handle that? \$\endgroup\$ Commented yesterday
  • \$\begingroup\$ For matched transistors in a single case, the variation with temperature will be small, and the difference is not significant between different small BJTs. \$\endgroup\$ Commented yesterday
  • 1
    \$\begingroup\$ R4 converts the input voltage into Q1 current (Ic1 = (Vatten - Vbe)/R4 ). And R5 does the opposite thing. R5 converts the Q2 current into voltage. Vout = Vcc - Ic2 * R5. So this is why the output voltage "drops" when the input voltage rises. \$\endgroup\$
    – G36
    Commented yesterday
  • 1
    \$\begingroup\$ Good! Good! But you also have to bond the two transistors together so they share the same temperature. Or, better yet, you can follow my suggestion of adding two 100 Ohm resistors in series with the emitters and then you don't have to match the two transistors. \$\endgroup\$ Commented yesterday
  • 1
    \$\begingroup\$ @DavideAndrea There are matched-pair BJTs cheaply available. I've used a BCM857 for this before, more than once. I think it might even be monolithic, but it's definitely in a single package. \$\endgroup\$
    – Hearth
    Commented 21 hours ago

2 Answers 2

5
\$\begingroup\$

If you have two perfectly matched transistors, having the same \$V_{BE}\$, they will pass the same collector current, below left:

schematic

simulate this circuit – Schematic created using CircuitLab

On the right, I ask the left transistor to bias itself, by connecting base directly to collector, in a so-called "diode connected transistor" arrangement, and instead of having that transistor decide its collector current, I tell it explicitly what that current should be. It still mirrors quite well, collector current in Q4 is nearly the same, but sadly that path collector-to-base connection is diverting a small fraction of Q3's collector current, upsetting the balance somewhat.

Therefore, while you may be tempted to use this arrangement, you should be aware that it is far from ideal, it requires you to find two very similar transistors, and temperature difference between them will further upset that already-imperfect balance. On top of that, you have the Early effect to consider, which will slightly alter transistor current gain as Q4 collector potential changes. Q3's collector is fixed at around +0.6V or +0.7V (depending on current), but Q4's collector can rise and fall between +5V and +0.1V or so, another imbalance that ruins precision.

You can mitigate the Early effect with another transistor to permit Q3 to maintain its collector near zero also, and by changing which one self-biases, in a "wilson current mirror" design:

schematic

simulate this circuit

This improves accuracy, but Q5 is another matching transistor to find, and keep at the same temperature as the others, and now you can't get less than +0.7V at the "output", Q5's collector.

Going back to the regular mirror, we can do some algebra to derive equations to describe approximate behaviour:

schematic

simulate this circuit

Diode-connected Q1 maintains a (roughly) fixed \$V_X\approx +0.6{\rm V}\$, so we can use this fact, together with Ohm's law to determine current \$I\$:

$$ \begin{aligned} I &= \frac{V_{IN}-V_X}{R_1} \\ \\ &= \frac{2{\rm V} - 0.6{\rm V}}{10{\rm k\Omega}} \\ \\ &\approx 140{\rm \mu A} \end{aligned} $$

This current is mirrored on the other side, but this time it has to pass via R2, which will develop a voltage \$V_{R2}\$ across it. The top end of R2 is fixed at +5V, so node Y (bottom end of R2) potential \$V_Y\$ must fall from +5V as \$I\$ increases from zero:

$$ \begin{aligned} V_{R2} &= IR_2 \\ \\ V_Y &= (+5{\rm V}) - V_{R2} \\ \\ &= (+5{\rm V}) - IR_2 \\ \\ &= (+5{\rm V}) - (140{\rm \mu A} \times 20{\rm k\Omega}) \\ \\ &= +2.2{\rm V} \end{aligned} $$

That's where the "five minus something" comes from. We already have an expression for current \$I\$, so let's plug that in, to obtain an approximate relationship between input \$V_{IN}\$ and output \$V_Y\$:

$$ \begin{aligned} V_Y &\approx (+5{\rm V}) - \left( V_{IN}-0.6{\rm V} \right) \frac{R_2}{R_1} \\ \\ \end{aligned} $$

In your original schematic, R1, R2 and R3 are used to remove that pesky +0.6V offset from this equation. They are kept deliberately small compared to R4, so that current drawn via R4 ("master control current") does not significantly load (and alter) what I have called \$V_{IN}\$ in my schematic.

It is approximate as I mentioned, very slightly non-linear, and will depend on temperature and transistor gain and matching. If you require better precision, then this is certainly not the way to go. For best precision you require negative feedback, probably using an op-amp, though you could still obtain good results using discrete transistors.


The ratio \$-\frac{R_2}{R_1}\$ in my equation above is effectively gain. In your own circuit this gain is:

$$ -\frac{R_5}{R_4} = \frac{139k}{100k}=-1.39$$

It is necessary to "undo" the attenuation due to the input conditioning:

schematic

simulate this circuit

I used Thevenin's theorem to produce the equivalent on the right. Gain of this prior stage is:

$$ \frac{\Delta V_{ATTEN}}{\Delta V_{IN}} = \frac{2.6k}{1k + 2.6k} = \frac {1}{1.39} $$

The gain of the two stages together is

$$ \frac{1}{1.39} \times -1.39 = -1 $$


To put this into the context of your other question, the following (which is effectively this answer from that other question) produces much better results:

schematic

simulate this circuit

enter image description here

This design uses negative feedback in a closed loop around an extremely high gain op-amp, having several huge benefits:

  1. Gain is exactly \$-\frac{R_2}{R_1}=-1\$, not approximate. The relationship is exactly \$V_{OUT}=5-V_{IN}\$, or rather, it's as exact as your 5V supply and the various resistors.

  2. Output impedance is near zero, and output will stay rock solid under (reasonable) load. Your current mirror circuit has output impedance of 139kΩ, causing potential to change under even the slightest load. This output would probably need a buffer anyway, ironically an op-amp configured as a voltage follower.

  3. Input impedance is 100kΩ, a far less demanding load than the 3.6kΩ presented by the input resistors of the current mirror solution.

  4. The offset of 0.6V is not an issue here.

  5. Temperature dependence is gone.

  6. Transistor matching is not necessary.

\$\endgroup\$
3
  • \$\begingroup\$ Thank you for this thorough explanation. I do have one last question, why does R5 need to be much bigger than R4 for this to function “properly”. The formula is approximately Vy = 5V - Vin*(R2/R1), as you stated, however, in my simulated circuit, when I set R5 equal to R4, I get the minimum output of 1.43V with the input being 5V. What is the cause of that? \$\endgroup\$
    – Victor Ban
    Commented 17 hours ago
  • \$\begingroup\$ @VictorBan I have added a section addressing this, because it's not easy to explain in a comment (as I tried), and also a section comparing this design with one of the other designs from your other question. \$\endgroup\$ Commented 13 hours ago
  • \$\begingroup\$ Thank you, this makes perfect sense, I now understand the circuit clearly! \$\endgroup\$
    – Victor Ban
    Commented 12 hours ago
4
\$\begingroup\$

How would I go about understanding it?

For matched transistors, their collector currents will be identical if the base-emitter voltages are the same, since BJT's are fundamentally voltage-controlled devices (even though we often think of them as current-controlled).
In a current mirror, Q1 generates a base-emitter voltage as determined by its collector current.
Since this base-emitter voltage is also seen by Q2, then Q2's collector current is the same as Q1's, (but modified some by the finite collector-emitter resistance at its collector current and voltage).

Below is an LTspice sim showing the variation in Q2's current (green trace) with collector voltage from 0V to 5V (yellow trace) for a 1mA input current.
Note that the variation is small once Q2's collector voltage is above about 200mV.

For best matching, use a matched transistor pair in one package, such as the DMMT3904W.

Make sense? enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ Thank you for this clear explanation, I think I almost understand it now. One question, in the circuit I attached, what’s the role of R4 and R5, and why should R5 be bigger than R4 for the circuit to function properly? I don’t understand how the person who answered got those values for the resistors. \$\endgroup\$
    – Victor Ban
    Commented yesterday
  • \$\begingroup\$ R4 helps determine the mirror input current, and R5 is the load resistor which generates the output voltage. Their values are selected, along with the values of R1, R2, and R3, to generate a signal current (which is somewhat arbitrary) to give the desired output voltage for the signal input voltage range. If you look at all the resistor voltages and currents in the simulation, you should get a better understanding of that. (Do you know how to observe both voltages and currents?) \$\endgroup\$ Commented yesterday
  • \$\begingroup\$ Yes I do, thank you. I will have to take the analysis of the circuit further by examining it part by part, but I think I mostly get the overall functionality of it now. \$\endgroup\$
    – Victor Ban
    Commented yesterday

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.