Python package for interfacing with Büchi Temperature Controllers btc01/btc02 via the RS232 serial port making use of pySerial.
Written for btc Firmware V7.
The BuchiTemperatureController
class extends the serial.Serial
class. To instantiate, simply pass the port name, e.g. 'COM3'
, to the BuchiTemperatureController
initializer. Port factory settings are assumed (see About the Device).
All the available attributes of the Büchi Temperature Controller are implemented as class properties. Each property calls a querying function query
to get and set the corresponding values via the serial port.
There is also a logging function log_csv
that continually writes .csv logs for heating power and temperatures 'T-J', 'T-R', and 'T-S' at a given time interval.
Get the software version number
>>> from btc import BuchiTemperatureController
>>> btc = BuchiTemperatureController('COM3')
>>> btc.version
'BUCHI AG btc01 TEMPERATURE CONTROLLER VERSION 7.0'
Set the working temperature 'T1' to 12.4 °C
>>> from btc import BuchiTemperatureController
>>> btc = BuchiTemperatureController('COM3')
>>> btc.query("out_sp_00", 12.4)
>>>
Log the heating power percentage and the temperatures 'T-J', 'T-R', and 'T-S' to a .csv file every 10s.
>>> from btc import BuchiTemperatureController
>>> btc = BuchiTemperatureController('COM3')
>>> btc.log_csv(timestep=10)
After installing the package, you can also use the btc_logger
console command.
> cd btc
> pip install .
...
> btc_logger -h
usage: btc_logger [-h] [-t TIMESTEP] [-f FILEPATH] port
Log temperature data from a Büchi temperature controller.
positional arguments:
port The serial port connecting to the temperature controller.
options:
-h, --help show this help message and exit
-t TIMESTEP, --timestep TIMESTEP
The time interval at which to log the controller data.
-f FILEPATH, --filepath FILEPATH
Path to a file to append the log to.
Some info on the serial port remote control of the btc01/btc02 as explained in the operating manual.
BAUDRATE | 4800 Bd |
PARITY | Even |
HANDSHAKE | RTS/CTS |
DATABITS | 7 |
STOPBITS | 1 |
Transfer sequences are the queries sent to the temperature controller. These byte sequences consist of a command and optionally a parameter.
Each transfer sequence is terminated with \r
.
The controller sends responses to "in-commands" (query commands without parameters). These responses are terminated with \r\n
.
So-called "out-commands" (query commands with parameters) do not prompt a response.
- Get working temperature 'T2'
Tx: b'in_sp_01\r' Rx: b'24.04\r\n'
- Set working temperature 'T1' to 12.4 °C
Tx: b'out_sp_00 12.4\r' Rx:
All of the commands (except for 'version'
, 'status'
, and 'REMOTE'
) can be prepended by either in_
(get) or out_
(set) to get or set the corresponding value. Setting is not possible for all of them.
Make sure to consult the operating manual.
Command | Description |
---|---|
'version' |
Number of software version (V X.xx). |
'status' |
Status message, error message. |
'REMOTE' |
Change the preset value. 0 == Set the preset value via the keyboard. 1 == Set the preset value with an external programmer. 2 == Set the preset value via the serial RS232/RS485 interface. |
'pv_00' |
Temperature value registered by the 'T-J' sensor (measurement/control). |
'pv_01' |
Heating/cooling power being used (%). |
'pv_02' |
Temperature value registered by the 'T-R' sensor (measurement/control). |
'pv_03' |
Temperature value registered by the 'T-S' sensor (safety). |
'sp_00' |
Working temperature 'T1'. |
'sp_01' |
Working temperature 'T2'. |
'sp_03' |
High temperature warning limit. |
'sp_04' |
Low temperature warning limit. |
'sp_05' |
Setpoint temperature of the external programmer. |
'hil_00' |
Max. cooling power (%). |
'hil_01' |
Max. heating power (%). |
'mode_01' |
Selected working temperature. 0 == "T1", 1 == "T2". |
'mode_02' |
Identification type. 0 == no identification, 1 == single identification, 2 == continual identification. |
'mode_03' |
Type of the programmer input. 0 == Voltage 0 V to 10 V, 1 == Current 0 mA to 20 mA |
'mode_04' |
Temperature control. 0 == Temperature control with Pt100 sensor 'T-J', 1 == Temperature control with Pt100 sensor 'T-R'. |
'mode_05' |
Circulator in Stop/Start condition. 0 == Stop, 1 == Start |
'par_01' |
Time constant of the external bath. |
'par_02' |
Internal slope. |
'par_03' |
Time constant of the internal bath. |
'par_04' |
Band limiting (max. difference between the temperatures in the internal bath and external system). |
'par_05' |
Ratio for max. cooling power versus max. heating power. |
'par_06' |
Xp control parameter of the internal controller. |
'par_07' |
Tn control parameter of the internal controller. |
'par_08' |
Tv control parameter of the internal controller. |
'par_09' |
Xp control parameter of the cascade controller. |
'par_10' |
Proportional portion of the cascade controller. |
'par_11' |
Tn control parameter of the cascade controller. |
'par_12' |
Tv control parameter of the cascade controller. |
'par_13' |
XpC control parameter of the cascade controller. |
'par_14' |
TnC control parameter of the cascade controller. |
'par_15' |
TvC control parameter ofthe cascade controller. |
'par_17' |
Maximum temperature 'T-J' with controlling to 'T-R'. |
'par_18' |
Minimum temperature 'T-J' with controlling to 'T-R'. |