This is an old revision of the document!


Nexmosphere Drivers for PIXILAB Blocks

Nexmosphere controllers and their elements connect physical objects and environments to digital content. Sensors detect presence, proximity, touch, gestures, object placement, light and more; actuators such as LED strips give a physical response. Integrated with PIXILAB Blocks, a lifted product, a pressed button or a visitor stepping closer can start video, audio, graphics or a whole page of content, which makes them a good fit for museums, visitor centres, retail, exhibitions and immersive spaces.

Nexmosphere website

Component Role Transport Feedback
NexmosphereBase (shared code) Protocol parsing, element discovery, the send queue and every element type None of its own; used by the controller drivers n/a
Controller drivers, e.g. NexmosphereXN180, Nexmosphere_XC720 One per controller model: its number of ports and any built-in elements Serial (115200 baud) or TCP (port 4001). Network Device type: Serial or TCP Yes. Elements report every change.
UDP controller drivers, e.g. Nexmosphere_XC720_UDP The same, for controllers on the network UDP, port 5000 (Network Device type: UDP) Yes, plus a 10 s heartbeat for connected
Nexmosphere (legacy) The original all-in-one driver Serial or TCP Deprecated and no longer maintained. Use a controller driver.

Verified with an XN-180 controller on the USB serial port of a PIXILAB Player (Blocks 8.0, October 2026), with XT-B4N6, XDW-A50, XSW-X36, XT-EF30, XY-240, XZ-L20, XR-DR1 and XW-L56 elements connected and reporting.

Source files

script/driver/NexmosphereBase.ts
script/driver/NexmosphereXN180.ts           (and the other XN controllers)
script/driver/Nexmosphere_XC720.ts          (and the other XC controllers)
script/driver/Nexmosphere_XC720_UDP.ts      (UDP variants)

PIXILAB maintains the drivers in the blocks-script repository. If this document conflicts with the source code, the header comment in script/driver/NexmosphereBase.ts takes precedence.

1. Installing the drivers

A Nexmosphere driver comes in two parts, and both must be installed:

  • NexmosphereBase.js, the shared code, and
  • the driver for your controller model, e.g. Nexmosphere_XC720.js or Nexmosphere_XC720_UDP.js.

Follow the general method under Using a Device Driver in Device Driver Concepts. The controller driver sets how many ports the controller has and adds any elements built into it, such as the RGBW output and four LightMark channels of an XC-748.

Controller drivers

Driver Ports Transports
Nexmosphere_XN115 1 Serial, TCP
Nexmosphere_XN125, Nexmosphere_XN135, Nexmosphere_XN135M3, Nexmosphere_XN135M8L, Nexmosphere_XN165 2 Serial, TCP
Nexmosphere_XN180, Nexmosphere_XN181, NexmosphereXN_185 8 Serial, TCP
Nexmosphere_NEO 4 Serial, TCP
Nexmosphere_XC720, _XC741, _XC748, _XC760, _XC820, _XC847, _XC860, _XC937, _XC938, _XC947, _XC948 4 Serial, TCP; each also as _UDP
Nexmosphere_XC101, _XC841, _XC931, _XC941 8 Serial, TCP; each also as _UDP
Nexmosphere_XC102 2 Serial, TCP; also as _UDP

2. Device setup

Most Nexmosphere controllers connect by USB to a PIXILAB Player and appear in Blocks as a Serial Network Device. The driver turns the controller's messages into properties you can bind to and trigger Tasks on. General information on adding a network device is in the Network Devices chapter of the Blocks manual.

Connection Network Device type Settings
USB on a PIXILAB Player Serial The player's serial port, 115200 baud.
A serial-to-network server, e.g. a Moxa NPort TCP The server's address, port 4001.
A network controller (_UDP drivers) UDP The controller's address, port 5000, receive port 5000. Give each controller its own receive port, or set device.udpDeviceID (below).

Connecting and discovering elements

Connect the sensors and other elements to the controller's ports, then power up. With a USB controller, that means powering up the player. The controller's LED blinks once the driver has connected.

The driver then discovers the elements by asking each port what is connected. Most elements answer, and appear in Blocks within a few seconds. Not every Nexmosphere controller or element supports discovery: for those, list the elements in the driver options, which turns discovery off.

Driver options

The options are optional. Leave them empty to discover everything automatically.

A number sets how many ports to poll, overriding the controller driver's count:

8

An interface list names the elements yourself and turns discovery off. Use this form for new setups:

{
  "interfaces": [
    { "modelCode": "XTB4N", "ifaceNo": 1, "name": "Buttons" },
    { "modelCode": "XWL56", "ifaceNo": 2, "name": "Led" },
    { "modelCode": "XY116", "ifaceNo": 3, "name": "Distance" }
  ]
}

A UDP device ID makes a _UDP driver ignore messages from other controllers, where several have to share one receive port:

{
  "device": { "udpDeviceID": "00:08:DC:74:B0:2E" },
  "interfaces": [ ... ]
}
Option Description
number Ports to poll for elements.
interfaces Elements to create: modelCode as the controller reports it, ifaceNo the port (1-based), and an optional name. Names must be unique within the controller.
device.udpDeviceID MAC address of the one controller this device accepts, for _UDP drivers.

A bare array of interfaces, without the interfaces key, is still accepted for older setups.

Name your elements. A named element keeps its property path when the sensor is moved to another port; an unnamed one does not (see Element names). After changing the options, call reInitialize() or restart the device.

3. Controller properties and callables

Item Type Description
connected Boolean, read-only Serial and TCP: the port is connected. UDP: the controller answered its last heartbeat.
deviceType String, read-only The connection type, e.g. Serial.
runtime Number, read-only, UDP only Controller run time in hours, from its heartbeat reply.
deviceID String, read-only, UDP only MAC address of the controller this device listens to.
send(rawData, priority) Callable Send a raw command string to the controller. priority puts it at the front of the queue.
reInitialize() Callable Rebuild the driver, for instance after changing the options.
setCommandDelay(delay) Callable Spacing between commands, 50-500 mS.
debugLogging(value) Callable Turn detailed logging on or off. Each line carries the port name.

4. Elements

Every element appears under element on the device:

Network.<Device>.element.<Name>.<property>

Element names

An element named in the driver options uses that name. Otherwise the driver makes one from the element type, the model code and the port:

Btn_XTB4N6_1        push buttons (XT-B4N6) on port 1
TOF_XY240_5         time-of-flight sensor (XY-240) on port 5
RFID_XRDR1_7        RFID reader (XR-DR1) on port 7
LED_RGBW_5          built-in RGBW output of an XC-748 (port 5)

The port is part of the name. Move a sensor to another port and its path, and every binding and Task that uses it, changes. Name the elements in the driver options to avoid that.

Buttons, proximity and gestures

Element Model codes Name Properties
Quad buttons, e.g. XT-B4N6 XTB4N, XTB4N6, XT4FW6 Btn button1-button4: Boolean, read-only, true while pressed. led1-led4: Number 0-3, 0 off, 1 fast blink, 2 slow blink, 3 on. Writable.
Proximity, e.g. XY-116 XY116, XY146, XY176 Prox proximity: Number, read-only, the zone.
Time of flight, e.g. XY-240 XY240, XY241 TOF proximity: Number, read-only, zone 1 (near) to 10. triggerOn1-triggerOn10: Boolean, read-only, true at that zone or nearer. airButton: Boolean, read-only. rawData: String, read-only.
Air gesture, e.g. XT-EF30 XTEF30, XTEF630, XTEF650, XTEF680 Air gesture: String, read-only, the last gesture as the sensor reports it.
Motion, XY-320 XY320 Motion motion: Number, read-only.
Person detection, XY-510/520 XY510, XY520 Gender isPerson, gender (M/F/U), genderConfidence, age (range 0-8), ageConfidence, gaze (L/C/R/U); all read-only.
Lidar, XQ-L2/L5 XQL2, XQL5 Lidar ready: Boolean, read-only, true when the sensor can be set up. zone01-zone24: Number, read-only, zone occupied. Callables define the field, zones and detection mode.

Objects and pick-up

Element Model codes Name Properties
RFID reader, XR-DR1 XRDR1 RFID tagNumber: Number, the last tag. isPlaced: Boolean, read-only, true while a tag is on the reader.
NFC reader, XR-DW2 XRDW2 NFC tagUID: String, the last tag. isPlaced: Boolean, read-only.
Wired pick-up, e.g. XSW-X36 XSWX16-36, XSBX16-36, XDWX16-36C, XDBX16-36C, XLFWX…, XLFBX…, XLCWX…, XLCBX…, XSNAPPER PickUp pickup: Boolean, read-only, true while lifted. alarm: Boolean, read-only.
Wireless pick-up, XF-P3 XFP3, XFP3W, XFP3B, XFP3N PickUp pickup: Boolean, read-only. Callables pairingMode() and unPaire().
Light, XZ-L20 XZL20 Light light: Number, read-only, the detected light level. Callable sendSettings(cmd) sets trigger values, e.g. 1:2. Used for Lift & Learn where RFID or a battery sensor will not do.
Shelf weight, X-S4/X-S8 X-S4x, X-S8x ShelfWeight weight, stockLevel, stockChange, anomalyCount, anomalyDetected, calibrating (read-only), pickupTrigger (writable). Callables for calibration and stock.
Bar weight, XZ-W11/W21/W51 XZ-W11, XZ-W21, XZ-W51 BarWeight weight, weightDifference, anomalyDetected, calibrating, liftedItem_1-liftedItem_16; all read-only. Callables for calibration and item weights.

Analog, digital and environment

Element Model codes Name Properties
Analog input, XDW-A50 XDWA50 AnalogIn value: Number, read-only. For any 0-5 V source: a rotary button, a slider, an ultrasonic or PIR sensor. normalizedAnalogInput(normalize, inMin, inMax, outMin, outMax) maps the raw value onto a range of your choice, e.g. 0-1 for a volume.
Digital I/O, XDW-I36/I56 XDWI36, XDWI56 AnalogIn state: Boolean, writable. sendLedCmd() sets its LED.
Encoder, XDW-E60 XDWE60 Encoder direction (CW/CCW) and value (delta), read-only; absoluteValue, writable.
Angle, XZ-A40 XZA40 Angle xAngle, yAngle, zAngle, triggerFromPosition; read-only. storePosition() and clearPosition().
Temperature/humidity, XE-T50 XET50 Temperature temperature, humidity; read-only. updateValues().
Ambient light, XE-A20 XEA20 AmbientLight intencity; read-only.
Colour, XZ-H60 XZH60 Color light, hue, saturation, reflection, hasObject, calibrating; read-only. Calibration callables.

Light and other outputs

Element Model codes Name Properties and callables
X-Wave LED, XW-L56/XW-C56 XWL56, XWC56 LED X_Wave_Command: String, writable, an X-Wave command such as 290C99. setSingleRamp(), setPulsing(), setWave() and defineColor().
LightMark built in, e.g. XC-748 LED command: String, writable. The X-Wave callables plus segments and fade times.
RGB, RGBW and mono LED outputs built in LED command: String, writable. setSingleRamp(), setPulsing(), defineColor(); mono: setOutput().
DMX, IX-DM3 IXDM3 DmxRGBW command: String, writable. directRamp(), defineState(), recallState(), setAllToZero().
Audio switch built in AudioSwitch sw1 (or sw1-sw4): Boolean, writable. setAllSwitches().

An element the driver does not know appears as Unknown_<port>, with its last raw message in unknown.

5. Using the elements in Blocks

Tasks

Most applications start with a Task. Set it to trigger on property change and pick the device's element property as the trigger, for instance Network.Sensors.element.RFID_XRDR1_7.tagNumber. Inside the Task the new value is available as the trigger variable (the RFID code, the proximity zone, the gesture), so the Task can decide what to do from there.

Typical patterns:

Application Trigger What the Task does
Presence sensing TOF_….triggerOn3 becomes true or false Sets Spot.<spot>.active to the same value, waking an Attractor block and letting it return.
Lift & Learn PickUp_….pickup, or Light_….light above a threshold Sets Spot.<spot>.active, or jumps to the product's page.
Object detection RFID_….tagNumber and isPlaced Selects a spot tag per tag number, so a TagSelector shows that object's page; clears it when the tag is lifted.
Push buttons Btn_….button1 becomes true Wakes the spot and selects the content; can set led1 to show the choice.
Analog control AnalogIn_….value changes Sets Spot.<spot>.volume from the value, scaled with normalizedAnalogInput().

Bindings

Element properties can also be bound directly in a block, without a Task:

Indicator   propPath = Network.Sensors.element.Btn_XTB4N6_1.button1
Bar         propPath = Network.Sensors.element.TOF_XY240_5.proximity     v1 0, v2 10
Text block  {$1:fixed=0}  bound to  Network.Sensors.element.Light_XZL20_6.light
Button      propPath = Network.Sensors.element.Btn_XTB4N6_1.led1        Set 3 / 0

6. Behaviour

Commands are queued. The controllers lose messages that arrive too close together, so every command waits its turn, with 100 mS between commands by default (setCommandDelay(), 50-500 mS). The log warns when more than 20 commands are waiting. Discovery queries go to the front of the queue.

Discovery polls each port in turn, one every 500 mS, including the port ranges of XM shop-bus systems. If no element answers within ten full rounds, polling stops; it starts again when the connection is re-established. An interface list in the driver options turns discovery off altogether.

Elements report, the driver does not poll them. Values change as soon as the controller sends a message, so a Task triggers on the change itself.

RFID tags arrive in two parts. The reader's tag message is combined with the port message that follows it, giving tagNumber and isPlaced together.

UDP has no connection to watch. A _UDP driver sends a heartbeat (N000B[RUNTIME?]) every 10 seconds and clears connected when a reply goes missing. If the controller echoes the heartbeat back, the driver turns the echo off (N000B[ACK=OFF]). Messages from other controllers are ignored once the device ID is known, either from the first heartbeat reply or from device.udpDeviceID.

Unknown elements still appear, as Unknown_<port> with the raw message, so you can see what a new element sends before the driver supports it.

A disabled device does nothing. It sends no commands and creates no elements.

7. Application note

A set of demonstration blocks shows the typical applications, each in the same design. Each block's sensor wiring is done with Tasks as in Using the elements in Blocks.

See the application note.