Sunday, May 19, 2013

More Modbus



The support of Modbus RTU was just added to Artisan (see this previous post), but it is already time to extend its scope based on your requests. This extension of the Modbus support allows Artisan to talk to more device including some build into commercial roasters.


Before we come to the new configurations, let's start with some Modbus theory. Modbus differentiates between Holding Registers and Input Registers. Holding Registers can be used to read and write data to and from a device via the Modbus function 3. This is what Artisan supported initially. But there are also devices that offer readings in read-only Input Registers to be accessed via the kind of outdated Modbus function 4.


Modbus Function 4


For example, the Fuji PXR/PXG 4 & 5 PIDs as well as the ENDA ETC PIDs hold the temperature readings in Input Registers. While the Fuji PIDs were supported before by device specific code, the ENDA PIDs could not be accessed with the initial Modbus support. As you see in the Modbus tab, from now on you can select Modbus Function 4 as well to read values from devices.

Here is how the updated Modbus configuration tab looks now.

Float Registers


So what is this Float tick-box about? I was contacted by the producer of the San Franciscan roaster telling me that a client would like Artisan support in his new roaster. They offered him a build-to-order option with an Modbus-enabled Watlow EZ-Zone PM6 PID. While this PM6 can be accessed via the Modbus function 3, it does return its readings as float values encoded in 2 groups of 2 bytes. Up to that point Artisan could read only 2 byte integer registers. So we added support for float registers. As the Modbus standard is weak on specifying the standard order of those byte groups, we also added an option to switch from the standard big-endian order to the little-endian order. Some PIDs, like the PM6 allow to configure the byte-order on the device. In this case it has to be ensured that Artisan and the device agree on the order.


Registers vs Memory Addresses


Often you read in the documentation of a Modbus device about memory addresses to access data. Those are usually numbers like 31000 or 40001 (known as Modicon notation). Don't get confused! Those are not the register numbers that Artisan expects in its Modbus tab. However, they are related. Holding Registers (function 3, remember?) have address from the range 40001-49999 and Input Registers (function 4) from the range 30001-39999. So the memory address 31001 has to be specified by its corresponding register number 1001 or sometimes as 1000 (to be accessed via Modbus function 4; no typo here!) in Artisan and the address 40001 as register 1 or sometimes 0 (to be accessed via Modbus function 3; again no typo).


Modbus Cheet Sheet


First you have to ensure that your serial2RS485 adapter is recognized by your PC (choose one that is compatible with your platform and  were the driver supports your specific device. The FTDI drivers only support devices that have their device id registered within the driver!), which needs to have the corresponding driver installed, and can talk to your Modbus devices. Second, you have to enter the corresponding serial connection parameters into Artian's Modbus tab. Third, note down the Modbus slave id from the device configuration.


  • Watlow EZ-Zone PM6 (2 channel PID; built-to-order for The San Franciscan roasters)
    • channel 1: register=360, function=3, float=true
    • channel 2: register=450, function=3, float=true
Note: this device needs to be set to the correct data map (map 2) and its byte order for floats have to correspond to the one configured in Artisan (little vs big-endian)


  • Watlow Series 96 and 97 (1 channel PV + OUT% PID)
    • channel 1 (PV): register=100, function=3, float=false
    • channel 2 (OUT%): register=103, function=3, float=false


  • Fuji PXR/PXG (1 channel PID)
    • channel 1: register=1000, function=4, float=false, divider=1/10 (with MODBUS RTU meter setup)
    • alternatively select the PID/Fuji setup with the separate radio button and popup

 Note: values needs to be divided by 10 using the formula "x/10.0" in the Symb ET/BT tab. Anyhow, Artisan comes with a specific support for the Fuji PIDs that allows also the control of a device by selecting PID in the device settings. 


  • myPCLab (2+1 channel temperature meter)
    • channel 1: register=4, function=3, float=false
    • channel 2: register=5, function=3, float=false
    • ambient temperature: register=6, function=3, float=False

 Note: the myPCLab ignores the slave id (just set to 1) and values needs to be divided by 10 using the formula "x/10.0" in the Symb ET/BT tab


  • ENDA ETC 4420 (2x one channel PID; build into some Toper roasters)
    • channel 1: register=0, function=4, float=false
    • channel 2: register=0, function=4, float=false


  • Autonics TK4S (one channel PID; build into some Proaster roasters)
    • channel 1: register=1000, function=4, float=false

  • APAR AR 200
    • channel 1: register=12, function=4, float=false
    • channel 2: register=13, function=4, float=false


  • Delta DTA / DTB
    • channel 1 (PV): register=18176, function=3, float=false, divider=1/10
    • channel 2 (SV): register=18177, function=3, float=false, divider=1/10
    • select PID (not meter) with the corresponding radio button and choose DTA/DTB from the popup. The device is has to be configured to communicate MODBUS ASCII with baud 9600, 8 N 1 if the DTA PID mode is used in Artisan. Alternatively switch the device to MODBUS RTU and use the MODBUS meter setup with the above MODBUS channel setups.


    • baud rate: 9600 (to be sure you set the same baud rate on E5CC)
    • parity: If you choose "n" then "byte size" will be 8, and "stopbits" will be 2!! If you choose "e", or "o", "byte size" will be 8, and "stopbits" will be 1!! THIS IS UNCHANGEABLE!! E5CC will hide byte size and stopbits selection once you choose Modbus!!
    • slaveId: just set the same as what you set on E5CC
    • register: 8192
    • function: 3
    • divider: 1/10
    • mode: C
    • little-endian: enable
    • type: Serial-RTU



So if you order your The San Franciscan roaster today, ask for the Artisan build-to-order option;)