Detect all interruptions in function of voltage

Hello,

I'm really upset, so I'm coming to ask for your help.
I must be able to detect pulses of electric current (very fast). This electric current varies between 20mA and 70mA. It passes through a 100 ohm resistor. At 50mA, I have a voltage of 5V. Interrupts work well. However at 20mA (2V), 30mA (3V), the interrupts do not work.

Do you have any idea how I could go about it?
I had thought of a resistor and a capacitor but I can't do it.

Have a good day

An NPN transistor and a 1K base resistor. The interrupt should be triggered on the falling edge. Look up "low side switch"

What is "very fast"? How the pulse looks like? 0mA, quickly go up to 20-70mA and after this drops back to 0mA?

@6v6gt : It can be a good idea to use a transistor. Why 1kohms resistor ? Why this value ?

@Smajdalf : Yes very fast, 0.2us

"very fast" could mean anything from milliseconds to picoseconds, use numbers/units, not adjectives,
unless writing poetry!!

So 200ns pulses, which means a "very fast" comparator would be needed :slight_smile:

To detect voltages passing a limit point you use a comparator.

Anyway before going further just tell us what you are trying to do, this could be an xyproblem...

melectron:
@6v6gt : It can be a good idea to use a transistor. Why 1kohms resistor ? Why this value ?

@Smajdalf : Yes very fast, 0.2us

200 nano seconds ? Please describe what generates that pulse which apparently you can, under some circumstances, read with an Arduino?

The 1k is a base resistor ans its purpose is to limit the current to a few milliamps. Its value is not that critical and can be anything from 200R to 10k.

Use the circuit on the left. R is base resistor mentioned above and the resistor marked load is the Arduino pin pull-up resistor.

EDIT: crossed with @Mark.

200nS is just over 3 clock cycles of 16 MHz system clock, that is long enough for an interrupt to be caught.
See section 17 of the datasheet.

The External Interrupt 0 is activated by the external pin INT0 if the SREG I-flag and the corresponding
interrupt mask are set. The level and edges on the external INT0 pin that activate the interrupt are defined
in table below. The value on the INT0 pin is sampled before detecting edges. If edge or toggle interrupt is
selected, pulses that last longer than one clock period will generate an interrupt. Shorter pulses are not
guaranteed to generate an interrupt. If low level interrupt is selected, the low level must be held until the
completion of the currently executing instruction to generate an interrupt.

The External Interrupt 1 is activated by the external pin INT1 if the SREG I-flag and the corresponding
interrupt mask are set. The level and edges on the external INT1 pin that activate the interrupt are defined
in the table below. The value on the INT1 pin is sampled before detecting edges. If edge or toggle
interrupt is selected, pulses that last longer than one clock period will generate an interrupt. Shorter
pulses are not guaranteed to generate an interrupt. If low level interrupt is selected, the low level must be
held until the completion of the currently executing instruction to generate an interrupt.

MarkT:
Anyway before going further just tell us what you are trying to do, this could be an XY problem...

Could be?

Thank you for your answers. These are pulses of current that flow between two electrodes. To measure this current, I pass it through a resistor.
So the best is to pass the current through the resistance of the base of my transistor, is that it?

You haven't said enough about what you are doing to get a concrete answer. But, in principle, you have already said in the OP that the pulse you are creating can trigger an interrupt at 5volts so the transistor solution should work for pulses of a lower voltage, but which retain the same period.

200 nano seconds is the period of a 5MHz signal. Maybe a transistor like this: PMBT2369