Arduino UnoR3 4-20ma Reader (industrial Instrumentation)

by wierzbickimc in Circuits > Arduino

45 Views, 0 Favorites, 0 Comments

Arduino UnoR3 4-20ma Reader (industrial Instrumentation)

IMG_6497.jpeg
4-20mA loop arduino_bb jpg.png
4-20mA loop arduino_bb jpg.png

This project converts industrial 4-20ma instrumentation signals to something an Arduino can measure by way of a 250 ohm resistor.

The 250 ohm resistor value is calculated using Ohms law for converting the 20mA signal to a 5V signal. The following link will allow you to modify the values to match your project. Note - this approach misses the internal resistance of the battery, so an empirically derived bias factor will need to be coded in.

https://www.calculator.net/ohms-law-calculator.html?v=5&vunit=volt&c=20&cunit=milliampere&r=&runit=ohm&p=&punit=watt&x=Calculate


Please see my other projects to incorporate a datalogging SD card and eventually switching to a NANO BLE for remote viewing.

Supplies

Arduino Uno R3

One Bauer 20V power tool battery

One Power Wheel DIY adapter for Bauer 20V Battery dock power connector

One 250 ohm metal film resistor with 1% tolerance (or better)

2 in 4 out Quick Wire Connector

Industrial Instrument (such as Siemens SISTRANS P320)

Wires

Independent USB power source

Wiring It Up

IMG_6492.jpeg

Ensure the 20V battery adapter switch is in the off state

Ensure the 20V battery adapter fuse holder has a fuse

Connect a wire from the battery adapter positive to Industrial Instrument (+) terminal

Connect a wire from the Industrial Instrument (-) to the positive section on the 2 to 4 connector

Insert the resistor into the 2 side of the 2 to 4

Connect a wire from the positive side of the 2 to 4 connector to the Arduino A0 (or whatever was specified in your code)

Connect the 2 to 4 negative to theArduino GND


Note - It seems not possible to use the loop current power supply to also power the Arduino, the varying power draw seems to influence the loop reading and mess with the system precision. I'm sure a more clever EE could figure out of to work around this with an optoisolator thing, but for now I have a separate power source for the Arduino itself. Additionally, because the Arduino grounds are all connected, grounding the 9V battery to the arduino ground/ using Vin causes signal crosstalk. It seems the USB and possible the barrel jack are required for the second power source.

Code

Note: this is very obviously modified from the example arduino light detection code.

1024 refers to how many increments the analog input is split (10 bit = 1024).


int LED = 9;
float LDR = A1;
float V = 0;
float SPAN = 0;
float Current = 0;
void setup()
{
Serial.begin(9600);
pinMode(LED, OUTPUT);
pinMode(LDR, INPUT);
}
void loop() {
float LDRValue = analogRead(LDR);
//Serial.print("LDR = ");

//Serial.print(LDRValue);



V = LDRValue /1024 *5 ;
Current = V * 4;
Serial.print(V);
Serial.print(" ");
Serial.print("A = ");
Serial.println(Current);


delay(1000);
}

Downloads

Adding a Bias

At this point you should get a pretty close mA reading from the device, however it will be skewed because the battery has an internal resistance (about 0.01 mA from the tests I've done. You can add this bias into the code if you so desire.