R240 Modbus TCP – technical specification
Connection: TCP port 502, Unit ID 1. Addresses are zero-based Holding
Register addresses. Supported functions: 0x03, 0x06, 0x10.
What can you do with Modbus TCP?
Modbus TCP lets an automation system, such as a PLC or operator panel, control the R240 bridge. Instead of pressing buttons in the web panel, software reads and writes values at specific addresses. You can switch lighting on and off, change brightness and colors, recall presets and configure the schedule.
Each register stores one 16-bit number, from 0 to 65535. Individual parameters have narrower ranges, shown in the tables. Reading checks a setting; writing changes it. Colors and some counters occupy two registers.
How to configure the connection
In your control software, enter the R240 bridge’s IP address, port 502 and device identifier (Unit ID) 1. The computer or automation controller must be able to reach the bridge over the network. Select Holding Registers as the register type.
All addresses below start at zero. For example, zone 3 brightness is at address 301. Do not automatically add 40001; if your software uses 4xxxx notation or numbering that starts at one, configure its addressing accordingly.
In the Access column, Read only means you can check a value but cannot change it. Read and write lets you check and set a value. Write command performs an action when written; it is not a readable state value.
Device and global control
| Address | Parameter | Access | Meaning and use |
|---|---|---|---|
| 0 | Register map version (API_VERSION) |
Read only | Value 2 identifies the register map described here. Use it to check that the control software uses the correct documentation. |
| 1 | Device type (DEVICE_TYPE) |
Read only | Value 2 identifies an R240 bridge. This is a model identifier, not the number of connected controllers. |
| 2 | Connection status (STATUS) |
Read only | Shows whether the bridge is ready for communication. Value 3 means the bridge has an IP address and its Modbus server is running. Other states are described below. |
| 3-4 | Request counter (REQUEST_COUNTER) |
Read only | A counter useful for checking whether requests reach the bridge. It occupies two registers: address 3 holds the low 16 bits and 4 the high 16 bits. Result = value at address 3 + 65536 × value at address 4. |
| 10 | Switch all lighting on or off (MASTER_POWER) |
Read and write | Write 0 to switch all lighting off or 1 to switch it on. The command applies to all zones. |
| 11 | Toggle all lighting (MASTER_TOGGLE) |
Write command | Every write switches the lighting to the opposite state. The number written does not matter. Another write toggles it again. |
| 12 | Recall saved settings (LOAD_PRESET) |
Write command | Write a preset number from 1..12 to recall the lighting settings stored there. For example, writing 4 recalls preset 4. |
| 13 | Save settings to a preset (SAVE_PRESET) |
Write command | Write a preset number from 1..12 to store the current settings of all zones. This replaces the previous contents of that preset. |
| 14 | Number of zones (ZONE_COUNT) |
Read only | Returns 24, the number of zones available in the R240 register map. This does not mean that every zone has a physical controller assigned. |
| 15 | Sunrise and sunset control (SUN_TIMER) |
Read and write | Write 1 to enable this feature or 0 to disable it. When enabled, the bridge switches lighting off at sunrise and on at sunset using its built-in timetable. The bridge clock must be set. |
| 16 | Last schedule entry triggered (SCHEDULE_CURRENT) |
Read only | The last schedule entry triggered, from 1..12. Value 0 means none has been triggered yet. This is not the number of the next scheduled entry. |
STATUS values are: 0 — starting, 1 — no Wi-Fi connection, 2 — Wi-Fi
connected and waiting for an IP address, 3 — READY (an IP address is
available and the Modbus TCP server is running). During normal communication,
register 2 returns 3.
Registers 11–13 are write-only commands. Do not include them in an 0x03
read: such a read intentionally returns a Modbus exception.
Zones
Each of the 24 zones has its own address block. To find a parameter address, multiply the zone number by 100 and add the offset from the first table column. For zone 3 brightness (offset 01), this gives 3 × 100 + 1 = 301. The address itself selects the zone, so no separate zone-selection command is needed.
Reserved addresses not listed in the table are unavailable. Do not read an entire block of 100 registers in one request. Available parameters occupy offsets 00..26. Not every controller or effect uses every parameter: for example, a static effect may not respond to animation speed.
Zone n occupies 100*n .. 100*n+99; for example zone 3 is 300..399.
A write automatically selects that zone so STM32 applies the change immediately.
| Offset | Parameter | Access | Meaning and use |
|---|---|---|---|
| 00 | Zone power (POWER) |
Read and write | Write 0 to switch lighting in this zone off or 1 to switch it on. |
| 01 | Brightness (BRIGHTNESS) |
Read and write | Range 0..127: 0 is the lowest brightness and 127 the highest. This is the device scale, not a percentage. For example, 64 is about halfway through the range. |
| 02 | Animation speed (EFFECT_SPEED) |
Read and write | A value from 0..5 controls the speed of an animated effect. Its visible result depends on the selected effect; a static effect may not respond. |
| 03 | Color mode (COLOR_MODE) |
Read and write | 1 – one color; 2 – white light; 3 – two colors; 4 – multicolor mode; 5 – automatic color change. Writing 2 sets all three colors to white (#FFFFFF). The visible result depends on the controller and effect. |
| 04 | White color temperature (WHITE_TEMPERATURE) |
Read and write | Range 0..127 corresponds to the white temperature slider in the web panel. This is a controller scale, not a temperature in kelvin. Use it with lighting and controllers that support adjustable white light. |
| 05 | Color saturation (SATURATION) |
Read and write | Range 0..127: lower values reduce saturation and higher values produce a stronger color. The result depends on the color mode and selected effect. |
| 06 | Rolling effect selection (ROLL_EFFECT) |
Read and write | The rolling effect number for controllers that support this feature. Available choices depend on the controller model; there is no single list shared by all devices. |
| 07 | Time between effects (EFFECT_CHANGE_TIME) |
Read and write | Sets the interval before moving to the next effect when several effects are selected. It corresponds to the effect-change setting in the web panel; it does not set animation speed. |
| 08-09 | First color (COLOR1) |
Read and write | The first color used by an effect. It occupies two registers: high part (HI), then low part (LO). RGB encoding is explained below. |
| 10-11 | Second color (COLOR2) |
Read and write | The second color, used by effects that support multiple colors. Two registers in HI, LO order, as for the first color. |
| 12-13 | Third color (COLOR3) |
Read and write | The third color, if supported by the selected effect. Two registers in HI, LO order. |
| 14-21 | Set of selected effects (SCENES_0..3) |
Read and write | Allows several effects to be selected at once. Four 32-bit numbers store the selection of up to 128 effects. Each number occupies two registers, HI first and then LO. Writing this field does not change other zone parameters. |
| 22 | Select one effect (SCENE) |
Read and write | Write an effect number from 0..127. This selects only that effect and clears the other selections. Reading returns the first selected effect, not the complete set. Available effects depend on the controller model. |
| 23 | Controller type in the zone (CONTROLLER_TYPE) |
Read only | Identifies the controller model assigned to the zone. It helps identify available capabilities and cannot be changed through Modbus. 0 means unknown. |
| 24-26 | Hue of each color (COLOR1_HUE..COLOR3_HUE) |
Read and write | Three separate registers for the hues of colors 1, 2 and 3, each from 0..255. Hue is a position on the color wheel, not brightness or a full RGB value. The result depends on the controller and effect. |
How to encode a color and select several effects
In 0x00RRGGBB, RR, GG and BB represent the amounts of red, green and blue. Each component ranges from 00..FF (0 to 255). A number starting with 0x is hexadecimal; some control applications expect decimal numbers instead.
Red is 0x00FF0000. For zone 1, write 255 to address 108 and 0 to address 109, preferably in one request that writes both registers. These are the same values as 0x00FF and 0x0000. To combine a read pair, calculate color = first value × 65536 + second value. Color is only one effect setting; the appearance also depends on color mode, brightness and the selected effect.
For a single effect, use SCENE. Use SCENES_0..3 to select several: each bit acts as a separate selection flag. The first number covers effects 0..31, the second 32..63, the third 64..95 and the fourth 96..127. In each number, bit 0 represents the first effect in that range. For example, effects 0 and 2 give 1 + 4 = 5 in the first number. For zone 1, write 0, 5, 0, 0, 0, 0, 0, 0 starting at address 114. This selects those two effects and clears the other selections. Available effects depend on the controller.
Schedule
The schedule recalls previously saved lighting settings at a chosen time every day. First save the required lighting settings to a preset, then set the time and enable its matching schedule entry. The bridge clock must be set correctly. The same entries are available in the web panel.
Each block has 10 addresses, but only the first four are used: enabled, hour, minute and preset number. The other six are reserved and cannot be read or written. The preset number is fixed and read-only.
Schedule entry n loads preset n and has a block of 10 addresses.
Its starting address is 2500 + 10 * (n - 1), where n = 1..12:
entry 1 is 2500..2509, entry 2 is 2510..2519, entry 12 is
2610..2619. Offsets 04..09 are reserved for future use and are currently
unavailable.
| Offset | Parameter | Access | Meaning and use |
|---|---|---|---|
| 00 | Enable this entry (ENABLED) |
Read and write | 1 enables daily triggering of this entry and 0 disables it. Disabling an entry does not erase its configured time. |
| 01 | Trigger hour (HOUR) |
Read and write | Hour from 0..23, using the 24-hour clock. For example, 18 means 6 pm and 0 means midnight. |
| 02 | Trigger minute (MINUTE) |
Read and write | Minute from 0..59. Together with the hour it sets when the preset is recalled; hour 18 and minute 30 mean 18:30. |
| 03 | Preset to recall (PRESET) |
Read only | Read-only preset number from 1..12. Entry 1 always recalls preset 1, entry 2 recalls preset 2, and so on. You cannot assign a different preset here. |
Example: to load preset 3 daily at 18:30, write 1 to 2520, 18 to
2521 and 30 to 2522.
Reading and writing
RO means read-only, R/W read/write, and WO write-only.
Function 0x03 reads registers, 0x06 writes one register,
and 0x10 writes multiple consecutive registers.
Do not include unsupported addresses or registers with incompatible access in a request.
For schedules, write only offsets 00..02; offset 03 is read-only.
Unsupported addresses return a Modbus exception. Follow the value ranges in the tables.
Examples
| Purpose | Function | Zero-based address | Register count / values |
|---|---|---|---|
| Check device readiness | 0x03 |
2 |
read 1 register; 3 means READY |
| Read zone 3 brightness | 0x03 |
301 |
read 1 register |
| Switch zone 1 on | 0x06 |
100 |
write 1 |
| Set zone 3 brightness | 0x06 |
301 |
write 80 |
| Select effect 5 in zone 1 | 0x06 |
122 |
write 5 |
| Set zone 1 color 1 to red | 0x10 |
108 |
write 0x00FF, 0x0000 in that order |
| Save the current state to preset 4 | 0x06 |
13 |
write 4 |
| Load preset 4 | 0x06 |
12 |
write 4 |
| Load preset 3 daily at 18:30 | 0x10 |
2520 |
write 1, 18, 30 in that order |
| Read schedule entry 3 | 0x03 |
2520 |
read 4 registers: enabled, hour, minute, preset |
Colors use 0x00RRGGBB and occupy two registers: HI first, then LO.
Example: red 0x00FF0000 splits into 0x00FF and 0x0000.
The request counter at addresses 3..4 uses a different order: low word first.