Difference between revisions of "Controlling Belimo Valves"
Line 125: | Line 125: | ||
== Control Modes == | == Control Modes == | ||
Modbus register 119 is used to set the control mode: 0: Analog 1: Modbus (see example commands). | |||
=== Modbus Control === | === Modbus Control === | ||
Line 130: | Line 131: | ||
=== Analogue Control === | === Analogue Control === | ||
The valve setpoint is controlled through the analogue input connection using a 2-10v signal. | |||
=== Analogue Hybrid Mode === | === Analogue Hybrid Mode === | ||
Refers to analogue control with Modbus connected for additional functions. |
Revision as of 22:56, 27 May 2022
Belimo valves are one of the most recognised and widely used makes of valve in the HVAC industry. The libraries on this page provide the tools to control and monitor valves using the MQTT open controls protocol and Node-RED.
Modbus Registers
Note that the register number is one more than address.
Operation Registers
Service Registers
Connecting via FTDI Cable
FTDI -> Actuator
Orange -> Grey
Yellow -> Pink
Black -> Not Connected
Example Commands
Read Modbus Setpoint
As an example, to read the Setpoint requires sending to the device (1 default) a FC3 read command (3) calling for register 1 (0 0), requesting a single value (0 1), ending with the CRC (Cyclic Redundancy Check).
In modbus the following characters would be sent to the valve over RS485 (shown in decimal and hex):
dec: [ 1, 3, 0, 0, 0, 1, 132, 10 ] hex: [0x01, 0x03, 0x00, 0x00, 0x00, 0x01, 0x84, 0x0a]
Read Analogue Setpoint
The analogue setpoint register (13) is different from the Modbus setpoint (1). Register 119 (Sepoint Selection) choses which is valid.
dec: [ 1, 3, 0, 12, 0, 1, 68, 9 ]
When reading the analogue setpoint, note that analogue values less than 2v will result in unreadable values (65030+). The valve will still be closed.
Set to Modbus Control
dec: [ 1, 6, 0, 118, 0, 1, 169, 208 ]
Set to Analogue Control
dec: [ 1, 6, 0, 118, 0, 0, 104, 16 ]
Open Valve 100%
dec: [ 1, 6, 0, 0, 39, 16, 147, 246 ]
Close Valve
dec: [ 1, 6, 0, 0, 0, 0, 137, 202 ]
CRC Calculation
A Cyclic Redundancy Check is a value at the end of a Modbus message that is calculated from the message and can be used to check that received message is uncorrupted.
The following function takes a buffer as an input. For example, in the Close Valve example above, the input is [ 1, 6, 0, 0, 0, 0 ] and the calculated crc value is [137, 202 ].
function crc16(buffer) { var crc = 0xFFFF; var odd; for (var i = 0; i < buffer.length; i++) { crc = crc ^ buffer[i]; for (var j = 0; j < 8; j++) { odd = crc & 0x0001; crc = crc >> 1; if (odd) { crc = crc ^ 0xA001; } } } crc = "0000" + crc.toString(16); crc = crc.substr(-4); return crc; }
FC3 Read Register Function
The following function can be used to read values using FC3 command.
It takes an input msg as follows:
msg.payload = { fc:6, address:1, register:1, rlength:1, targetv:5000 };
var address = msg.payload.address || msg.address ||8; var fc = msg.payload.fc || msg.fc || 3; var register = msg.payload.register || msg.register || 1; var rlength = msg.payload.rlength || msg.rlength || 1; var targetv = msg.targetv; register = register - 1; // offset var r1 = Math.floor(register / 256); var r2 = register % 256; if (fc != 3 && fc != 6) { return null; } if (fc == 3) { var tosend = String.fromCharCode(devAddress) + String.fromCharCode(3); tosend += String.fromCharCode(r1) + String.fromCharCode(r2); tosend += String.fromCharCode(0) + String.fromCharCode(rlength); var crcString = crc16(Buffer.from(tosend, 'ascii')); tosend += String.fromCharCode(parseInt(crcString.substr(2,2),16)) + String.fromCharCode(parseInt(crcString.substr(0,2),16))t; msg.payload = Buffer.from(tosend, 'ascii'); return msg; }
Control Modes
Modbus register 119 is used to set the control mode: 0: Analog 1: Modbus (see example commands).
Modbus Control
The valve setpoint is controlled through register 1.
Analogue Control
The valve setpoint is controlled through the analogue input connection using a 2-10v signal.
Analogue Hybrid Mode
Refers to analogue control with Modbus connected for additional functions.