PT100 with 4-20mA transmitter

connect up to 4 PT100s to an Industruino INDIO

Tom

The PT100 and PT1000 are standard industrial temperature sensors (RTD = Resistance Temperature Detectors) that can easily be used with an Industruino INDIO by adding a 4-20mA transmitter that converts the measured resistance into a 4-20mA signal.

The PT100 sensor comes with 2, 3, or 4 wires. 2 wires give us the resistance of the sensor PLUS the leads, so we can't be sure about the exact sensor resistance. 3 wires solve this by adding a wire to one side, so we can measure also the resistance of 1 lead wire, and assume the other one is similar. 4 wires allow us to measure the resistance of both lead wires. More details here.

A common way to use the PT100 is to add a transmiter, that converts the resistance into a 4-20mA signal. Such current loop is stable over long cable lengths. In this example we use a WIKA T15.H transmitter which can handle 2,3,4 wire PT100 and PT1000 sensors, and has programmable ranges and error handling (if you get the programmer). 

The INDIO has 4 analog input channels, so we can connect up to 4 PT100 sensors. In below example we connect 2.

This is a close-up of our transmitter:

  • PT100 connected with 3 wires, on terminals 2, 3, 4 as per WIKA datasheet. the sensor resistance is between terminal 2 and 3 (red and blue wires)
  • Power is supplied via the + terminal, in our example we connect it to the V+ of the same 24Vdc PSU as the Industruino
  • Signal is on the - terminal, and we connect this to the INDIO's analog input channel
In this wiring setup, we have to make sure that the Industruino's analog section GND is connected to the V- of the PSU. By default, the analog section is isolated from the voltage supplied to the Industruino on V+/V-. We just have to add a wire between V- and analog GND.
Below we see the Industruino powered by a 24V PSU, with a red/black wire pair from the bottom. The same PSU also supplies the transmitters, via red/black wire pair in the middle. The black wire continues into the analog GND, and the red wire continues into the 2 orange wires to the transmitters' + terminal. The - terminals go to the analog input channels via the grey and yellow wires.
Note: If we wanted, we could power the transmitter with a separate PSU, which may increase accuracy. In that case the analog section can remain isolated from the Industruino's PSU.

Finally, the code for this setup is very simple. Below sketch measures the 4-20mA signals on channels 1 and 2, with 12 bit resolution, and maps the current to a temperature range. This mapping will depend on your transmitter, below example maps 4mA to 0 degrees and 20mA to 60 degrees (constants defined at the top). Note that the Arduino map() function only takes integers, so we multiply the values by 1000 and then divide the result by 1000 to get decimal accuracy.

/*
 * DEMO for Industruino INDIO D21G analog input PT100 with 4-20mA transmitter
 * Tom Tobback, June 2020
 */

#include <Indio.h>
#include <Wire.h>

#include <UC1701.h>
static UC1701 lcd;

const int t_min = 0;
const int t_max = 60;

void setup()
{

  SerialUSB.begin(115200);
  lcd.begin();
  digitalWrite(26, HIGH);  // full backlight

  //  Indio.analogReadMode(1, V10); // Set Analog-In CH1 to 10V mode (0-10V).
  //  Indio.analogReadMode(2, V10_p); // Set Analog-In CH2 to % 10V mode (0-10V -> 0-100%).
  //  Indio.analogReadMode(3, mA); // Set Analog-In CH3 to mA mode (0-20mA).
  //  Indio.analogReadMode(4, mA_p); // Set Analog-In CH4 to % mA mode (4-20mA -> 0-100%)
  //  Indio.analogReadMode(4, V5); // Set Analog-In CH4 to 5V mode (2x gain enabled on ADC).
  //  Indio.analogReadMode(4, V5_p); // Set Analog-In CH4 to 5V mode (0-5V -> 0-100%).
  //  Indio.analogReadMode(4, V10_raw); // Set Analog-In CH4 to 10V mode and read raw ADC value (0-10V -> 0-4096).
  //  Indio.analogReadMode(4, mA_raw); // Set Analog-In CH4 to mA mode and read raw ADC value (0-20mA -> 0-4096).

  Indio.setADCResolution(12); // Set the ADC resolution. Choices are 12bit@240SPS, 14bit@60SPS, 16bit@15SPS and 18bit@3.75SPS.
  Indio.analogReadMode(1, mA);
  Indio.analogReadMode(2, mA);

  lcd.clear();
  lcd.print("INDIO PT100 demo");
  lcd.setCursor(0,1);
  lcd.print("4-20mA inputs");
  
}

void loop()
{

  float sensorVal1 = Indio.analogRead(1); //Read Analog-In CH1 (output depending on selected mode)
  float sensorVal2 = Indio.analogRead(2); //Read Analog-In CH1 (output depending on selected mode)
  // for mapping, multiply by 1000 to get decimal accuracy, because the mapping function only takes integers
  float mapped_T1 = map(sensorVal1 * 1000.0, 4000, 20000, t_min * 1000.0, t_max * 1000.0) / 1000.0; 
  float mapped_T2 = map(sensorVal2 * 1000.0, 4000, 20000, t_min * 1000.0, t_max * 1000.0) / 1000.0;

  SerialUSB.print("CH1: "); //Print "CH" for human readability
  SerialUSB.print(sensorVal1, 3); //Print data
  SerialUSB.print("mA \t"); //Add some "  " space
  SerialUSB.print(mapped_T1, 3);
  SerialUSB.print("degC \t");

  SerialUSB.print("CH2:"); //Print "CH" for human readability
  SerialUSB.print(sensorVal2, 3); //Print data
  SerialUSB.print("mA  \t"); //Add some "  " space
  SerialUSB.print(mapped_T2, 3);
  SerialUSB.print("degC \t");

  SerialUSB.println(); 

  lcd.setCursor(0, 3);
  lcd.print("CH1: ");
  lcd.setCursor(30, 3);
  lcd.print(sensorVal1, 3);
  lcd.print(" mA  ");
  lcd.setCursor(30, 4);
  lcd.print(mapped_T1, 3);
  lcd.print(" degC  ");
  lcd.setCursor(0, 5);
  lcd.print("CH2: ");
  lcd.setCursor(30, 5);
  lcd.print(sensorVal2, 3);
  lcd.print(" mA  ");
  lcd.setCursor(30, 6);
  lcd.print(mapped_T2, 3);
  lcd.print(" degC  ");

  delay(100);
}