How to Build a Current Sensor Circuit

A current sensor circuit is a circuit that can sense current going through it. If the current reaches
a certain threshold, then an indicator, such as an LED, will turn on.

This is not an ammeter circuit, where we know or are measuring the amount of current going through.
That's a different thing entirely.

This is a current sensor circuit, where if we get to a certain level of current, then the output will turn on.

And we can build a current sensor circuit, simply by exploiting ohm's law.

Ohm's law states that, I= V/R, where I is the current, V is the voltage, and R is the resistance.

Say, we want to detect 5mA of current. We want 10mA to be the threshold. Any current 10mA or higher
will trigger on the output of the circuit. So, we choose a resistor value of, say, 1KΩ. Now, rearranging ohm's law,
V=IR, which means that V= (5mA)(1KΩ)= 5V.

So if you're a 1KΩ resistor in our circuit and it reaches a voltage of 10V, then we know, based on ohm's law,
there is 10mA of current flowing through the resistor in the circuit. By monitoring the voltage, we can monitor the current
because voltage has a direct relationship with current (V=IR). Therefore, to measure current, all we have to do is measure
voltage.

So when we have our output voltage, we can know the current.

So, back to the circuit, we know that if the voltage is 10V, then this means that 10mA is flowing through it.

So we take this voltage and input it into a voltage comparator chip. If the voltage comparator detects
10V or higher, then we know that the current is 10mA or higher.

And this is how we can built a current sensor circuit with a voltage comparator chip. You can
calculate any current threshold you want based on ohm's law formula and obtain the voltage that will produced with the
current threshold you want.

Components

LM741

1KΩ resistor

470Ω resistor

LED

You can really use any voltage comparator chip that you have.

In this circuit, we will use the general LM741 operational amplifier to act and function as a voltage
comparator.

The LM741 is an 8-pin chip.

If you would like to understand all the pin connections of the LM741 op amp, see
LM741 Op Amp- Pinout Connections. This article explains all of the 8 pins of the
LM741 and what each one does.

The LM741 pinout is shown below.

How this chip functions a voltage comparator and how all voltage comparators work is we feed 2 voltage
signals into each of the inputs of the op amp. An op amp has 2 inputs, the + input, or the noinverting input and the
- input, or the inverting input.

If the voltage at the noninverting terminal is greater than at the inverting terminal, then the output
will go HIGH to the voltage supplied at VCC of the chip.

If the voltage at the noninverting terminal is less, then the output will be LOW or at the level of
V-.

Pin 1 is a NC (Not Connect) and pins 1 and 5 are offset nulls, which we don't connect for this circuit.

Now to power the circuit, we connect V+, pin 7, to 10V and V-, pin 4, to ground. This establishes power
to the LM741 chip.

Next, we have the 2 inputs of the op amp of the Lm741.

We connect our reference voltage to the inverting terminal, which is pin 2. Since we want 10mA of current to
be the threshold current that we want to detect and we're using a 1KΩ resistor, this means that our reference voltage
will be 10V (V= IR= (10mA)(1KΩ)=10V).Thus, our reference voltage to detect for 10mA or higher is 10V. So we connect
10V to pin 3, the inverting terminal.

To the noninverting terminal, we connect a 1KΩ resistor and our current signal that we want to test to check
if it reaches or is above the threshold current.

And, lastly, to the output pin of the LM741, which is pin 5, we connect our output which in this case
is an LED along with a 470Ω current-limiting resistor so that the LED doesn't blow out.

This completes all the connections for our circuit.

How the Circuit Works

So, we have our reference voltage of 10V.

If the current being input into the noninverting terminal of the op amp is less than 10mA, the voltage at the
inverting terminal will be less than 10V. This is because the resistor we are using is a 1KΩ resistor. Doing the math
of ohm's law shows that, 9mA, for instance will produce a voltage of, V=IR= (9mA)(1KΩ)=9V.

As long as the voltage at the noninverting terminal is less than at the inverting terminal, the output
of the LM741 will be LOW. Therefore, the LED will not light up.

The voltage the noninverting terminal must be greater than the voltage at the inverting terminal for the
LED to light up. Since the voltage at the inverting terminal is 10V, the voltage at the noninverting terminal must be
greater than 10V. This only happens when the current being fed into the inverting terminal is greater than 10mA. For
instance, if it's 10.5mA, this produce a voltage of, V=IR= (10.5mA)(1KΩ)= 10.5V. So, in this instance, the voltage at
the inverting terminal is greater, and the output will go HIGH, so the LED will turn on.

And this is how a current sensor can detect any level of current input.

When designing a current sensor, you can set any threshold current level that you want. Once you know
the desired current that you want, then you just have to decide on the resistor value. And then from that, you can
calculate the voltage.

when deciding on the value of the resistor that you're going to use, you have to consider the other parameters of
current and voltage. You cannot choose a resistor value that is too low or too high. There has to be somewhat carefully
chosen. For example, if you chose a resistor value of 100KΩ and you want a current threshold of 10mA, this would be bad
choice, because in order to get 10mA with a 100KΩ resistor, you would have to use 1000V. Where you would get 1000V from?
It wouldn't work. And even if you got 1000V, you wouldn't be able to incorporate it into a voltage comparator chip, because
it can only handle about 20V or so, definitely not 1000V. Therefore, you have to use a much lower
resistor value so that you can use a voltage that isn't ridiculous. Same thing for using a resistor value that is too low.
If you use a 10Ω resistor and you want 10mA of current, this would need a voltage of, V=IR= (10mA)(10Ω) 0.1V. This is
too small for a voltage comparator to work with. You want to have a more spaced out voltage than using tenths of a volt,
which is difficult to manage. So carefully considering voltage and current needs dictates the resistor value that is appropriate
for the circuit. You don't always have to use the 1KΩ resistor that is used in this circuit, but you do
have to consider current and voltage needs.

And you can also do variations to this circuit. If you don't just want a single fixed current threshold, you can
place a potentiometer in between either noninverting terminal or the inverting terminal. This will allow you vary threshold levels.
The potentiometer you choose should be within a resistance range that fits in well with your voltage and current requirements.