4

I have a 4-20mA signal and want to feed it to my uC. I found this circuit but dont know how it works. can any one explain this for me? enter image description here

or suggest a better solution

reza moslemi
  • 65
  • 1
  • 6

3 Answers3

4

This circuit is wrong. It's intended to be a differential amplifier using a current sense resistor, but the op amp is drawn with positive feedback instead of negative. Swap the inverting and noninverting inputs if you want it to work.

Hearth
  • 27,177
  • 3
  • 51
  • 115
  • so V signal is always 0! isn't it? – reza moslemi Apr 07 '20 at 11:59
  • @rezamoslemi As drawn, the signal voltage will always be at one of the rails, either ground or VCC. If you swap the two, you then have a differential amplifier, and the resistances you choose will determine the magnitude of the output. The one drawn here will have an output equal to the voltage across the sense resistors, but you can change the other resistors to set different gains. – Hearth Apr 07 '20 at 12:23
  • Why shouldn't this be a digital receiver? – CL. Apr 07 '20 at 12:26
  • 1
    @CL. Because 4-20 mA signalling is an analog standard. And even if you wanted to use it as a comparator, as drawn, it gives a high output for any positive input current, and negative input current (indeed, any current less than 4 milliamps) is an invalid state in a 4-20 mA current loop. – Hearth Apr 07 '20 at 12:29
4

This doesn't answer what you are asking but may solve the problem.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. A current to voltage converter - also known as a resistor - will provide the conversion from 4 - 20 mA to voltage.

VADC = IINR = 165 IIN.

Note that this circuit provides no overload protection.


Response to comment:

With a "proper" conditioning circuit for your 4 - 20 mA signal you could get 4 mA to input 0 V to your ADC and 20 mA to input 3.3 V to your ADC. If you had a 10-bit ADC you have a resolution of 210 = 1024 bits and I bit gives you a resolution of \$ \frac {20 - 4} {1024} = 15.6 \ \mu\text {A/bit} \$.

With the simple resistor circuit 4 mA is input as 0.606 V and the lowest count you will see is 1024 / 5 = 205. This means that your ADC reading will go from 205 to 1023, a range of 819 counts which may be more than enough for your application.

You can scale the result in your μC and remove the offset. So if you wanted 4 to 20 mA to give a percentage you would calculate \$ Out = \frac {In - 205}{819} 100 \$.

Note that one of the advantages of 4 - 20 mA is that you can detect an open-circuit. If the current falls to zero then you know there is a fault or wire-break. (That's called a "live-zero" system.) Without it you don't know. Some systems use 3 mA to indicate, for example, a calibration issue with the sensor. You will lose 20% resolution with this approach but its simplicity may persuade you.

Transistor
  • 168,990
  • 12
  • 186
  • 385
  • This does not explain how the above circuit works. – scorpdaddy Apr 07 '20 at 15:00
  • Read the first line of my answer again. Sometimes you have to get past the OP's question to try to figure out the real problem they're trying to solve. Often they've found a "solution" and come here to ask us to help them get it to work when it's not the appropriate technique for the problem. I've got it right several times in the past. Let's see what the OP thinks. – Transistor Apr 07 '20 at 16:06
  • 1
    The title specifically calls out that the minimum of the output range should be zero, so no, this is not a solution. – Reinderien Apr 07 '20 at 16:48
  • All of you are right. that was my fault to explain my question. Actually I have a 4-20 mA signal and want to convert it to a voltage range that is in 0-3.3V Range to be processed by uC. – reza moslemi Apr 08 '20 at 07:20
  • You can scale the result in your uC and remove the offset. Note that one of the advantages of 4 - 20 mA is that you can detect an open-circuit. If the current falls to zero then you know there is a fault or wire-break. (That's called a "live-zero" system.) Without it you don't know. Some systems use 3 mA to indicate, for example, a calibration issue with the sensor. You will lose 20% resolution with this approach but its simplicity may persuade you. – Transistor Apr 08 '20 at 07:28
  • @Transistor "You will lose 20% resolution with this approach" ==>>why? – reza moslemi Apr 08 '20 at 08:10
  • See the update. – Transistor Apr 08 '20 at 08:22
  • 1
    @reza: It will be like buying a 0 - 20 mA milliammeter to read a 4 - 20 mA signal. The bottom 4 mA (20%) of the scale will be "wasted" as the signal should never be in that region. The meter would be easier to read accurately if the scale went from 4 to 20 mA. Usually this won't matter. If you need precision it might. – Transistor Apr 08 '20 at 09:24
1

The correct answer to your problem depends on a lot of things, including needed accuracy, the impedance of the previous stage and so on. The following solution is a loose approximation of something that could work:

schematic

simulate this circuit – Schematic created using CircuitLab

The resistors used are E24 (R2, R4) and E96 (R1), but for their center value the solution is exact. The design steps are basically:

  • Pick a resistance for R1. It must be equal to or less than 165 ohms so that the input does not clip. This will effectively convert the current to some voltage, but will not necessarily amplify it to the right voltage, nor will it subtract to account for the 4mA minimum. If you make it exactly 165 ohms, you can omit R3.
  • Add R2 and R4. These resistors are necessary to subtract from the output to account for the 4mA minimum. The needed ratio is

$$\frac {R2} {R4} = \frac {20mA} {4mA} - 1 $$

  • Somewhat arbitrarily choose 10k for R2, which means 2.5k for R4. These are both standard resistances.
  • If you do not choose 165 ohms for R1, then add R3. This is necessary to amplify the input. The expression to choose it is

$$ R1 \left( 1 + R4 \left( \frac 1 {R2} + \frac 1 {R3} \right) \right) = \frac {3.3V} {20mA - 4mA} $$

For an R1=165, R3 evaluates to infinity (open).

You will also want to put a capacitor across R4. Its capacitance depends on the resistances you choose and the desired frequency response of the circuit. It's also important to note that this disregards all of the non-ideal elements of an op-amp, assumes that it has no input offset, that it is rail-to-rail, etc.

Reinderien
  • 3,102
  • 16
  • 28
  • what is the advantage of using this circuit vs using a simple precise resistor like the circuit suggested by @Transistor. except the 20% precision loss? – reza moslemi Apr 11 '20 at 07:47
  • 1
    It's a trade-off. The single-resistor sacrifices range, would not be able to impedance-match if you need that eventually, and range correction in the uC would require calculation that maybe you don't have the microseconds - or the floating-point instructions - for. – Reinderien Apr 11 '20 at 13:43
  • On the other hand, this solution is more expensive and requires more analog analysis and complex circuitry. – Reinderien Apr 11 '20 at 13:43