DMX with the Kunbus Revolution Pi Core 3+

Party Lights

© Photo by Sam Moqadam on Unsplash

© Photo by Sam Moqadam on Unsplash

Article from Issue 257/2022
Author(s):

The DMX protocol for controlling lighting technology has its roots in stage and event technology, but it can also be used in home automation. We show you how to control DMX devices with the Revolution Pi module.

In principle, digital multiplex (DMX) technology lets you control all DMX devices through a simple and robust bus. DMX uses the RS-485 specification (i.e., asynchronous serial transfer) for data transmission. The signal is transmitted over two lines simultaneously with inverted voltage levels (±5V).

This type of data transfer is resistant to external interference signals and theoretically allows line lengths of up to 1,200 meters. However, the data transmission rate decreases with increasing line length. Up to a distance of 10 meters, a maximum data rate of 10Mbps can be achieved over RS-485.

DMX works with a data rate of 250Kbps by default; a DMX network is built of strings. One string can contain up to 32 DMX receivers. More receivers require the use of a repeater to extend the network. Network branches are implemented with special splitters. Extremely robust, three-pole XLR (Cannon) connectors are used to connect all DMX devices, which is ideally suited for stage use.

The DMX512 standard supports up to 512 device addresses. Depending on how many addresses a component needs, the number of devices that can be operated on a bus varies.

DMX Lighting

In this article, I use two simple DMX lights that I ordered directly from China [1] some time ago for EUR6.58 each. However, ordering directly from China now might not be worth the effort and prices have increased, so find out in advance what additional costs you will have to pay.

The lamps have eight channels each, which means they occupy eight addresses on the DMX bus. If you assign address 1 to the first lamp, the second lamp is assigned address 9. Somewhat confusingly, addresses and channels are talked about in the DMX environment as if they were different things. The rule of thumb is that you should have an address for each channel in the light. Table 1 shows an overview of the channels for the hardware I used.

Table 1

DMX Light Channels

Channel

Function

Value Range

1

Dimmer (all colors)

0-255

2

Red dimmer

0-255

3

Green dimmer

0-255

4

Blue dimmer

0-255

5

White dimmer

0-255

6

Stroboscope

0-255

7

Fade in/out

0-250

 

Sound mode

251-255

8

Function speeds selected on channel 7

0-255

Most of the functions the DMX lamps offer are self-explanatory. Only a few items require special attention. For the spot to illuminate, you need a value greater than 0 on channel 1. You can't turn up just the red dimmer while the general dimmer is set to 0.

A value of 0 disables the strobe (channel 6). At a value of 1, it flashes at maximum rate and slows with an increase in value. Various predefined color scenarios can be selected in Auto Run operational mode; the playback speed is controlled by channel 8.

At this point, the manufacturer's documentation is a bit vague; it is not clear what exactly is supposed to happen. However, this is not a problem because an external controller is being used.

The lamps have one DMX input and output each and have a power consumption of 36W, so the power can be supplied by a standard socket. The addresses of the lights can be set quite intuitively with a four-digit, seven-segment display on the back. Just make sure the display shows an A in the first position. Assign address 1 to the first lamp and address 9 to the second. If the address settings do not work at first, take a look in the enclosed manufacturer's manual. Figure 1 shows the two lamps with the wiring and the Revolution Pi I used as a controller.

Figure 1: The test setup with two DMX lights and the Revolution Pi as the controller is fairly simple to emulate.

Revolution Pi

The Revolution Pi Core 3+ from Kunbus (hereafter, RevPi Core) [2] is a small industrial controller with a Raspberry Pi Compute Module at its heart. The RevPi Core can be extended with different modules and adapted to different requirements. The manufacturer's extensive treasure trove of modules also contains a module the RevPi Core can use to connect to the DMX bus.

The DMX module can operate in both primary and worker mode and control up to 512 DMX addresses. The supply voltage is 24V DC with a current consumption during use of 100mA. The module indicates the current operating status with three LEDs. The exact meaning of the displays is shown in Table 2.

Table 2

Operating States

LED Name

Signal

Meaning

Power

Off

Gateway inactive

Power

Flashing (green)

Initializing

Power

On (green)

System working and OK

Power

Flashing (red)

Fixable error

Power

On (red)

Serious error/gateway failure

Term

On (green)

Bus termination active

Term

Off

Bus termination inactive

Traffic

Flashing (green)

DMX data active (primary and worker mode)

Traffic

On (red)

DMX data inactive (worker mode)

An eight-pin plug on the front side of the module lets you establish a connection to the DMX bus. The pin assignment of the connector is shown in Table 3. You will also find it – and the pin assignment for the three-pin XLR connector – on the side of the module. If you need more information about the RevPi DMX module, it is best to take a look at the user manual [3].

Table 3

Pin Assignments

Module Pin

Function

XLR Connector Pin

1

None

2

None

3

None

4

Earth (shield)

1

5

DMX +

3

6

DMX –

2

7

None

8

None

Configuration and Test

The DMX module can be configured in two ways: either from the switches on the front of the module or by setting the corresponding values in software. Here, I look at how to configure the module in software. To begin, log in to the RevPi Core (Figure 2). The user is admin, and the password can be found on the right side of the device's housing.

Figure 2: RevPi Core login screen.

After successfully logging in, start the PiCtory app (Figure 3) and drag and drop the RevPi Core and DMX module to the current configuration. The DMX module is configured by 2 bytes. An overview of the supported parameters can be found in Table 4. The address and channel settings can differ slightly depending on the mode (transmit/receive). If necessary, consult the manual [3].

Table 4

Configuration Bits

Byte

Bit

Function

0

0

Address/channel bit 0

 

1

Address/channel bit 1

 

2

Address/channel bit 2

 

3

Address/channel bit 3

 

4

Address/channel bit 4

 

5

Address/channel bit 5

 

6

Address/channel bit 6

 

7

Address/channel bit 7

1

0

Address/channel bit 8

 

1

Address/channel bit 9

 

2

Not used

 

3

Not used

 

4

Not used

 

5

Cancel behavior (0 = keep data, 1 = delete data)

 

6

Mode (0 = transmitter, 1 = receiver)

 

7

Termination (0 = inactive, 1 = active)

Figure 3: Launch the PiCtory app by pressing the matching button.

In the experimental setup, the first configuration byte under Value Editor (Config_1) is set to 0x10 and the second (Config_2) to 0x80 (Figure 4). To access the individual bytes of the DMX module in programs, they need to be published by checking the Export column. For the test setup you need to set the first 16 bytes (DMXOut_1 to DMXOut_16).

Figure 4: Finished configuration for the DMX module.

Figure 4 shows the complete configuration of the RevPi Core, including the DMX module. To keep the settings after a restart, save the configuration by selecting File | Save as Start-Config. Now reboot the RevPi Core to check that the settings have all taken effect.

After the reboot, connect to the RevPi Core console over SSH. On Linux use the ssh command-line tool (Windows users can install PuTTY [4]). The username for the login is pi, the password is the same as for logging in from a browser.

The piTest program briefly tests the setup; it gives you read and write access to all of the RevPi Core's interfaces. If you launch the tool without any parameters, it provides a listing of all your options. Listing 1 gives you the commands you need to make the first DMX light show red and the second one green.

Listing 1

Testing DMX Lights

$ piTest -w DMXOut_1,255
Write value 255 dez (=ff hex) to offset 525.
$ piTest -w DMXOut_9,255
Write value 255 dez (=ff hex) to offset 533.
$ piTest -w DMXOut_2,255
Write value 255 dez (=ff hex) to offset 526.
$ piTest -w DMXOut_11,255
Write value 255 dez (=ff hex) to offset 535.

The first two commands fully fade up the master dimmers of the two lights; the following two commands do the same for the colors. Although values between 0 and 255 can be written to the channels, the lighting intensity only changes every 16 values, although this is not generally the case with DMX, just with these cheap lights.

The piTest program outputs the offset in the process image of the RevPi Core every time. The process image represents all of the device's interfaces. You can also use the offset to access the DMX addresses. Listing 2 uses this ability to switch off the lamps again. In principle, you could use a little shell script magic to control the lights automatically, but because shell programming is not everyone's cup of tea, I'll look at how to control the DMX lamps with a Python script in the next section.

Listing 2

Switching Off the Lights

$ piTest -w 525,1,0
Write value 0 hex (=0 dez) to offset 525.
$ piTest -w 526,1,0
Write value 0 hex (=0 dez) to offset 526.
$ piTest -w 533,1,0
Write value 0 hex (=0 dez) to offset 533.
$ piTest -w 535,1,0
Write value 0 hex (=0 dez) to offset 535.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Nerf Target Game

    A cool Nerf gun game for a neighborhood party provides a lesson in Python coding with multiple processors.

  • Perl: Retouching Photos

    In many cases, whole series of digital images need the same kind of modifications, which forces the photo-grapher to repeat the same steps time and time again in GIMP. Have you ever considered retouching in Perl?

  • Perl: Optical Character Recognition

    SecurID tokens use an authentication system by RSA Security to give the user a valid key for logging onto the target system. A home-grown optical character recognition tool in Perl monitors the key generator.

  • Tintii Colorizing

    Tintii, a modest image-processing program, transforms color images into black-and-white pictures then enhances specific areas with eye-catching colorizing effects.

  • Urban Lightscape

    The Urban Lightscape photo tool lets you adjust local brightness levels within an image, thus turning a simple snapshot into a real eye-catcher.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News