That seems to be working fine on your sim. I've set up the parts values for a "stall" indicator for small DC motors, and the circuit has been used successfully for that in a few situations (like automatic end travel detection). That's why it has such a large filter cap (22uF). That will ignore small load peaks and start current etc for small motors, but when the motor gets a sustained stall it will definitely trigger a PIC digital input.
Even with the 22uF cap, if you compare the output of my circuit to the comparator circuit, you see when the B graph gets below about 1.6v the PIC schmidt digital input will switch (at about the same point your comparator does) likewise when the green chart rises to about 3.2v the PIC schmidt digital input will switch back, again giving about the same result as the comparator.
My circuit does work, and does work well. The pot sets the stall current to be detected, and the largish cap selects the time that the overcurrent period needs to be in effect to produce an output.
If you reduce the cap from 22uF to a smaller value and imagine it is connected to a PIC schmidt trigger digital input it will perform very much like your comparator circuit (apart from the obvious hysteresis). Remember this is for a "over current fault" detector use, not for fine current control as such.
Which is why I suggested it as the OP said he wanted "to stop the motor if current reached 100mA". That's the kind of task it does best.
(edit) I just realised you have biased the transistor too hard also. You should set the trimpot so the transistor is definitely off, then the sensed current needs to rise past a certain point before the transistor even starts to conduct (starts ramping on), then once it starts ramping the schmidt input takes care of the actual current detect threshold.
Even with the 22uF cap, if you compare the output of my circuit to the comparator circuit, you see when the B graph gets below about 1.6v the PIC schmidt digital input will switch (at about the same point your comparator does) likewise when the green chart rises to about 3.2v the PIC schmidt digital input will switch back, again giving about the same result as the comparator.
My circuit does work, and does work well. The pot sets the stall current to be detected, and the largish cap selects the time that the overcurrent period needs to be in effect to produce an output.
If you reduce the cap from 22uF to a smaller value and imagine it is connected to a PIC schmidt trigger digital input it will perform very much like your comparator circuit (apart from the obvious hysteresis). Remember this is for a "over current fault" detector use, not for fine current control as such.
Which is why I suggested it as the OP said he wanted "to stop the motor if current reached 100mA". That's the kind of task it does best.
(edit) I just realised you have biased the transistor too hard also. You should set the trimpot so the transistor is definitely off, then the sensed current needs to rise past a certain point before the transistor even starts to conduct (starts ramping on), then once it starts ramping the schmidt input takes care of the actual current detect threshold.
Last edited: