Requirements
How does a PT100 sensor work?
A PT100 is a type of temperature sensor known as a Resistance Temperature Detector (RTD) It is widely used in various industries for accurate and reliable temperature measurement.
In its interior there is a platinum resistor which increases its electrical resistance when heated. The increment of resistance versus temperature can be considered linear (although it is not), and will help on the conversion from resistance to temperature.
Types of PT100 sensors
PT100 sensors come in different configurations based on the numbers of wires used to connect them. The variations in wire configurations (2-wire, 3-wire and 4-wire) are designed to address and compensate for the inherent resistance in the connecting wires themselves, which can affect the accuracy of temperature measurements, specially over long distance or in environments with electrical noise.
The characteristics of each one are:
- 2-Wire: Used in applications where cost and simplicity are prioritized, and high accuracy over long distances is not critical.
- 3-Wire: Offers better accuracy than 2-wire setups by compensating for lead wire resistance. Suitable for applications requiring moderate accuracy.
- 4-Wire: Provides the highest accuracy by completely eliminating the impact of lead wire resistance. Ideal for precise and critical temperature measurements in laboratory settings, calibration standards, and industrial applications where accuracy is paramount.
Transformation to analog signal
In addition to the PT100 probe, a RTD needs to be connected. This dispositive is in charge of transforming the small voltage that is across the PT100 sensor to an analog signal, which will then be connected to the input of the PLC.
The connection may vary depending on the model of the RTD, but all of them share the same format. The one we used was this one:
As it can be seen, the power supply voltage is 24Vdc, and the output is from 0-10V. Also, the picture under the screws shows that the PT100 probe needs to be connected on the right, and the left one will be the output. The 3 types of probes will be connected the same way, with positive led in one of the two remaining screws and the negative led on the other one.
Take a look at this image for reference:
In the top 2 screws, there is a 24Vdc power supply. The left brown wire is the output from the RTD and goes to an Analog Input from the PLC, and the PT100 sensor is connected as described before. In this case, the probe was a 3-wire PT100, so both red wires share screws, and the white one goes alone.
Reading the temperature
To be able to read the temperature, first we need to understand how it is represented in the PLC. The Analog Inputs from any Industrial Shields PLC are 0-10V, but the resolution bits from each one of them is different. For instance, here is a table that shows the resolution bits for all Industrial Shields PLC models:
- M-Duino PLC: 10 bits
- ESP32 based PLC: 11 bits
- ESP32 PLC 14: 12 bits
- ESP32 PLC 14: 12 bits
- Raspberry PI PLC: 12 bits
Another point of interest is the range of temperature from the probe. In this case, the sensor goes from -50ºC to 100ºC, but other sensors can have different ranges. The formula to convert the analog values from the PLC to temperature is the following (Remember that we considered the increment of resistance over temperature linear, so the equation will be the linear graph formula):
After knowing how to convert the analog input voltage to temperature, we can create a small Arduino IDE script to read and convert:
void setup() {
Serial.begin(115200);
pinMode(I0_7, INPUT);
}
void loop() {
float a = 15, b = -50;
float volt = analogRead(I0_7) * 10 / 2047.0;
float temp = a * volt + b;
Serial.print("Temperature: ");
Serial.print(temp);
Serial.println("ºC");
}
Depending on the PLC used to read the sensor and the temperature range of the PT100, the parameters "a" and "b" can change, so adapt them to your needs.
Reading temperature with a PT100 temperature sensor