I wanted to know if I'm correctly thinking.
The idea for current limiting is to force the opamp to output the correct voltage to control the MOSFET. So the maximum voltage possible is somewhere around 12v.
The idea is to have a negative feedback to a certain voltage and have a positive feedback before a sense resistor.
For example in the following example, I wanted to current limit the load at 3A with a resistor of 0.1 Ohm.
At 3A, the voltage dropped by the sense resistor should be 0.3v. With that in mind, we can then compute the voltage divider for the positive feedback.
If R1 is 100K and we want to get 0.3v at the positive input then we have to drop 11.7V through R1. Which will let 0.000117A through R1. With that in mind we can compute R2 with:
V = IR
0.3V = 0.000117A * R
2564 Ohm
With that, no matter which load will be present, the sensed voltage in the positive feedback will never be higher than the one at the negative feedback. Which in return limit the current.
Also, R2 could be a potentiometer to regulate the current limit or the whole voltage divider could be replaced by PWM input.
One last thing, In my simulation it kind of work and I guess I could probably build it to try it out but there is one thing I'm still unsure. For some reasons, I tried to reverse the feedback +/- and it still work. For that reason, I'm not sure if polarity of the opamp actually matter or it is really dependent on the op-amp spec.
From what I understand, op-amp are trying to make both input equal by changing its output. In this case, only the positive input is driven by the opamp while the negative input is fixed. But I guess my assumption here is wrong and the order actually matters.
simulate this circuit – Schematic created using CircuitLab