How to measure 4-20 mA current in Arduino uno

Hi,

I = V / Rtot
I = 24 / ( 6000 + 250 ) = 38.4mA

I = 24 / ( 1200 + 250 ) = 16.5mA

Tom... :grinning: :+1: :coffee: :australia:

The fixed resistor for 20 mA (1200-250 = 950 Ohms) should be in series with a variable resistor (6000 - 250 - 950 = 4800 Ohms) to get a range from 20 mA to 4 mA from a 24-volt source into a 250 Ohm load.

Thanks sir,
Can you tell me 910 ohm is required to safe arduino from 24 vdc. And please tell me change in code? How to calculate current by code?

As stated many times on this forum, a 250 ohm sense resistor and default Aref is a poor way of measuring 4-20mA.
Using a 51 ohm resistor (standard 1% E24 value) and 1.1volt Aref is a much more stable approach, and... you get the extra over-voltage protection.

There are many examples on this site if you just enter 4-20 in the search field on top of this page.
Leo..

Note that the 1.1V bandgap voltage reference is only 10% accurate. It can be anywhere from 1.0V to 1.2V. To get accurate values you must measure the reference voltage on your chip.

Note that the 5volt supply is also not accurate,
and on top of that unstable, which 1.1volt Aref is not.
So both choices must be calibrated anyway.
Leo..

Hi,

I totally agree, you will need to do calibration runs to fine tune the conversion.
1V1 Ref would be the best in this situation.
Which is why I asked if @sumit110 has a DMM>

Tom... :grinning: :+1: :coffee: :australia:

Dears,

actually i am making 4-20 mA reader by using Arduino Uno which giving me approx. reading but not accurate; there is small error between 4-20 mA source reading and Arduino reading on display, Please refer the attached code & circuit for reference.
Can you suggest me how can i get accurate reading equal to source reading? Please suggest me if any correction is required in code or circuit.
and also one more fault, the measure value is continuously fluctuating in digit after the decimal point (not stable) but source reading is stable. and i already checked source is correct and calibrated; how can i fix this issue.

CODE:-

#include <LiquidCrystal.h>
float Vacross0,Iamp0 = 0;
const int Shunt_Res0 = 250;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
lcd.begin(16, 2);
}

void loop() {
Vacross0 = analogRead(A0);

Vacross0 = (Vacross0 * 5.0) / 1023.0;
Iamp0 = (Vacross0 * 1000) / Shunt_Res0;

lcd.setCursor(0, 0);
lcd.print("A0=");
lcd.print(Iamp0);
lcd.print("mA");
delay(500);

}

Hi,
Try this ;

Iamp0 = (Vacross0 * 1000.0) / (float)Shunt_Res0;

Can you show how you mean "decimal digit"?
If it is the least significant digit, then that can be expected due to the ADC resolution.
The error could be due to the accuracy of the 250R shunt resistor.
What is the tolerance of your 250R? It should be in the colour code or written on it.

You may have to introduce a CAL FACTOR to your reading to get them to agree.

Can you please post a table of measured readings in the loop and UNO readings?

Thanks.. Tom.... :smiley: :+1: :coffee: :australia:

Arduino is showing correct numbers, read again post #19, also look at
https://forum.arduino.cc/t/4-20ma-pressure-sensor-keeps-reading-75psi-output/869779/20

google - precision potentiometer

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.