# How do I calculate the resistor R2 in this current limiter? How can I calculate the resistor R2 of the above circuit?

I know how to calculate R2 to control the base of Q2 but I don't know what I have to do to take into account the current from the collector of Q1.

I must keep the current consumption low.

Since you already understand how to set $$\R_1\$$, I'll give that less attention. The question you are asking is about how to set the value of $$\R_2\$$ and therefore by implication the value of $$\I_{R_2}\$$. The value of $$\I_{R_2}\$$ is the key, because you already know the voltage at the base of $$\Q_2\$$ ($$\V_x= 3.3\:\text{V}-V_{\text{BE}_1}-V_{\text{BE}_2}\$$.) simulate this circuit – Schematic created using CircuitLab

The value of $$\I_{R_2}\$$ must not only include all of the needed recombination current for $$\Q_2\$$ (which will be approximately $$\I_{B_2}=\frac{I_\text{LOAD}}{\beta_2}\$$) but it must also include the collector current $$\I_{C_1}\$$. Since it isn't hard to work out $$\I_{B_2}\$$, the question has now been transformed into figuring out what $$\I_{C_1}\$$ is (or should be.) In a sense, we've just swept the problem to a new place. But we still don't have an answer quite yet.

You could just assume that $$\0\:\text{A}\le I_{C_1}\le I_{B_2}\$$ and set $$\R_2=\frac{3.3\:\text{V}-V_{\text{BE}_1}-V_{\text{BE}_2}}{I_{B_2}}\$$, where the value of $$\I_{B_2}\$$ used in that equation depends on the worst case expectation of $$\\beta_2\$$ and just let $$\Q_1\$$ "worry" about the details. This works and many people will think no further about it.

The design isn't much affected by the Early Effect, so that can also be neglected.

But the circuit's behavior does depend upon the ability of $$\Q_1\$$ to "measure" the load current. It does this measurement by "observing" the voltage across $$\R_1\$$ (where $$\V_{R_1}=R_1\cdot\left(I_\text{LOAD}-I_{B_1}+I_{B_2}\right)\$$) and comparing that voltage to its own $$\V_{\text{BE}_1}\$$. But its $$\V_{\text{BE}_1}\$$ depends on its collector current. If its collector current is allowed to vary widely (BJT variation, temperature, etc.) from circuit to circuit, then to that degree the load current is not as well managed by the design as it might be.

You can't do much about part variations in $$\V_\text{BE}\$$. They simply will exist and you have to accept those variations here. But there is also a $$\60\:\text{mV}\$$ change in $$\V_{\text{BE}_1}\$$ for each 10X change in the collector current of $$\Q_1\$$. And you can do something about that. So, it improves things (from the perspective of consistency) to diminish collector current variations in $$\Q_1\$$.

This is achieved by having $$\R_2\$$ supply still more current than is strictly required by the worst case estimates of the base recombination current of $$\Q_2\$$. How much more is a matter of judgment. But I'd recommend that it should be at least twice and perhaps three times as much as you'd otherwise estimate. Even more might be better, but the rate of return on further increases gradually gets more and more into subjective arguments. So just pick your factor, do some testing to validate your choice, document the results, and move on.

For example, you might choose:

$$R_2=\frac{3.3\:\text{V}-V_{\text{BE}_1}-V_{\text{BE}_2}}{k\cdot\frac{I_\text{LOAD}}{\beta_{2_\text{MIN}}}}$$

Using $$\k=2\$$ in order to help minimize the collector current variations in $$\Q_1\$$.

Whatever you do decide, whether you use $$\k=1\$$ or $$\k=2\$$ (or some other value), make sure that you test it with different BJTs (same family, or across a variety of likely family choices) and document your final selection with the experimental results you get. Or do so by using Spice with varying BJT parameters and resistor value variations to bound the likely behavior. (If this is just for hobby use, pick something and go with it. If for educational use in school, do what you think the teacher wants from you.)

This is a secondary effect. Keep that in mind. It's only crucial that $$\k\ge 1\$$. But $$\k=1\$$ will work. It's just that using a larger value of $$\k\$$ tosses away some excess current in exchange for a modest improvement in repeatable performance, one build to another.

R2 has to provide enough current to turn the transistor Q2 on sufficiently under worst-case conditions (low supply voltage, low temperature, minimum guaranteed hFE). So you can calculate that.

In non-homework problem you might consider using a p-channel MOSFET for Q2 but retaining the BJT for Q1.

I know how to calculate R2 to control the base of Q2 but i don't know what i have to do to take into account the current from the collector of Q1

Calculate R2 as if Q1 wasn't present then, when the current through R1 starts to turn on Q1, you get Q2 starting to be turned off by Q1. This is the start of the current limit process. I would also put a 1 kohm resistor in series with the base of Q1 BTW.