Release V0.0.2 of Java DMX512 Library With Universes and USB-to-DMX support

Earlier this month, I released V0.0.1 of my new Java library to interact with DMX512 devices using (optionally) the Open Fixture Library (OFL). After some more experimenting, I’m able to announce the next (beta) release V0.0.2 with the following major changes:

Introduction of DMX Universes

For my tests, I’m using an JUNELIONY ArtNet 1024 2-Port Sulite DMX LAN512 2-Port ArtNet Converter controller. It has two XLR-connectors, labeled as DMX1 and DMX2, which can be controlled as universe ID 0 and 1.

A new object DMXUniverse has been introduced to support the use of universes, defined by an id and a list of DMXClient`. Check this demo code for a full example. This is the simplified code:

// Load moving head fixture from an OFL file
Fixture movingHead = getFixture("picospot-20-led.json");
var movingHeadMode = movingHead.getModeByName("11-channel");

// Load RGB fixture from an OFL file
Fixture rgb = getFixture("led-party-tcl-spot.json");

// Create moving head clients on channel 1 and 12 in universe 1 (= DMX1 = ID 0)
DMXClient movingHead1 = new DMXClient(1, movingHead, movingHeadMode);
DMXClient movingHead2 = new DMXClient(12, movingHead, movingHeadMode);
DMXUniverse universe1 = new DMXUniverse(0, List.of(movingHead1, movingHead2));

// Create RGB clients on channel 23 and 28 in universe 2 (= DMX2 = ID 1)
DMXClient rgb1 = new DMXClient(23, rgb);
DMXClient rgb2 = new DMXClient(28, rgb);
DMXUniverse universe2 = new DMXUniverse(1, List.of(rgb1, rgb2));

// Universe 1 (= DMX1): Set moving heads to center position
movingHead1.setValue("pan", (byte) 127);
movingHead1.setValue("tilt", (byte) 127);
movingHead2.setValue("pan", (byte) 127);
movingHead2.setValue("tilt", (byte) 127);
controller.render(universe1);

// Universe 2 (= DMX2): Set RGBs green and red
rgb1.setValue("green", (byte) 255);
rgb2.setValue("red", (byte) 255);
controller.render(universe2);

USB-to-DMX Support

USB-to-DMX seems to be more challenging compared to the IP-to-DMX ArtNet protocol that already was integrated in V0.0.1. But V0.0.2 has been tested and is working as expected with a DSD TECH SH-RS09B USB to DMX Cable for Freestyler QLC MagicQ and Pi Open Lighting. Such a device is handled on your computer as a serial device, and the com.fazecast.jSerialComm library is used in my DMX512-library for the serial data transmission.

Multiple example implementations are available in the sources, this is a simplified version:

// Get a list of all available serial ports
var ports = DMXSerialDiscoverTool.getAvailablePorts();

// Log the serial ports
for (var port : ports) {
    LOGGER.info(port.getName());
}

// Create a serial controller
var controller = new DMXSerialController("tty.usbserial-BG01OL60",
		SerialProtocol.OPEN_DMX_USB);

// Send raw data, identical as in V0.0.1 with an IP controller
controller.render(0, new byte[]{(byte) 127, (byte) 127, 0, 0, 0, 0, 0, 0, 0, 0, 0});

// Are use a fixture, also similar as done with an IP controller
Fixture fixture = OFLParser.parse(new File("led-party-tcl-spot.json"));
DMXClient client = new DMXClient(23, fixture);
DMXUniverse universe = new DMXUniverse(0, client);
client.setValue("dimmer", (byte) 255);
client.setValue("red", (byte) 255);
controller.render(universe);

DMX512 Java Library

The library I created is open-source with its sources on GitHub and releases on Maven Central.

<dependency>
    <groupId>be.codewriter</groupId>
    <artifactId>dmx512</artifactId>
    <version>${dmx512.version}</version>
</dependency>

DMX512 JavaFX Demo Project

The JavaFX user interface demo application has been updated to use V0.0.2 of the library and has proven to work identically with IP-to-DMX and USB-to-DMX. Check the sources on GitHub.

Next Steps

I also have an Enttec Open DMX USB interface, but I didn’t get it working yet… With some chat-based coding approach, I have several serial DMX512 protocols implemented now that you can test, but none resulted in a working solution. I reached out to Enttec for more info about the protocol, but didn’t get a reply yet.

public enum SerialProtocol {
    /**
     * Simple serial transmission
     */
    OPEN_DMX_USB,
    /**
     * Direct FTDI chip communication
     */
    FTDI_CHIP_DIRECT,
    /**
     * Enttec Open DMX USB (FTDI-based)
     */
    ENTTEC_OPEN_DMX,
    /**
     * Generic serial-based DMX
     */
    GENERIC_SERIAL
}

If a solution for this interface can be found, or if other changes or improvements are added, a new version will be released.