In this tutorial we will show how to use DOMIQ modules to integrate with any devices using RS-232 transmission protocol.
Serial-2SG has built-in RS-232 transmission protocol. Following speeds are supported: 9600, 19200, 38400 and 57600 bps and frame formats: 8N1, 8N2, 8E1, 8O1. It is possible to connect up to two DOMIQ/Serial-2SG modules to one Base module.
Typically Serial-2SG modules have assigned address 1. If you plan to connect two Serial-2SG modules to the Base module, please let us know. The second Serial-2SG module will have assigned address 2.
In further part of this tutorial we will describe the integration process of DOMIQ system and devices that use RS-232 transmission protocol on the example of NuVo multiroom audio system. By reading this manual you will learn how to:
- Use DOMIQ modules to send and receive RS-232 messages.
- Integrate multiroom audio system with home automation.
- Process the data read by the Serial-2SG module.
- Control multiroom audio system with Display visualization.
1. Multiroom NuVo #
Multiroom system is an advanced audio system that allows to play audio such as: radio stations and mp3 in several zones simultaneously. Each zone can play sound from any available audio source. The set loaned to us for testing consisted of the following devices:
- NuVo Concerto – Audio aplifier. Supports up to 8 zones.
- NuVo NV-T2SIR/FAM – A device with two built-in radio tuners. Allows to listen to radio as two independent audio streams.
- NuVo MPS4 – MP3 files server with four built-in independent audio sources. It has 4 built-in independent audio signal sources. If the device has connection to the Internet, it is possible to play Internet radio stations. Each source can play different audio files or radio stations. Also if NuVo MPS4 is connected to local network, it is possible to control it using TCP/IP protocol.
- NuVo NV-I8GCP – Wall mounted touch panels, allows to control NuVo devices (change
settings, choose audio source, volume control, browsing mp3 etc.)
2. Connections #

For connections marked as RS-232 standard RS-232 cable with DB-9 connectors is used. This wiring diagram shows only simplified connection of devices. NuVo devices must be connected according to the relevant manufacturer’s installation manuals.
3. DOMIQ modules configuration #
3.1. DOMIQ/Serial-2SG configuration #
Serial-2SG module is configured by setting RS-232 transmission parameters. Following configuration command is used:
LC.SER.config.<adres modułu>=<prędkość> <format>
Example
LC.SER.config.1=38400 8N1
Serial-2SG module supports RS-232 transmission protocol at speeds of: 9600, 19200, 38400 and 57600 bps and frame formats: 8N1, 8N2, 8E1, 8O1.
Transmission parameters have to be set each time the Base module is restarted. You can achieve that by using the Logic tab and placing there a single line of code with the following syntax:
command("LC.SER.config.<adres>=<prędkość> <format>")
completing the command with the appropriate parameters. This command will be sent each time the Base module or Serial-2SG module is started.
3.2. Control commands #
NuVo multiroom system is fully configurable. With descriptions of NuVo communication protocols and DOMIQ modules you can control all available functions offered by the multiroom audio system, such as: on/off for each zone, changing the signal source, control volume, tuning radio tuners, display RDS information etc. and integrate multiroom audio system with home automation.
Two commands are used:
- Sending commands
LC.SER.line.<adres modułu>=<polecenie>
Example:LC.SER.line.1=*Z1ON– turning on of the first zone. - Receiving commands:
LE.SER.line.<adres modułu>=<polecenie>
if the NuVo MPS4 music server is connected to the Ethernet, it is possible to control it using TCP/IP protocol. Following command is used:
C.TCP.send.<adres IP serwera muzycznego:port>=<polecenie>
Example: C.TCP.send.192.168.10.182:5004=PlayPause – simulation of pressing Play/Pause button.
Full list of available commands can be found in description of communication protocol.
Control command can be send as:
- Result of pressing a button.
- Result of an event.
- Result of a timer.
- Element of logical function.
4. Integration #
DOMIQ/Serial-2SG allows for full, bidirectional integration of NuVo multiroom audio system with home automation system. Following are few examples of such integration.
4.1. Music Alarm Clock #
Using Timers and Logic combined with the multiroom system allows you to define an music alarm clock. The automation system will run the multiroom system in selected zones at a specific time, play the favourite music or radio station and set the volume to a specific value. The definition of such alarm clock is a two-step process. The first step is a definition of logical rules. In the second step you will have to set a timer.
4.1.1. Defining Logical Rules #
- Choose Logic tab in the DOMIQ/Base Configurator.
- Choose Logic tab in the DOMIQ/Base Configurator.
function budzik()
command("LC.SER.line.1=*Z1ON\r*Z1SRC5\r*Z1VOL50")
command("LC.SER.line.2=*T'A'FM98.8")
command("LC.SER.line.1=*Z2ON\r*Z2SRC6\r*Z2VOL45")
command("LC.SER.line.2=*T'B'FM103.0")
command("LC.SER.line.1=*Z3ON\r*Z3SRC1\r*Z3VOL45")
command("C.TCP.send.<adres IP >=PlayPlaylist <nazwa> True")
end
A few words of explanation for the presented code:
Clock function is a set of commands sent to the NuVo devices. The first command is sent to the amplifier. It turns the first zone on, assigns source 5 to the zone and sets the volume to 50. The second command is sent to the first radio tuner. It sets tuner frequency to 101.0 MHz. Later we configure zones 2 and 3 in similar fashion to zone 1. The last command is sent to the music server using TCP/IP protocol. PlayPlaylist
command runs the playlist with the given name. This function can be freely modified to play sound in other zones or from another source.
4.1.2. Timer Definition #
In the desribed example, timer will be triggered from Monday to Friday at 7.00am.
- Choose the Timers tab.
- Click on the Add button, to add new timer.
- Fill Hour, Minute and Weekday fields to define when the timer will be triggered.
- In the Actions box click on the Add Channel… button.
- In the window that appears, in the Name field type:
C.LOGICand in the Value field enter the function name, in this casebudzik().

This will invoke the alarm function and execute all instructions contained within it. The function can be modified at any time to play sound in a different zone or from a different signal source.

5. Parsing messages #
DOMIQ/Serial-2SG module buffers the data until the carriage return marker is received. Structure of the data depends on the device to which you connect.
In order to display the data in a form readable for user, it is necessary to perform parsing. We provide as an example configurable parser object designed to work in Logic environment. In order to use the parser, you need to upload the parser.lua file to your Base module (Resources tab, Scripts section). The contents of the parser.lua file is added as an appendix to this tutorial, and is provided as download on DOMIQ tutorial page.
Parser source code is universal and can be used to parse any messages. The parser compares the received messages with matching patterns. If the message match with the pattern, then parser calls one of the defined function that processes the received data.
import 'parser'
p = parser()
p:add("ADD(%d)",function(n) print(n+1) end)
p:add("SUB(%d)",function(n) print(n-1) end)
p:parse("ADD1")
p:parse("SUB2")
In the result program will print:2
1
More practical approach is to store data in Base state. It allows to display data on the Display visualizations or in the Remote application menu. In further part of this chapter you can read about using parser to display RDS messages on Display visualization.
You can read more about matching patterns in the “Lua Reference Manual”, chapter 5.4.1 at: http://www.lua.org/manual/5.1/ http://www.lua.org/manual/5.1/
Later in this chapter we will present an example use of the parser to display RDS information from the NuVo radio tuner on Display visualizations.
5.1. Parsing RDS messages #
RDS messages are sent using #SsDISPLINE command, where s is a number of a signal source. In order to display RDS messages, paste the following source code to the Logic tab:
import 'parser'
function nuvo(tab)
local dev = {}
local zones = {}
local tun = assert(tab.tun)
local amp = assert(tab.amp)
local pamp = parser()
local ptun = parser()
-- Parsowanie komunikatów z tunera
function tun:onchange(data)
print("TUN: "..data)
ptun:parse(data)
end
-- Parsowanie komunikatów ze wzmacniacza
function amp:onchange(data)
print("AMP: "..data)
pamp:parse(data)
end
-- Parsowanie komunikatów wyświetlania)
pamp:add([[#S(%d)DISPLINE(%d),"([^"]+)"]],function(s,l,txt)
local sid = tonumber(s)
for k,v in pairs(zones) do
if v == sid then set("NUVO.line."..k.."."..l,txt)
end
end
-- Parsowanie komunikatów o statusie poszczególnych stref
pamp:add([[#Z(%d),ON,SRC(%d),VOL(%d+),DND(%d),LOCK(%d)]],
function(z,src,vol,dnd,lock)
local prefix="NUVO."..z.."."
set(prefix.."vol",vol)
set(prefix.."src",src)
set(prefix.."act",1)
zones[tonumber(z)] = tonumber(src)
print ("SRC"..src)
end)
-- To samo, ale jak strefa jest wyłączona
pamp:add([[#Z(%d),OFF]],function(z)
set("NUVO."..z..".act",0)
end)
--
-- TU WSTAW KOD ŹRÓDŁOWY PRZEDSTAWIONY W ROZDZIALE 6.
--
return dev
end
-- Inicjalizacja powyższego sterownika.
-- Jako parametry przekazujemy obiekty od dwu modułów SG
n = nuvo {tun = use 'SER.line.1', amp = use 'SER.line.2'}
A few words of explanation for the presented code:
Presented source code shows is a typical design pattern used in programming in Lua, called creating an object. The idea of this pattern is to hide all the variables defined local in the function body, allowing you to create multiple instace of the code (e.g. support several NuVo multiroom systems), or use parsers for other purposes.
After entering this code, you can proceed to create the visualization screen, where the RDS messages will be displayed:
- Choose the Display tab.
- Add a new Screen, enter the ID and choose the background image.
- Add a Text element.
- In the Channel field enter:
NUVO.line.<numer strefy muzycznej>.<numer linii>.
Example:NUVO.line.2.3– displays line No.3 of the zone No.2. The number of lines of information and the lines numbering vary depending on the radio station. NuVo multiroom system allows to display up to 6 line of information. In case of radio stations, the most frequently used are lines from 1 to 4. - Repeat steps 3 and 4 depending on the number of lines of information.
In the result you will get:

6. Controlling NuVo #
In this chapter we describe how to control NuVo multiroom system using visualizations (Display touch panel, Remote app). The following functionality will be presented:
- On/off buttons for individual zones.
- Mute buttons for individual zones.
- Tuning radio tuners.
- Volume control.
- Master on/off button.
- Changing source for individual zones.
This functionality extends displaying RDS messages described in chapter 5. displaying RDS information. Controlling NuVo devices using visualizations is a two-step process. The first step is creating of logical rules. In the second step you will have to create visualization elements. Zones and signal sources numbering may vary depending on the connection of NuVo devices
6.1. Creating of logical rules #
To achieve presented functionality, you need to extend code from the Logic tab. Replace below comment in previously entered code: — -- TU WSTAW KOD ŹRÓDŁOWY PRZEDSTAWIONY W ROZDZIALE 6”.
-- Włączanie stref
function dev:on(z)
amp:send("*Z"..z.."ON")
end
-- Wyłączanie stref
function dev:off(z)
if z == nil then
for i=1,6 do
amp:send("*Z"..i.."OFF")
end
else
amp:send("*Z"..z.."OFF")
end
end
-- Zwiekszanie glosnosci
function dev:volup(z)
amp:send("*Z"..z.."VOL+")
end
-- Zmniejszanie glosnosci
function dev:voldown(z)
amp:send("*Z"..z.."VOL-")
end
-- MUTE
function dev:mute(z)
amp:send("*Z"..z.."MUTE")
end
-- Zmiana źródła sygnału
function dev:src(z)
amp:send("*Z"..z.."SRC+")
end
-- Strojenie tunera radiowego
-- Funkcja pomocnicza
local function tuner(ch,fun)
tun:send("*T'"..ch.."'"..fun )
end
function dev:seek(ch,dir)
tuner(ch,"SEEK"..dir)
end
A few words of explanation for the presented code:
The above source code is a set of functions that perform selected actions in the NuVo multiroom system. The first two functions are switching selected zones on and off and the central switch function. The next three functions are volume control in selected zones and muting individual zones. Function no. 6 is responsible for changing the audio signal source in zones. The last two functions are responsible for tuning the radio tuner. Tuning is performed by scanning frequencies from station to station.
The presented source code can be freely extended with other functions offered by NuVo devices.
6.2. Creating Visualization #
In order to visualize new functionality, use the screen created in chapter 5.
All control buttons are universal and can be used to control individual zones. Just remember to change the zone number in the typed commands. The procedures presented in this chapter (except 6.2.5) control zone 1.
6.2.1. Turning zones On/Off #
- Add a new On/Off element
- In the Channel field type:
NUVO.1.act. - In the On field enter:
LOGIC=n:on(1) - In the Off field enter:
LOGIC=n:off(1). - In order to visualize the status of the zone in the form of light, add a new Light element. From the Theme list choose Green. In the Channel field type:
NUVO.1.act. Place the element in the corner of the On/Off button.
6.2.2. Zone muting #
- Add a Switch.
- In the Label type short description, for example Mute.
- In Command field type:
LOGIC=n:mute(1).
6.2.3. Tuner tuning #
- Add a Switch.
- In the Label type short description, for example Seek+.
- In the Label type short description, for example
LOGIC=n:seek('A','+'). - Repeat steps from 1 to 3. Change Label description to Seek- and Command to:
LOGIC=n:seek('A','-')
6.2.4. Volume control #
- Add a Switch.
- In the Label type short description, for example VOL+.
- In Command field type:
LOGIC=n:volup(1). - Repeat steps from 1 to 3. Change Label description to VOL- and Command to:
LOGIC=n:voldown(1).
Repeat subsections from 6.2.1 to 6.2.4 for the remaining zones.
6.2.5. Master on/off button #
- Add a Switch.
- In the Label type short description, for example ALL OFF.
- In Command field type:
LOGIC=n:off()
The example of final result:
