4-20mA 24V DC Temperature Sensor

Hi

I'm looking for some help interfacing an Arduino Uno with an industrial pt100 type temperature sensor and transmitter.
It is a two wire device, which requires a 24V power supply.

At the moment I have the temperature sensor taking readings on a machine. I usually attach a data logger in series which takes a log of the current output of the device. I can then download the data from the logger on my computer and see the temperatures that were recorded. I have attached a schematic of this set up.

I think it should be possible however to connect in an Arduino and take real time measurements on my laptop?
I am worried about connecting my arduino to a circuit which has a 24V DC power supply.

Any advice at all would be very welcome and appreciated.

Thanks! :slight_smile:

Hi groundfungus

Thanks so much for your reply.

I did have a look for help in the forum before posting this new topic (as any good forum member should! :P) and I found that same solution. I think you're perfectly right to connect in a 250 Ohm resister but my problem is that I don't know how to do this while still keeping my 24V DC power supply connected in the loop too?

I see in your reply your attachment has a pressure transmitter and resister and arduino...
Where would my 24V power supply come in to this set up?

On the arduino do I use an analog input and ground connections?

Thanks again for your help... this is a big learning curve for me!

Like this:

pt100 arduino.PNG

4..20mA is a current loop using a controlled current to signal the value. The advantages are multitude:

  • Only 2 wires used
  • High immunity to noise and interference
  • Powering of sensors is possible
  • Insensitive to voltage drops in wiring
  • 4ma lower treshold makes wire break detection possible
  • Multiple receivers can receive exactly the same signal by series connection

In order to preserve a constant current a series connection is needed. Not a parallell as indicated by groundfungus
http://www.bapihvac.com/CatalogPDFs/I_App_Notes/Understanding_Current_Loops.pdf

Thank you both for your input on this. I really appreciate it!

nilton61 I understand your circuit diagram and can see how it allows for powering of circuit while still measuring the current. I will connect it this way.

groundfungus your idea of using a multimeter first is excellent! that way I can protect the Arduino and hopefully avoid blue smoke!

Thanks again guys. :slight_smile:

treacych:
Thank you both for your input on this. I really appreciate it!

nilton61 I understand your circuit diagram and can see how it allows for powering of circuit while still measuring the current. I will connect it this way.

That is the correct way to proceed. However it might be the case that the existing transmitter is already in service allowing for the recording of this sensor for latter review/playback. If you wish the arduino to be wired into the existing 'current loop' you need to look careful at being able properly have both the existing loop and new addition using the same ground as the voltage source powering the existing loop. You need/should draw the complete loop details if you are going to want to retain it's existing function.

groundfungus your idea of using a multimeter first is excellent! that way I can protect the Arduino and hopefully avoid blue smoke!

Thanks again guys. :slight_smile:

Hi retrolefty

Thanks for your input. I'm just trying to understand what it is you are saying I should check.... my lack of understanding on your point is probably purely due to my inexperience!

When you say draw the complete loop, what do you mean? At the moment I am operating in a workshop test environment. I have a Pt100 thermometer with transmitter connected to a machine. I have a connection from power supply to transmitter to data logger and back to power supply (just like the attachment on my very first post). That is the entirety of my set up.

For clarity the instrument is not feeding into a control system or PLC. I just want a way to read temperatures off the pt100. I think you may be referring to the fact that the transmitter could be used as a control device and may be connected to a PLC downstream? In my set up there is nothing further down the line. Just transmitter, power supply, and data logger (or now, instead of data logger I will use the arduino to get read time readouts).

Thanks in advance for your feedback

One more question:

Is it important to use a resistor of exactly 250ohms?

I have 170ohm, and 50 ohm resistors. But no 250ohm ones.

I know from V=IR that the value of the resistance is obviously quite important. Is it possible to get resistors of exactly 250ohms?

Hi, yes it is important to use 250 Ohms, try 4 x 1K in parallel.
The voltage drop across the resistor is giving you the scaled 0 to 5V.

Tom... :slight_smile:

Thanks Tom
I've used 5 x 50ohm resistors in series... just because that's what I had! :slight_smile:

Its important that the value is <=250Ohm for a 5v aref. If its lower you will loose some accuracy, if its higher it can burn the arduino

I checked with a multimeter... I've got 5 50ohm resistors in series.
Multimeter reads 253ohms, you think this is OK or am I endangering the Arduino?

The datasheet says (under28. Electrical characteristics 28.1 Absolute maximum ratings)

Voltage on any Pin except RESET
with respect to Ground ................................-0.5V to VCC+0.5V

So your circuit would be within limits. You will have to calibrate (either in you program or in the transmitter)

You can use a smaller resistor.

For example, if you use a 150 ohm resistor, then pushing 4 mA though it will be an analog voltage of 0.6 V and pushing 20 mA though it will create an analog voltage of 3V. That is enough range to detect with the arduino A/D converter.

With 4-20mA current loops you place a 250? ±1% precision resistor to obtain a point to measure 1-5Vdc.
The futher away your resistor is from 250? then you will have a larger error and will need to compensate for this, probably in your software which makes things messy.

I suspect what you may be using are at best, 1% or 2% metal, or are you using old 5% or 10% types?

For the long term and accuracy, I would suggest getting a precision resistor that will also be more temperature stable.

Just found a couple in my parts box :stuck_out_tongue:


Paul

I'm sorry if I wasn't clear before, it was a little confusing for sure. If you don't need to keep the present data logger working then you simply wire it up as posted by nilton61. If you did want to wire the loop up such that the arduino and data logger were both getting valid measurements at the same time then the loop wiring can get more complicated (and some times not compatible at all) due to the need to share a common ground and the placement of the voltage sensing resistor in the loop.

As far as how important the exact value of the resistor needs to be, it's not critical at all. 4ma represents the 0% temperature reading and of course 20ma represents the top of scale of the temperature sensor/transmitter, only you know the existing calibrated range of your temp/transmitter end points.

So a 250 ohm sensing resistor will drop 1 and 5vdc for those two end points. Using a resistor of slightly different value would just change the voltage end point values the arduino would read. Then in your software you just scale the voltage to temp units conversion (most easily done with the map() function). You have to perform this voltage to units conversion anyway in your sketch so it doesn't matter if you are not using 1 and 5vdc as your end points, you just need to know what your actual end point voltages will be for your specific measurement range transmitter using volts = current X the actual resistor value you are using.

Good Luck
Lefty

Thank you all again for your help! I'm really grateful for how helpful all you guys are!

Using everyone's advice I've wired everything up and am getting a reading on my serial monitor from the Pt100. At the moment I am just reading in the value straight using the analogRead function, so I am getting values between 0 and 1023. I know it is working because by putting the probe into a cup of hot water, the values shoot up. It was a real great moment to see it work!

My next problem is in an area I thought would be easy.
I am trying to map the value being read to a temperature value using the map function..

here's my code:


float sensePin =0;

void setup(){
analogReference(DEFAULT);
Serial.begin(9600);
}

void loop(){
float val = analogRead(sensePin); //read probe output

Serial.println(val); //print this to screen (for debugging only)

float temp = map(val, 0.0, 1023.0, 0.0, 300.0); //convert from analog read numbers to temp

Serial.println(temp); //print temp to screen
delay(500); //wait half a second before repeating
}


However the outputs I get are as follows:
265.00
77.00

etc...

Now I know that it's not 77 deg C in my office right now... I'm in Ireland! :stuck_out_tongue:

If anyone has any ideas of where my mapping/calibration is going wrong?

Thanks again

Are you remembering that the span of the voltage is 1 to 5V?

Yes, what you will need to do is to subtract the 4mA offset from the raw ADC value that you are reading.
You can do this a number of ways, one way is to put your RDT in slushy ice water for say around 5 minutes.
That will be very close to zero ºC as you are likely to get. At that point you can determine your zero offset.

Also, just to clarify, you mention that you are mapping the analog to an input range of 0 to 300 ºC, is that what your RTD transmitter is calibrated to? Be careful if your transmitter is calibrated for below zero ºC in the way you account for offset in your program.

Also, I noticed you are using a float type for your analog pin reference. Remember it is a type integer, as you can't have input pin 1.37 or whatever.

I can imagine your excitement in seeing something in the real world having effect on your screen as numbers.
It is a start and careful you don't get hooked like the rest of us :stuck_out_tongue:


Paul

Thanks guys!
I've changed my analog pin reference to an int type!
I used a cup of ice slush to get 0degrees and boiling water to get 100degrees and mapped using those values.
Seems to be working perfectly now! I have a feeling I'm hooked already! XD

One last question!
I would like to connect up more than one transmitter at a time... is this possible?
I know I have a number of analog inputs available.... so that connection is OK, but what about the ground rail... will there be interference if I connect another transmitter to the same ground rail?

Essentially I have three (identical) temperature transmitters on my machine... if I could take readings from all three it'd be great....