Connecting to TC200 by Thorlabs in Python
Instrument Card
The TC200 Temperature Controller is a bench top controller intended for use with resistive heating elements rated up to 18 Watts. This general purpose instrument can drive various types of heaters, including foil and resistive coil types. It accepts feedback from either positive or negative temperature coefficient thermistors, has programmable P, I, and D gains, and will display the temperature in °C, °F, or K. In addition, it can be programmed for up to five sequential temperature settings along with associated ramp and hold times for each level. A user-programmable maximum temperature limit provides protection to the device being heated, and a user-programmable power limit protects the heating element from being over driven.
Device Specification: here
Manufacturer card: THORLABS
Thorlabs, Inc. is an American privately held optical equipment company headquartered in Newton, New Jersey. The company was founded in 1989 by Alex Cable, who serves as its current president and CEO. As of 2018, Thorlabs has annual sales of approximately $500 million.
- Headquarters: USA
- Yearly Revenue (millions, USD): 550
- Vendor Website: here
Connect to the TC200 in Python
Read our guide for turning Python scripts into Flojoy nodes.
PROTOCOLS > SCPI
from instrumentkit import SerialConnectionfrom instrumentkit import TC200
# Create a serial connection to the TC200 Temperature Controllerconnection = SerialConnection(port='/dev/ttyUSB0', baudrate=9600)tc200 = TC200(connection)
# Get the name and version number of the devicename = tc200.name()print(f"Device Name: {name}")
# Get the current output mode of the TC200mode = tc200.modeprint(f"Output Mode: {mode}")
# Set the output mode to 'cycle'tc200.mode = TC200.Mode.cycle
# Get the current enable status of the heaterenable = tc200.enableprint(f"Heater Enable: {enable}")
# Set the enable status to True (turn on the heater)tc200.enable = True
# Get the current temperature of the sensortemperature = tc200.temperatureprint(f"Temperature: {temperature}")
# Get the maximum temperature settingmax_temperature = tc200.max_temperatureprint(f"Max Temperature: {max_temperature}")
# Set the maximum temperature to 100 degrees Celsiustc200.max_temperature = 100
# Get the current set temperaturetemperature_set = tc200.temperature_setprint(f"Set Temperature: {temperature_set}")
# Set the temperature setpoint to 50 degrees Celsiustc200.temperature_set = 50
# Get the current P, I, D gains of the PID controllerpid = tc200.pidprint(f"PID Gains: {pid}")
# Set the P, I, D gains of the PID controller to [10, 5, 2]tc200.pid = [10, 5, 2]
# Get the current temperature unitsdegrees = tc200.degreesprint(f"Temperature Units: {degrees}")
# Set the temperature units to degrees Fahrenheittc200.degrees = 'degF'
# Get the current thermistor typesensor = tc200.sensorprint(f"Thermistor Type: {sensor}")
# Set the thermistor type to 'ptc1000'tc200.sensor = TC200.Sensor.ptc1000
# Get the current beta value of the thermistor curvebeta = tc200.betaprint(f"Beta Value: {beta}")
# Set the beta value of the thermistor curve to 3000tc200.beta = 3000
# Get the maximum power settingmax_power = tc200.max_powerprint(f"Max Power: {max_power}")
# Set the maximum power to 10 Wattstc200.max_power = 10
# Close the connection to the TC200 Temperature Controllertc200.close()
This script demonstrates how to connect to the TC200 Temperature Controller, retrieve and set various properties such as output mode, enable status, temperature, maximum temperature, temperature setpoint, PID gains, temperature units, thermistor type, beta value, and maximum power. Finally, it closes the connection to the TC200 Temperature Controller.