Skip to content

Instantly share code, notes, and snippets.

@paolocavagnolo
Last active April 29, 2023 12:01
Show Gist options
  • Save paolocavagnolo/670e3505fac42b58d51b24201c4dbbf4 to your computer and use it in GitHub Desktop.
Save paolocavagnolo/670e3505fac42b58d51b24201c4dbbf4 to your computer and use it in GitHub Desktop.
DMX SHIELD and ARDUINO [CTC-DRA-10-R2]

Finally working setup

  • CTC-DRA-10-R2 (ebay)
  • Arduino MEGA 2560

For debug

  • MagicQ software on Ubuntu
  • Chamsys USB to DMX 3 poles link to the shield

Connection

  • Shield on the same pins as on UNO (the only place you can put the shield I think)
  • jumper between 19 RX1 (MEGA) and 3 (DMX SHIELD)
  • jumper between 18 TX1 (MEGA) and 4 (DMX SHIELD)

Shield Jumper

From the side on which you can read "CTC-DRA-10-R2" correctly (the bottom): all the jumper are on the LEFT SIDE. Connections:

  • EN
  • Slave
  • TX-io
  • RX-io

Library

this one: https://sourceforge.net/projects/dmxlibraryforar/ version: RDM_alpha3_2

Library mod

https://sourceforge.net/p/dmxlibraryforar/wiki/Using%20a%20different%20serial%20port%20%28RDM%20version%20only%29/

In order to use the Serial on the MEGA for debug and leave the Serial1 for the DMX Shield I changed the Conceptinetics.h file inside the library (~/Arduino/Library/Conceptinetics/Conceptinetics.h)

from:

// Define which serial port to use as DMX port, only one can be 
// selected at the time by uncommenting one of the following
// lines
#define USE_DMX_SERIAL_0
//#define USE_DMX_SERIAL_1
//#define USE_DMX_SERIAL_2
//#define USE_DMX_SERIAL_3

to:

// Define which serial port to use as DMX port, only one can be 
// selected at the time by uncommenting one of the following
// lines
//#define USE_DMX_SERIAL_0
#define USE_DMX_SERIAL_1
//#define USE_DMX_SERIAL_2
//#define USE_DMX_SERIAL_3

Code

Compiled with arduino IDE 1.18..

#include <Conceptinetics.h>

#define DMX_SLAVE_CHANNELS   10

DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );

const int ledPin = 11;

void setup() {             
  
  dmx_slave.enable ();  
  
  dmx_slave.setStartAddress (5);
  
  // Set led pin as output pin
  pinMode ( ledPin, OUTPUT );
  Serial.begin(9600);
}

uint8_t dmxValue;

void loop() 
{

  dmxValue = dmx_slave.getChannelValue(1);
  if (dmxValue > 10) {
    analogWrite(11,dmxValue);
  }
  else {
    digitalWrite(11, LOW);
  }
  
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment