Thursday, January 29, 2015

Connecting Artisan to a Coffee-Tech FZ-94 Lab Roaster

The extensive controllability of the FZ-94, a 100g to 2.4kg capacity range lab roaster from Coffee-Tech Engineering, makes it an excellent machine for the development of roast profiles. It features three electric heating elements that can be controlled separately, controls for both, drum speed and air speed, and comes with three build-in temperature probes. The roaster is prepared for data logging using Artisan via its USB connector.

The FZ-94 communicates via the MODBUS RTU protocol via its build-in FTDI-based USB-to-RS485 interface. So the first step to setup the Artisan connection is to install the corresponding FTDI VCP driver for your platform [NOTE: OS X 10.9 and later contain already support for the FTDI hardware and therefore no additional driver needs to be installed on those systems].

Next, we need to select MODBUS as main device type in the Device Assignment dialog (menu Config >> Device).

The serial RS485 communication parameters have to be set in the Serial Ports Configuration dialog (menu Config >> Serial Port). First we set the Comm Port by selecting the correct serial device port from the popup while the roaster is plugged-in to the USB port of the computer. Then we enter the basic serial parameters, which are a baud rate of 2400 and the standard 8N1 configuration as the byte size, parity and stop-bits values.

In the same dialog, we have to specify the MODBUS protocol, slaves, registers and functions to be used to gather the temperature readings from the roaster. The FZ-94 features the following temperature readings.
  • bean temperature (BT): slave 11, register 0 (should be linked to MODBUS Input 1)
  • environmental temperature (ET): slave 13, register 0 (should be linked to MODBUS Input 2)
  • drum space temperature (Drum): slave 12, register 0 (used to control the heating source)

All registers return the values in Celsius and have to be accessed using MODBUS function 3 (read holding register).

Two more configurations are need. The FZ-94 holds the temperature readings in 2 byte integer registers. So a temperature of 180.7C is returned as the integer 1807. Therefore, Artisan has to divide the received values by 10. This is done by specifying corresponding symbolic assignments x/10 in the Device Assignment dialog (menu Config >> Device; tab Symb ET/BT). To get a higher resolution one can use the formula x/10.0 as that way the underlying system creates a floating point number holding a higher resolution.  So 12/10 evaluates to 1, but 12/10.0 to 1.2. [UPDATE: from Artisan v0.9 it is not advised to specify those dividers in symbolic formulas, but to use the new Divider option in the MODBUS tab to 1/10 per input channel]

To access the third temperature retrieved via MODBUS Input 3, we have to add an extra device of type MODBUS_34, again specifying the symbolic assignment x/10.0  [UPDATE: from Artisan v0.9 it is not advised to specify those dividers in symbolic formulas, but to use the new Divider option in the MODBUS tab to 1/10 per input channel]. The second channel of that extra device can be hidden by removing the tick of the corresponding LCD2 and Curve2 controls.

Previous Models

The configuration described above is for the actual model of the FZ-94 as of writing (1/2015). There are previous models that featured a different USB-2-RS485 interface based on the Prolific PL2303 chip. For those models the corresponding Prolific driver has to be installed and the baud rate has to be set to 9600. Further, some older models only have two instead of three probes installed. So in this case, only MODBUS Input 1 and Input 2 should be configured in the Serial Dialogs MODBUS tab with slave id 12 and 13, and Inputs 3 and 4 should be disabled by setting their slave id to 0. Finally, those models use different controller units that needs to be accessed using MODBUS function 4 instead of 3.

Finally, it might be needed to tick the little-endian flag on some configurations to get the readings through. Thanks Martin for this hint!

UPDATE: the FZ-94 setup described above, while still valid, is superseded by  an improved FZ-94 setup enabled by Artisan v1.0, detailed in a series of newer post: Playing with the CTE Lab Roaster