Sensors Modbus Management/en: различия между версиями
(Новая страница: «|99||holding||RW||16|| 1 = 0.0625 C ||(available from firmware version 3.10.0) suspicious value Filter for 1-Wire sensors (85.000 C, 127.937 C). The values are di…») |
|||
(не показано 20 промежуточных версий 3 участников) | |||
Строка 168: | Строка 168: | ||
|0 | |0 | ||
|ppm (400-1500) | |ppm (400-1500) | ||
| | |Manual calibration of CO2 sensor. For calibration, write down here the current CO2 concentration measured by another instrument | ||
| - | | - | ||
| - | | - | ||
Строка 181: | Строка 181: | ||
|0xFF | |0xFF | ||
|days' | |days' | ||
| | |Cycle time for co sensor self-calibration algorithm (ABC) | ||
| - | | - | ||
| - | | - | ||
Строка 221: | Строка 221: | ||
|96||holding||R||2000 / 5000||ppm | |96||holding||R||2000 / 5000||ppm | ||
||(available from firmware version 3.5.0) CO2 concentration measurement Range. Valid values: 2000, 5000, 10000. | ||(available from firmware version 3.5.0) CO2 concentration measurement Range. Valid values: 2000, 5000, 10000. | ||
| - | | - | ||
| - | | - | ||
Строка 323: | Строка 265: | ||
|101 | |101 | ||
||input | ||input | ||
||R|||||| | ||R||||||Служебный регистр HOLD_REG_TH_READS | ||
|colspan="5"| | |colspan="5"|все | ||
| | | | ||
|- | |- | ||
Строка 345: | Строка 276: | ||
|102 | |102 | ||
||input | ||input | ||
||R|||||| | ||R||||||Служебный регистр HOLD_REG_TH_ERRORS | ||
|colspan="5"| | |colspan="5"|все | ||
| | | | ||
|- | |- | ||
|104-105 | |||
||input | |||
||R||||32-bit unsigned int||Время работы устройства (uptime counter) в секундах | |||
|colspan="5"|все | |||
| 104-105 || input || R|| || 32-bit unsigned int || uptime counter | |||
| | | | ||
|- | |- | ||
|106||input||R|| || | |106||input||R|| || | ||
|| | || Служебный регистр INPUT_REG_SGPC3_BASELINE | ||
| - | | - | ||
| - | | - | ||
Строка 378: | Строка 300: | ||
|107||input||R|| || | |107||input||R|| || | ||
|| | || Служебный регистр INPUT_REG_SGPC3_RAW_SIGNAL | ||
| - | | - | ||
| - | | - | ||
Строка 391: | Строка 313: | ||
|0xFFFF | |0xFFFF | ||
| | | | ||
| | |Служебный регистр SGPC3 VERSION | ||
| - | | - | ||
| - | | - | ||
Строка 401: | Строка 323: | ||
| 110 || holding || RW|| 96 || baud rate / 100 || RS-485 | | 110 || holding || RW || 96 || baud rate / 100 || скорость порта RS-485, '''делённая на 100'''. Допустимые скорости: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 <br>([[UART_Communication_Settings|Настройка параметров обмена данными по RS-485 для modbus-устройств Wiren Board]]) | ||
|colspan="5"| | |colspan="5"|все | ||
| rowspan="3" |>3.1.0 | | rowspan="3" |>3.1.0 | ||
|- | |- | ||
| 111 || holding || RW|| 0 || || | | 111 || holding || RW || 0 || || настройка бита чётности порта RS-485. Допустимые значения: 0 - нет бита чётности (none), 1 - нечётный (odd), 2 - чётный (even) | ||
|colspan="5"| | |colspan="5"|все | ||
|- | |- | ||
| 112 || holding || RW|| 2 || || | | 112 || holding || RW || 2 || || количество стоп-битов порта RS-485. Допустимые значения: 1, 2 | ||
|colspan="5"| | |colspan="5"|все | ||
|- | |- | ||
| 120 (0x78) || holding || RW|| 0 || | | 120 (0x78) || holding || RW || 0 || отличное от 0 || запись в регистр вызывает перезагрузку модуля без сохранения состояния | ||
|colspan="5"| | |colspan="5"|все | ||
| | | | ||
|- | |- | ||
| 121 (0x79) || input || R || - || mV || | | 121 (0x79) || input || R || - || mV || текущее напряжение питания модуля | ||
|colspan="5"| | |colspan="5"|все | ||
| | | | ||
|- | |- | ||
| 128 (0x80) || holding || RW|| 1 || || Modbus | | 128 (0x80) || holding || RW || 1 || || Modbus-адрес устройства | ||
|colspan="5"| | |colspan="5"|все | ||
| | | | ||
|- | |- | ||
| 129 (0x81) || holding || RW|| 0 || 0 | | 129 (0x81) || holding || RW || 0 || 0 или 1 || Переход в [[WB-MCU-Flasher|режим загрузчика]] | ||
|colspan="5"| | |colspan="5"|все || 4.5.0 | ||
|- | |- | ||
| 200-206 || input || R || | | 200-206 || input || R || см. [[#Сигнатура устройства|Сигнатура устройства]] || || сигнатура | ||
|colspan="5"| | |colspan="5"|все | ||
| | | | ||
|- | |- | ||
| 220-241 || input || R | | | | | | 220-241 || input || R || || __date__ __time__|| дата сборки прошивки | ||
|colspan="5"| | |colspan="5"|все | ||
| | | | ||
|- | |- | ||
Строка 439: | Строка 361: | ||
|0 | |0 | ||
|°C × 100 (signed) | |°C × 100 (signed) | ||
| | |Температурная компенсация самонагрева для датчика температуры и влажности (значение вычитается из измереной температуры) | ||
| + | | + | ||
| - | | - | ||
Строка 447: | Строка 369: | ||
|4.2 | |4.2 | ||
|- | |- | ||
| 250-269 || input || R | | | | | 250-269 || input || R || || строка, null-terminated || версия прошивки | ||
|colspan="5"| | |colspan="5"|все | ||
| | | | ||
|- | |- | ||
| 270-271 || input || R|| || 32-bit unsigned int || | | 270-271 || input || R || || 32-bit unsigned int || уникальный идентификатор (S/N) | ||
|colspan="5"| | |colspan="5"|все | ||
| | | | ||
|- | |- | ||
|280||input||R|| || | |280||input||R|| || | ||
|| | ||Максимальное значение датчика движения с АЦП | ||
| - | | - | ||
| - | | - | ||
Строка 465: | Строка 387: | ||
|- | |- | ||
|281||input||R|| || | |281||input||R|| || | ||
|| | ||Значение датчика движения с АЦП | ||
| - | | - | ||
| - | | - | ||
Строка 473: | Строка 395: | ||
| | | | ||
|- | |- | ||
|282||holding||RW||10|| | |282||holding||RW||10||с | ||
|| | ||Ширина временного окна для вычисления максимального усредненного значения датчика движения (от 1 до 60 секунд) | ||
| - | | - | ||
| - | | - | ||
Строка 483: | Строка 405: | ||
|- | |- | ||
|283||input||R|| || | |283||input||R|| || | ||
|| | ||Текущее усредненное значение движения в условных единицах | ||
| - | | - | ||
| - | | - | ||
Строка 494: | Строка 416: | ||
|} | |} | ||
===Coils=== | ===Карта регистров флагов (Coils)=== | ||
Регистры, связанные с ИК-управлением, описаны в статье [[WB-MSx_Consumer_IR_Manual]]. | |||
{| border="1" class="wikitable" style="text-align:center" | {| border="1" class="wikitable" style="text-align:center" | ||
! | !Начальный адрес || Количество || Назначение || В модификациях | ||
! | !С версии прошивки | ||
|- | |- | ||
| 0 || 1 || style="text-align:left" | | | 0 || 1 || style="text-align:left" |Включение пищалки (buzzer) || WB-MSW2, WB-MSW v.3 | ||
| | | | ||
|- | |- | ||
| 1 || 1 || style="text-align:left" | | | 1 || 1 || style="text-align:left" | Принудительная калибровка встроенного датчика CO2. Включать после 20 минут работы при уровне CO2, равном 400 ppm || WB-MSW2 | ||
| | | | ||
|- | |- | ||
| 2 || 1 || style="text-align:left" | | | 2 || 1 || style="text-align:left" | Включение подогрева (heater) в микросхеме сенсора температуры и влажности HDC1080 || WB-MS (в серии 2017 г.), WB-MSW2, WB-MSW v.3 | ||
|3.2.0 | |3.2.0 | ||
|- | |- | ||
|3 | |3 | ||
|1 | |1 | ||
| | |Включение датчика CO2 | ||
|WB-MSW | |WB-MSW v.3 | ||
|4.1.0 | |4.1.0 | ||
|- | |- | ||
| 10 || 1 || style="text-align:left" | | | 10 || 1 || style="text-align:left" | Включение зеленого светодиода || WB-MSW v.3 | ||
| | | | ||
|- | |- | ||
| 11 || 1 || style="text-align:left" | | | 11 || 1 || style="text-align:left" | Включение красного светодиода || WB-MSW v.3 | ||
| | | | ||
|- | |- | ||
|} | |} | ||
== | ===Сигнатура устройства === | ||
По адресу 200 хранится сигнатура модуля длиной 6 байт. Сигнатура уникальна для каждой модели устройств Wiren Board и позволяет идентифицировать модель по Modbus: | |||
{| class="wikitable" | {| class="wikitable" | ||
! style="font-weight: bold;" | | ! style="font-weight: bold;" | Модуль | ||
! style="font-weight: bold;" | | ! style="font-weight: bold;" | Сигнатура | ||
|- | |- | ||
| WB-MS | | WB-MS | ||
Строка 545: | Строка 467: | ||
|} | |} | ||
Для получения сигнатуры устройства нужно выполнить команду READ_HOLDING_REGISTERS по адресу 200 (длина 6 регистров). Запись в эту область памяти не поддерживается, при попытке записи в недопустимое место возвращается ошибка 3. Пустые места в тексте сигнатуры забиваются значением 0x00. | |||
Начиная с регистра 220 записана дата сборки прошивки, в формате "число'''x00'''время'''x00'''" в виде строки (пример: 'Jan 27 2017 17:01:13'). Длина записи — 21 регистр. | |||
== | == Управление модулем из командной строки == | ||
Программное обеспечение контроллера Wiren Board включает в себя утилиту modbus_client для работы с устройствами, подключенными к выходам RS-485, по протоколу Modbus, подробное описание команды находится на странице [[Modbus-client]]. Доступ к командной строке описан в статье [[SSH]]. | |||
=== | === Пример чтения регистров === | ||
Проверим, верно ли, что мы подключились именно к модулю нужного типа. (Модуль wb-mqtt-serial должен быть предварительно остановлен). По адресу 200 хранится уникальная сигнатура длиной в 6 регистров. Прочтем 6 регистров, начиная с адреса 200, и преобразуем полученный шестнадцатеричный ответ в символьную строку: | |||
<syntaxhighlight lang="bash">echo -e `modbus_client --debug -mrtu -pnone -s2 /dev/ | <syntaxhighlight lang="bash">echo -e `modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 \ | ||
-a1 -t0x03 -r200 -c 6 | \ | -a1 -t0x03 -r200 -c 6 | \ | ||
grep Data | sed -e 's/0x00/\\\x/g' -e 's/Data://' -e 's/\s//g'` </syntaxhighlight> | grep Data | sed -e 's/0x00/\\\x/g' -e 's/Data://' -e 's/\s//g'` </syntaxhighlight> | ||
В результате выполнения команды получаем строку, например '''WBMS'''. Модуль WB-MS в примере имеет Modbus-адрес 1. |
Версия 10:41, 19 июля 2019
Modbus parameters
Modbus address
Modbus-the address of the Wiren Board devices is easy to determine — it is printed on the sticker (the address is in decimal format). The new address of the device is written by the command WRITE_SINGLE_REGISTER to the storage register (holding register) with the address 128 (0x80). For details on how to determine (if the address has been changed) or change the Modbus address of the module, see Define and change the Modbus address of Wirenboard devices.
Modbus commands supported by the device
The Wirenboard sensors support all major Modbus commands. Read more here: Register reading and writing function codes.
Holding Registers
Register/ address | Type | Read/ write | default or error Value | Format | Purpose | Supported in | From version
insertions | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
WB-MS (model code) | WB-MS v2 (model code) | WB-MSW | WB-MSW2 | WB-MSW V. 3 | |||||||
0 | input | R | 0x7FFF | °C × 10 (signed) | Temperature with built-in sensor | T | - | - | + | + | |
1 | input | R |
|
relative humidity with built-in sensor | H | - | + | + | + | ||
2 | input | R | - | LC | "(register is not used in WB-MSW sensors, registers 9 and 10 instead)" Illumination from built-in sensor |
L | Lux | - | - | - | |
3 | input | R | - | dB × 100 | Noise level multiplied by 100 | S | - | + | S | S | |
4 | input | R | 0x7FFF | °C × 100 (signed) | Temperature with built-in sensor | + | + | - | - | + | 4.2 |
5 | input | R | - | %RH × 100 (signed) | Relative humidity with built-in sensor | + | + | - | - | + | 4.2 |
6 | input | R | 0x7FFF | °C × 16 (signed) | Temperature from external sensor | D | + | - | - | - | |
7 | input | R | 0x7FFF | °C × 16 (signed) | Temperature from external sensor | D | + | - | - | - | |
8 | input | R | 0xFFFF | PPM | CO2 concentration | - | - | After | C | ||
9-10 | input | R | LC | The illumination, multiplied by 100 (9 - high-order, 10 — LSB luminance values) | - | - | + | L | |||
11 | input | R | 0xFFFF | PPM | Air quality | - | VOC | - | - | + | |
88 | holding | RW | 0 | ppm (400-1500) | Manual calibration of CO2 sensor. For calibration, write down here the current CO2 concentration measured by another instrument | - | - | - | C | C | 3.12 |
89 | holding | RW | 0xFF | days' | Cycle time for co sensor self-calibration algorithm (ABC) | - | - | - | C | C | 3.12 |
90 | holding | RW | 20 (200 ms) | × 10 ms | light averaging Time |
|
- | - | - | - | |
91 | holding | RW | 20 (200 ms) | × 10 ms | Noise averaging time | S | - | + | S | S | |
95 | holding | RW | 1 | 1 or 0 | CO2 sensor (ABC) auto-calibration to atmospheric CO2 | - | - | - | After | C | |
96 | holding | R | 2000 / 5000 | ppm | (available from firmware version 3.5.0) CO2 concentration measurement Range. Valid values: 2000, 5000, 10000. | - | - | - | C | C | 3.5.0 |
97 | holding | RW | 0 — 10 | c | Period between flashes of signal LEDs | - | - | - | - | + | 3.13.0 |
98 | holding | RW | 0 — 50 | MS | Led flash duration | - | - | - | - | + | 3.13.0 |
99 | holding | RW | 16 | 1 = 0.0625 C | (available from firmware version 3.10.0) suspicious value Filter for 1-Wire sensors (85.000 C, 127.937 C). The values are discarded if the previous value differs from the suspicious value by more than * 0.0625 C. Write 0 to disable the filter. | D | + | - | - | - | 3.10.0 |
101 | input | R | Служебный регистр HOLD_REG_TH_READS | все | |||||||
102 | input | R | Служебный регистр HOLD_REG_TH_ERRORS | все | |||||||
104-105 | input | R | 32-bit unsigned int | Время работы устройства (uptime counter) в секундах | все | ||||||
106 | input | R | Служебный регистр INPUT_REG_SGPC3_BASELINE | - | - | - | - | + | |||
107 | input | R | Служебный регистр INPUT_REG_SGPC3_RAW_SIGNAL | - | - | - | - | + | |||
108 | input | R | 0xFFFF | Служебный регистр SGPC3 VERSION | - | - | - | - | + | 4.2 | |
110 | holding | RW | 96 | baud rate / 100 | скорость порта RS-485, делённая на 100. Допустимые скорости: 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 (Настройка параметров обмена данными по RS-485 для modbus-устройств Wiren Board) |
все | >3.1.0 | ||||
111 | holding | RW | 0 | настройка бита чётности порта RS-485. Допустимые значения: 0 - нет бита чётности (none), 1 - нечётный (odd), 2 - чётный (even) | все | ||||||
112 | holding | RW | 2 | количество стоп-битов порта RS-485. Допустимые значения: 1, 2 | все | ||||||
120 (0x78) | holding | RW | 0 | отличное от 0 | запись в регистр вызывает перезагрузку модуля без сохранения состояния | все | |||||
121 (0x79) | input | R | - | mV | текущее напряжение питания модуля | все | |||||
128 (0x80) | holding | RW | 1 | Modbus-адрес устройства | все | ||||||
129 (0x81) | holding | RW | 0 | 0 или 1 | Переход в режим загрузчика | все | 4.5.0 | ||||
200-206 | input | R | см. Сигнатура устройства | сигнатура | все | ||||||
220-241 | input | R | __date__ __time__ | дата сборки прошивки | все | ||||||
245 | holding | RW | 0 | °C × 100 (signed) | Температурная компенсация самонагрева для датчика температуры и влажности (значение вычитается из измереной температуры) | + | - | - | - | + | 4.2 |
250-269 | input | R | строка, null-terminated | версия прошивки | все | ||||||
270-271 | input | R | 32-bit unsigned int | уникальный идентификатор (S/N) | все | ||||||
280 | input | R | Максимальное значение датчика движения с АЦП | - | - | - | - | + | |||
281 | input | R | Значение датчика движения с АЦП | - | - | - | - | + | |||
282 | holding | RW | 10 | с | Ширина временного окна для вычисления максимального усредненного значения датчика движения (от 1 до 60 секунд) | - | - | - | - | + | |
283 | input | R | Текущее усредненное значение движения в условных единицах | - | - | - | - | + |
Карта регистров флагов (Coils)
Регистры, связанные с ИК-управлением, описаны в статье WB-MSx_Consumer_IR_Manual.
Начальный адрес | Количество | Назначение | В модификациях | С версии прошивки |
---|---|---|---|---|
0 | 1 | Включение пищалки (buzzer) | WB-MSW2, WB-MSW v.3 | |
1 | 1 | Принудительная калибровка встроенного датчика CO2. Включать после 20 минут работы при уровне CO2, равном 400 ppm | WB-MSW2 | |
2 | 1 | Включение подогрева (heater) в микросхеме сенсора температуры и влажности HDC1080 | WB-MS (в серии 2017 г.), WB-MSW2, WB-MSW v.3 | 3.2.0 |
3 | 1 | Включение датчика CO2 | WB-MSW v.3 | 4.1.0 |
10 | 1 | Включение зеленого светодиода | WB-MSW v.3 | |
11 | 1 | Включение красного светодиода | WB-MSW v.3 |
Сигнатура устройства
По адресу 200 хранится сигнатура модуля длиной 6 байт. Сигнатура уникальна для каждой модели устройств Wiren Board и позволяет идентифицировать модель по Modbus:
Модуль | Сигнатура |
---|---|
WB-MS | WBMS,'0x00','0x00' |
WB-MSW | WBMSW,'0x00' |
WB-MSW2 | WBMSW2 |
WB-MSW v.3 | WBMSW3 |
Для получения сигнатуры устройства нужно выполнить команду READ_HOLDING_REGISTERS по адресу 200 (длина 6 регистров). Запись в эту область памяти не поддерживается, при попытке записи в недопустимое место возвращается ошибка 3. Пустые места в тексте сигнатуры забиваются значением 0x00. Начиная с регистра 220 записана дата сборки прошивки, в формате "числоx00времяx00" в виде строки (пример: 'Jan 27 2017 17:01:13'). Длина записи — 21 регистр.
Управление модулем из командной строки
Программное обеспечение контроллера Wiren Board включает в себя утилиту modbus_client для работы с устройствами, подключенными к выходам RS-485, по протоколу Modbus, подробное описание команды находится на странице Modbus-client. Доступ к командной строке описан в статье SSH.
Пример чтения регистров
Проверим, верно ли, что мы подключились именно к модулю нужного типа. (Модуль wb-mqtt-serial должен быть предварительно остановлен). По адресу 200 хранится уникальная сигнатура длиной в 6 регистров. Прочтем 6 регистров, начиная с адреса 200, и преобразуем полученный шестнадцатеричный ответ в символьную строку:
echo -e `modbus_client --debug -mrtu -pnone -s2 /dev/ttyAPP1 \
-a1 -t0x03 -r200 -c 6 | \
grep Data | sed -e 's/0x00/\\\x/g' -e 's/Data://' -e 's/\s//g'`
В результате выполнения команды получаем строку, например WBMS. Модуль WB-MS в примере имеет Modbus-адрес 1.