Example Code for Arduino - Relay OUT
Last revision 2026/02/05
Function Description
DMX512 provides 1 channel relay output port, which is controlled by IO46 and can be used to drive intermediate relays, control the on/off of motors, audio devices, etc. The functional ports are shown in the figure below:
| Port numbering | Port description |
|---|---|
| COM | Relay common pole |
| NO | Relay normally open pole |
Note: This controller is built-in with low-power, low-voltage relay, only suitable for switching operations of DC power supply below 30V and 2A. For high-current devices, an external intermediate relay should be used to avoid damaging the built-in relay.
Wiring Diagram
Function Description: The following wiring diagram will illustrate the internal switching principle of the relay and the connection method for external devices.

Example: Controlling the Relay
The following program demonstrates how to drive the relay to cyclically close and open every second through programming. When the program runs, you can hear the relay being activated every second. Measuring the COM and NO terminals with a multimeter in continuity mode will show that they connect every second. If there is an external device, you will see it operate every second.
#include "DFRobot_DMX512.h"
DFRobot_DMX512 dmx512;
void setup() {
Serial.begin(115200);
while(dmx512.begin() != 0){ //Initialize DMX512
Serial.println("init error");
delay(1000);
}
Serial.println("init OK");
}
void loop() {
dmx512.relayOUT(1);
delay(1000);
dmx512.relayOUT(0);
delay(1000);
}
Was this article helpful?
