0

I have a OsiSense™ XMLP pressure sensor that I want to read from my Arduino uno. This is the circuit I am looking at building for measure 4 to 20 milliamp.
Reading 4 to 20 milliamps using Arduino

I've read online to find out how to build the circuit. Can you tell me if it is correct?

Also I dont understand why it works and I'm hoping you can correct my thinking. Following ohms law we want to leave 5v when 20 milliamps goes through the circuit. We know the voltage on the circuit is a constant 24 volts (short cable runs) and we know the maximum current is 20 milliamps so my maths says :

Resistance = Voltage / I (current)

We need to leave 5 volts for the Arduino to read when the sensor is at maximum pressure so we subtract 5 from 24.

Resistance = 19 / 20 milliamp

So the resistor to select to give us a maximum of 5 volts is a 0.95 Kilohms resistor. I dont see where the 250 ohm resistor comes in? please help.

3

To read a current with the Arduino you first have to convert that current to a voltage - and you do that by passing it through a resistance. The voltage dropped across that resistance as the current changes is what interests you.

schematic

simulate this circuit – Schematic created using CircuitLab

For a 4-20mA current you need to choose a resistance that gives voltages that are within the 5V range that an Arduino can read.

The biggest voltage drop across the resistor will occur when the current is at maximum (20mA) so you can use that to calculate a good resistor value to use:

R = V/I = 5 / 0.02 = 250

And for the same resistance at minimum current:

V=IR = 0.004 × 250 = 1

So across the resistor you would get between 1V (4mA) and 5V (20mA).

250Ω resistors aren't that common, so a more common value would be used instead - such as the commonly available 220Ω. Substituting the 250Ω for a 220Ω would give voltages:

@20mA: V=IR = 0.02 × 220 = 4.4V
@4mA:  V=IR = 0.004 × 220 = 0.88V

Both comfortably within the Arduino's range and also gives a bit of wriggle room in case of any small over-current conditions.

It can also be good to protect the analog input of the Arduino with a resistor + zener diode to prevent damage in the case that the resistor fails / becomes disconnected and you get the full output voltage applied direct to the Arduino:

schematic

simulate this circuit

  • Thanks for getting back to me so quick. I'm still not understanding correctly. ill have another read tonight and let it sink in. As you can tell, im fairly new to this so maybe missing some basic understanding. – resolver101 Oct 10 '17 at 16:42
  • In the second circuit R2 is just there to limit the current through the zener in the case of an over vintage situation. R1 is the same as in the first circuit and takes 99.9999% of the current through it to create a voltage drop. – Majenko Oct 10 '17 at 16:44
  • @Majenko what is the leakage current of the 1N4733A at 5V ? When R1 got a loose leg, and 24V would be at R2, then a continuous voltage of 24V requires a resistor of 4W for R2. For basic protection making R2 10k and removing the zener will work as well. – Jot Oct 10 '17 at 21:56
  • You're fixated on 24V. Forget 24V. That is the maximum it could be when open circuit. It should never be more than 20mA, which is 40mW through a 100Ω resistor. – Majenko Oct 10 '17 at 22:20
  • Sorry, I forgot that the current is maximum 20mA. The leakage of the zener diode is probably too small to have any influence. Even more so when you set the 20mA to 4.4V. Sorry again. I get it now. – Jot Oct 11 '17 at 3:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.