Simulate Type K thermocouples

I am currently trying to simulate a millivolt source for a PLC bank all the other chats on thermocouple simulation have closed.
Any help would massively be apricated

Your topic does not indicate a problem with the Arduino Command Line Tools and therefore has been moved to a more suitable location.

Did you try the suggestions in the other chats? What doesn't work?

I'd guess a PWM with an RC filter or a DAC plus an opamp to scale and offset the range.

Did you see this post of mine, in the second topic that DaveX gave links to?

What temperature range are you wanting to simulate?

What type of themocouple do you want to simulate?

I posted in that topic on 21st September 2024, and it doesn't close until 6 months after the last post (which was mine), so it is still open.

Here is the circuit that I used to simulate a type K thermocouple, up to 150°C:

1 Like

I am trying to simulate Type K so I would need negative millivolt ranges. Is this possible through your method? Would I need to create a negative rail?

If I look up the -200 and 1260 spec on a thermocouple chart, I see that what you really mean is that you want to make voltages from -5.891 to 51.000mV.

Why not aim for -10mV to 60mV?

And is there a particular point in the range where you would like it to have the best resolution?

Would the 8-bit/256 levels from an analogWrite() PWM be OK? Or would you like the 16bit/65536 levels out of a Timer1 PWM? Or something like a 12 bit DAC be OK?

My circuit/method does only produce positive voltages.

The temp range require will be -50 to +100 degree's C so that point would need to be the highest resolution

I've had an idea about how to modify my circuit to give negative voltages.
I'll try it out, and report back if it is successful.

1 Like

Why? what is the temperature of your reference?

How high?

1 Like

This is what I have come up with:

A second potential divider adds a few millivolts offset to the negative terminal of the thermocouple.

I sent SCPI commands from an Arduino Uno R3 with Ethernet shield to my multimeter to characterise the K-type Thermocouple simulation.

The results were copied from the Serial Monitor and saved as a CSV file, then opened in Excel to produce the following graph:

Code used to characterise K-type Thermocouple Simulator.
#include <SPI.h>
#include <Ethernet.h>

unsigned long previousMillis = 0;
const long interval = 1000;
int outPin = 9;
int outVal = 0;

// Enter a MAC address and IP address for your Arduino
byte mac[] = { 0xA8, 0x61, 0x0A, 0xAE, 0x0B, 0xB5 };
IPAddress ip(192, 168, 0, 10);                          // desired Arduino IP address
IPAddress server(192, 168, 0, 8);                       // IP address of the Multimeter

EthernetClient client;

void setup() {

  // Start the Ethernet connection:
  Ethernet.begin(mac, ip);
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  pinMode(outPin, OUTPUT);
  analogWrite(outPin, outVal);

  // Give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("\nConnecting to instrument...\n");

  // Connect to the DMM:
  if (client.connect(server, 5025)) { // Port 5025 is commonly used for SCPI
    Serial.print("Connected to: ");
    // Send an SCPI command to the instrument:
    client.println("*IDN?");
  } else if (client.connect(server, 5555)) { // Port 5555 is used for SCPI by Rigol
    Serial.print("Connected to: ");
    // Send an SCPI command to the instrument:
    client.println("*IDN?");
  }  else {
    // If you didn't get a connection to the server:
    Serial.println(" Connection failed.");
  }

  // set multimeter to read temperature using type K thermocouple
  client.println("CONF:TEMP THER,KITS90");
  client.println("CONF?"); // check configuration
 
  delay(1000);

  while (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  // Serial.print(outVal);
  previousMillis = millis();
  client.println("read?");
}

void loop() {

  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;

    // Serial.print("\t");
    Serial.print(outVal);
    Serial.print(", ");
    client.println("read?");

    // If there are incoming bytes available from the DMM:
    while (client.available()) {
      char c = client.read();
      Serial.print(c);
    }

    // set next duty cycle:
    outVal++;
    analogWrite(outPin, outVal);

    // end of test:
    if (outVal >= 256) {
      Serial.println();
      Serial.println("Test Finished.");
      //return  multimeter to manual control
      client.println("SYST:PRES");
      Serial.println();
      Serial.println("Disconnecting.");
      client.stop();
      // Do nothing more:
      while (true);
    }

    // If the server disconnected, stop the client:
    if (!client.connected()) {
      Serial.println();
      Serial.println("Disconnecting.");
      client.stop();
      // Do nothing more:
      while (true);
    }
  }
}

K-Type Thermocouple Simulation.txt (5.5 KB)

2 Likes

Thank you very much really appreciate. I will try this and let you know the results.