Thermocouple Phidget
The Thermocouple Phidget connects directly to a thermocouple and allows you to measure an extremely wide range of temperatures! A thermocouple, or a thermocouple wire, is a device that is made of two different metals that are joined together. A thermocouple will produce a very small voltage that is temperature dependent. You can use a device like the Thermocouple Phidget to amplify the voltage and convert it into a temperature reading.
The Thermocouple Phidget returns temperature in degrees Celsius (symbol: °C) and can be used in environments that a normal temperature sensor can't (e.g. flames, liquids, ovens, etc.).

Code (Java)
Create a file called Thermocouple and insert the following code. Run your code. Hold the end of the thermocouple to change the temperature.
Not your programming language? Set my language and IDE.
package thermocouple;
//Add Phidgets Library
import com.phidget22.*;
public class Thermocouple {
public static void main(String[] args) throws Exception{
//Create
TemperatureSensor temperatureSensor = new TemperatureSensor();
//Open
temperatureSensor.open(1000);
//Use your Phidgets
while(true){
System.out.println("Temperature: " + temperatureSensor.getTemperature() +" °C");
Thread.sleep(250);
}
}
}
//Add Phidgets Library
import com.phidget22.*;
public class Thermocouple {
public static void main(String[] args) throws Exception{
//Create
TemperatureSensor temperatureSensor = new TemperatureSensor();
//Open
temperatureSensor.open(1000);
//Use your Phidgets
while(true){
System.out.println("Temperature: " + temperatureSensor.getTemperature() +" °C");
Thread.sleep(250);
}
}
}
//Add Phidgets Library
import com.phidget22.*;
//Define
TemperatureSensor temperatureSensor;
void setup(){
try{
//Create
temperatureSensor = new TemperatureSensor();
//Open
temperatureSensor.open(1000);
}catch(Exception e){
e.printStackTrace();
}
}
void draw(){
try{
//Use your Phidgets
println("Temperature: " + temperatureSensor.getTemperature() +" °C");
delay(250);
}catch(Exception e){
e.printStackTrace();
}
}
Code (Python)
Create a file called Thermocouple and insert the following code. Run your code. Hold the end of the thermocouple to change the temperature.
Not your programming language? Set my language and IDE.
#Add Phidgets Library
from Phidget22.Phidget import *
from Phidget22.Devices.TemperatureSensor import *
#Required for sleep statement
import time
#Create
temperatureSensor = TemperatureSensor()
#Open
temperatureSensor.openWaitForAttachment(1000)
#Use your Phidgets
while(True):
print("Temperature: " + str(temperatureSensor.getTemperature()) + " °C")
time.sleep(0.25)
Code (C#)
Create a file called Thermocouple and insert the following code. Run your code. Hold the end of the thermocouple to change the temperature.
Not your programming language? Set my language and IDE.
//Add Phidgets Library
using Phidget22;
namespace Thermocouple{
class Program{
static void Main(string[] args){
//Create
TemperatureSensor temperatureSensor = new TemperatureSensor();
//Open
temperatureSensor.Open(1000);
//Use your Phidgets
while (true){
System.Console.WriteLine("Temperature: " + temperatureSensor.Temperature + " °C");
System.Threading.Thread.Sleep(250);
}
}
}
}
Code (Swift)
Create a file called Thermocouple and insert the following code. Run your code. Hold the end of the thermocouple to change the temperature.
Not your programming language? Set my language and IDE.
You will need to add three Labels.

import Cocoa
//Add Phidgets Library
import Phidget22Swift
class ViewController: NSViewController {
@IBOutlet weak var sensorLabel: NSTextField!
//Create
let temperatureSensor = TemperatureSensor()
override func viewDidLoad() {
super.viewDidLoad()
do{
//Subscribe to events
let _ = temperatureSensor.temperatureChange.addHandler(onTemperatureChange)
//Open
try temperatureSensor.open()
}catch{
print(error)
}
}
func onTemperatureChange(sender:TemperatureSensor, temperature: Double){
DispatchQueue.main.async {
//Use information from your Phidget to change label
self.sensorLabel.stringValue = String(temperature) + " °C"
}
}
}
Applications
Thermocouples are used anywhere that extreme temperatures need to be measured. Here are some examples:
- Water heaters, furnaces, fireplaces and similar appliances often use thermocouples or similar technology to detect the presense of a flame.
- Ovens, fryers, freezers and other kitchen appliances will use thermocouples monitor and maintain temperatures.
- Hot tubs and pools may use a thermocouple or similar device to monitor temperature



Practice
You can easily create a Phidget mood sensor with the Thermocouple Phidget. Set a few different temperature ranges and assign a mood to each.
Have a user hold the end of your thermocouple and use their temperature to predict their mood.
Check out the advanced lesson Using the Sensor API before you use the API for the first time.