[SOLVED]Help with industrial 4-20mA loop sensor

Hello!

I am having a problem with connecting balluff btl 7 micropulse linear sensor with arduino the sensor. The sensor is selpowered and it has external 24V power input.

When i measure position with 235 ohm resistor and voltmeter I get accurate readings (0,82 - 4,72 V). The problem lies when I try to connect arduino on it. Basically I get strange readings! For instance I get outputs from 0.35 to 2.08V.

I have connected the sensor 20-4mA output to A0, and 0V output to 235 ohm resistor, and I measure the voltage on the resistor. I have used the code from http://www.arduino.cc/en/Tutorial/ReadAnalogVoltage

I believe that the problem lies within ground? Arduino is powered via USB and it is on the same outlet as the sensor.

EDIT: Output voltages

Have you measured the voltage across the R with a meter when connected to the Arduino?

Weedpharma

I would first make a simple resistor divider to produce some voltage between 1 and 4 volts to make sure the analog input and program is working correctly. Then I would put the transmitter back into the circuit. My gut tells me you do have a ground reference issue. The which wall outlet they are plugged into means very little. I would get a 9VDC power supply for the arduino and then tie the grounds for the 9VDC and 24VDC together.

A 4-20mA transmitter is a simple device but stumps many people. The big picture circuit is 24VDC to the instrument, out of the instrument comes some semi-random voltage to produce the current necessary to drive the line loss resistance and the 250ohm precision resistor at the receiver plus the line loss resistance back to the device. The A/D needs to be connected across the 250 ohm resistor which means one side is voltage signal and the other is ground. If you have two difference grounds, then you will need to develop a loop isolator to place between the device signal and the arduino, so you can measure across the resistor.

First of all thank you on your replies, and helpful input!

weedpharma:
Have you measured the voltage across the R with a meter when connected to the Arduino?

Weedpharma

No I have not! But I have tried to measure resistance between arduino A0 and ground it is 150ohm, and between A1 and GND is about 700ohms (when arduino is not connected to power). I will update on this!

adwsystems:
I would first make a simple resistor divider to produce some voltage between 1 and 4 volts to make sure the analog input and program is working correctly. Then I would put the transmitter back into the circuit. My gut tells me you do have a ground reference issue. The which wall outlet they are plugged into means very little. I would get a 9VDC power supply for the arduino and then tie the grounds for the 9VDC and 24VDC together.

A 4-20mA transmitter is a simple device but stumps many people. The big picture circuit is 24VDC to the instrument, out of the instrument comes some semi-random voltage to produce the current necessary to drive the line loss resistance and the 250ohm precision resistor at the receiver plus the line loss resistance back to the device. The A/D needs to be connected across the 250 ohm resistor which means one side is voltage signal and the other is ground. If you have two difference grounds, then you will need to develop a loop isolator to place between the device signal and the arduino, so you can measure across the resistor.

Noted! I have tested the analog input with potentiometer, and with 3.3V psu - it worked OK. I will perform this test again, but I have to wait till Monday to get it :(.

So your advice is to use 9V battery to power arduino and to connect the grounds with the 24V psu. Can you make a picture or a scheme of it?

I have drawn the scheme to make it more clear.

berako:
Noted! I have tested the analog input with potentiometer, and with 3.3V psu - it worked OK. I will perform this test again, but I have to wait till Monday to get it :(.

So your advice is to use 9V battery to power arduino and to connect the grounds with the 24V psu. Can you make a picture or a scheme of it?

The circuit looks ok.

What supply voltage are you using for the Arduino?

Please supply the code.

Weedpharma

Did you notice that the voltage difference is ~1 / 100 the resistor value? Are you sure you have the right resistor?

My tuppenceworth.
Worked a lot with 4-20mA.
The standard setup is 250R precision across the 4-20mA output - this translates to 1-5V (why 4mA? I believe this goes back to old telegraph days where essentially 4mA was a low, 20mA was a high and 0mA was a line fault). Most industrial ADC's have 0 to 5-V DC inputs, so you have to offset the first 1-volt (the fullscale output of the device is actually 1 to 5V.
Occasionally, 500R was used. You can string several devices in series on the current loop, provided you didn't exceed the driving voltage (24V DC) - this is called the compliance - at 250R, each device drops the voltage by 5V.
So, across the 250R, you should get a reading between 1 and 5 volts with a DMM.
Grounds are the real bugbear of the 4-20 system - as a general rule, only one ground is allowed and industrial input boards often use the measuring end to supply the 24 volts - grounding both the receiver and transmitter will lead to ground loops. A 9 volt PSU is capable of producing 36mA across 250R, so if your sensor to Arduino wiring is not too long, you might get away with one PSU serving Arduino and sensor.
Worth a try.

With modern ultra low power devices the first 4 mA is used to power the "innards", thus you have "loop powered" devices that don't need separate power supply wires. Clever.

Hello guys!

I have managed to solve problem with using A1 as input, looks like the A0 input has some problems.

Managed to get some valuable data!

Tnx again for the input.