# PT100 on Arduino Mega Industrial Shields PLC

## 6 posts in this topic

Im trying to use my PT100 with an Arduino-based PLC from Industrial Shields, which is basically an Arduino Mega encased in a plastic container. Im using a 250Ω resistor, actually 237Ω resistor between Analog and Ground.

Here is my setup:

Here is my code:

``````int sensorValue = 0;
int temperature = 0;
float f1 = 0;
float t1 = 0;
void setup() {
Serial.begin(9600);
Serial.println("hi...");
}
void loop() {
delay(1000);
Serial.println(sensorValue);
temperature=map(sensorValue,639,719,0,110);
f1 = temperature; // Float conversion
Serial.print(f1);
Serial.print("\n");
}
``````

These are my results for room temperature:

I got the values from an online pt100 table for resistance and tabulated them from 0-110C in 10 deg increments and for the corresponding resistance using:

nADC = 1023 * ( 237Ω/(237Ω+Rpt100))

Its not working because im getting values of ~300 for room temp which is well below this range, but since its not constrained (the map function).  What should I do?

Thanks

Edited by marciokoko

##### Share on other sites

I've seen some Arduino questions here before but I'm positive you'll get better answers here:  https://forum.arduino.cc/

##### Share on other sites

Doesn't that hockeypuck convert it to a 4-20mA signal? Best to check your voltages over the resistor using a multimeter

Edited by jdj230

##### Share on other sites

Yes it does convert it to amps.  But the readings are off.  I thought it might have to do with the mapping function so I've tried modifying the ranges of it but I get varying values which don't seem consistent with reality.  For example :

I always get 300 as the ABC value for room temperature.  And while tinkering with the temp range of the map function i can get the 300 to equal 25C.  But when I measure hot coffee for example, I get too small a change in temp, if I recall correctly something like 30C which in reality should be about 70C.  I've also measured with a digital thermometer side by side and even though I can get the starting  point 25c) to match between digital thermometer and the sensor, I can't get the other sample temperatures to coincide.

##### Share on other sites

1.  The 4-20mA signal is converted to a voltage for the analog input on the Arduino to read it properly.
Ohms Law says that
4.0mA current through a 250 ohm resistor drops 1.00 volts (E=I*R)
20.0mA current through a 250 ohm resistor drops 5.00 volts (0.20A * 250ohms = 5.0V)

When 4.0mA current passes through 237 ohms, then the voltage drop is:   0.004A * 237 ohms =  0.948V.

2.  You need to know what the scaling or range is for the temperature transmitter.
4.00mA = x Deg F or y Deg C
20.00mA = x Deg F or y Deg C

3.  Your calculations for what resistance is make no sense whatsoever.
> I got the values from an online pt100 table for resistance and tabulated them from 0-110C in 10 deg increments and for the corresponding resistance using:  nADC = 1023 * ( 237Ω/(237Ω+Rpt100))

The Arduino 'sees' only the mA current signal from the temperature transmitter and the voltage drop it creates across the analog input.   That signal could be relative humidiy, velocity, flow rate, pressure, temperature or about 100 other process variables.

Your calculation has to interpret the voltage drop seen at the input and scale that voltage drop for temperature.

You can only do that when you know for certain what the range of the temperature transmitter is (see item 2, above).
4.0mA = x deg F or C
20.0mA = x deg F or C.

If you don't know, then you can estimate the range with freezing water and boiling water.

Make up an icebath of crushed ice and a little water and put the RTD in the ice bath.  That's close to 0 deg C or 32 Deg F.   Measure the current output with a milliampmeter and record it.

Boil water with the RTD in the pot.  Try to keep transmitter out of the heat.  Measure the current output when the water boils.

Post the resulting current values here and I'll help you calculate what the transmitter is ranged for.