PT100 4-20ma Transmitter RTD temperature readings jump

Hey everyone,

Building some code that reads the temperature through an RTD. It's working and is giving me decently accurate readings with some fluctuations, but every 4-6 readings the temperature just jumps up about 7 or 8 degrees Celsius


. Does anyone know what the issue could be? I'm using the voltage reference 4.98500.


const int AnalogInput = A3; // This is where the resistor is place, from A0-A9
int sensorValue = 0;
int temperature = 0;
int ReceivedByte = 0;
float f1 = 0;
float t1 = 0;

void setup() {
 // initialize serial communication at 9600 
 Serial.begin(9600);
 analogReference(4.98500);
}
void loop() {
 // Wait until a byte is received
 // (On demand send)
  //if(Serial.available()){
    ReceivedByte = Serial.read();

 // Reading ADC
  sensorValue = analogRead(AnalogInput);

 // map the signals (multiplied by 10
 // to get decimal values, because map() doesn't work with floats)
  temperature=map(sensorValue,205,1023,-500,1500);
  f1 = temperature; // Float conversion

  t1 = f1/10.0; // dividing by 10
 // with one decimal value
 // Printing temperature value over serial port
  Serial.print(t1);
  Serial.print("\n");

 //}
 delay(500);

}```

analogReference takes an integer parameter, IIRC
Check here

Do we get to see the schematic?

Yea, my bad ill attach it. Also I'm fairly certain it takes a float because I didn't get any errors and have seen people using floats as references before.

It actually takes a uint8_t (in "wiring_analog.c") - not seeing an error or warning depends on your IDE preferences.

Seeing other people do incorrect things is no reason for you to follow them.

How long are your wires, and are there any sources of EMI nearby?

The USB cable is quite long, probably around 1.5 meters. I will try with a shorter USB cable tomorrow, but don't have one in the office unfortunately. As far as EMI, to be honest - I'm not sure as this DAS system has been given to me and I'm supposed to write code to acquire the values. Inside the system, there are RTDs, pressure transducers, flow meters, thermocouples, an RTC, SD card and a display screen. I would attach the general schematic, but sadly it's confidential. Sorry I can't give you more information, but I'm very newbie at this. Thanks for your help.

I understand your not the hardware person but if the 250 ohm resistor is connected to the Arduino as you have drawn you might want to suggest some input protection and filtering.

the data:

I see what you mean about being suspiciously periodic. You should determine what rate it is happening and ask the circuit folks if anything is operating at that frequency.

When dealing with data like this I've found averaging is not the best approach.
I will delete the highest 2 and lowest 2 measurements then average the remainder.

OR
I will capture a group of measurements sort them and take the middle reading. You can average a number of these readings to smooth out the result.

Note: P100 are typically not "fast" changing signals.

I too am interested in this voltage reference , not sure which processor this works with ?

Anyway - the voltage is very close to 5v , the nominal USB voltage - if that is you power supply , it could easily be noisey or dip below you reference voltage , upsetting your reading

1 Like

Hi,
Can you post a link to the RTD transmitter please.

Some have a "broken wire" facility where they spike the PT100 to see if it is still really there.
If it does, you may need to turn it off.

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

I believe the analogReference() takes a type..

...and that type is uint8_t.

I agree with @hammy . The AVR spec says the ext Ref can go to AVcc as a max. If you 5V into the board is not reliably above the external reference there may be issues. I don't know what they are as I've not tried such a condition but as a design I would think it would not be the best.

Another comment, and I realize you are not the hardware folks but...
IMHO
Platinum RTD's are usually only used when precision temperature measurement are required. Your references is written to 4 decimal places. I don't see how you expect to get precision results from an Arduino A/D.
Unless I misunderstand your goals, I should be using an external delta-Sigma converter for both accuracy and noise rejection.

I've never used anything but the default reference but from the documentation I would expect the external reference to be selected by:

analogReference(EXTERNAL);

I guess unless one is not using the "Arduino" language but going right to the µP registers it might be a diff type.

Alright everyone, I fixed my issue! In the initial code I was mapping the temperature value from -500 to 1500 and then divided by 10. I changed that to simply mapping from -50 to 150 without any divisions and it works without extreme fluctuations now! Thanks for your guys help

Now replace that stupid 250 ohm resistor with a 51 ohm (E24 value) resistor, and switch to the more stable 1.1volt Aref in setup(). That will make your temp readout also independent of (USB) supply voltage fluctuations.
Leo..

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