DMX Middleman

Hi,
So at the moment I am trying to finish a project which will (hopefully) act as a middle man between a dmx lighting control desk and a lighting rig. As a middleman it will be able to intercept packets and modify them on the fly, according to what it gets sent down usb from a pc.

So thats the plan, but so far the research I have done shows me various problems with this and I was wondering if anybody could give their opinion.

I plan on using an Arduino Uno; with 2048 bytes of SRAM, the 512 channels of DMX shouldn't be a problem, the 16Mhz should just about cut it, 16Mhz = approx. 16 instructions per microsecond, DMX protocol states 4 microseconds in the smallest delay possible, so 64 instructions per bit sent, which should just about suffice.

So for the problems:
For voltage shifting, I was looking at the MAX485 (a RS485 bus transciever), but AFAIK you have to put it in recieve or transmit mode, which isn't ideal, seeing as I might be miss part of a packet coming in while transmitting the last packet.

To make things easier I noticed a DMX shield made by Tinkerkit, and seeing as my previous attempts at just sending DMX failed, this looked like a good choice, it has two DMX sockets IN and OUT but uses only one bus transciever so this encounters the previous problem and can't add another transciever to it which could solve the previous problem...

Just realized this is probably the wrong subforum for this topic but I'm just getting to the software side of it now.
I've looked around and only found DMXSerial as a library which will send and recieve DMX but this uses the hardware UART to send the DMX signal meaning, to my knowledge, the TX and RX pins cannot be used for standard USB communication. Does anyone know if it is possible to change the pins used in the DMXSerial library?

I've thought about using usb shields to avoid the TX and RX pins but I'm on a tight budget, which is also the reason for contemplating this project in the first place.

Any thoughts?

thanks,
TSN

I don't know if you are still working on it but an option might be using software serial, that's what I do. Now there is one thing that most shields can not do and that is disabling the circuitry on the shield which means that you cannot use the same uart for both your arduino USB and for your shield.
You can of course choose to do dmx via IO but this is very time critical and most likely you don't want to have an interrupts or whatsoever enabled at the time you are busy.

I have an example if you are interested where I send the data that I read from the dmx line toward the serial connected to my pc multiplexed on the same uart. With this same principle I could use two dmx shields on the same usart by switching them on and off which gives me a frame rate of 20 fps approx which is half the normal dmx speed. But at least I have one shield for receiving and one for sending and can alter the data between.

The shield I'm using can be found here: http://stores.ebay.nl/Conceptinetics?_trksid=p4340.l2563

If you need help.. Le me know

Hi, thanks for the information but unfortunately the project ran of time. The idea of multiplexing shields is very different and I never would have thought about it. I would be very interested to see the sketch that achieves the multiplexing, if it is possible.

TSN

Just to show the principle I have a piece of code where I use the USART RX for receiving DMX using a DMX_Slave controller object . secondly I use the Software serial on the same USART to send the values every two seconds to my serial which I can monitor using the serial monitor tool.

Some more info that is not covered in my code example...
You can combine the DMX_Slave and DMX_Master from the library I'm using except you can not have them activated at the same time since you only have a single UDR register which is used for both transmitting data and receiving data on your USART.
So when the DMX_Master is enabled the DMX_Slave should be disabled and so on...... this is not included in my example but the principle stays the same... you can only use the UART for one thing at the time....

On the shield I'm using you can enable and disable it via one of the digital pins that you select via a jumper...

#include <Conceptinetics.h>
#include <SoftwareSerial.h>

#define DMX_SLAVE_CHANNELS 10

//
// With this pin you can enable / disable the shield I'm using
// if HIGH the driver will be in shutdown state, RX will be Z state
//
const int dmxShieldEnablePin = 4;

// Configure a DMX slave controller
DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS );

const int ledPin = 13;

// the setup routine runs once when you press reset:
void setup() {

// Set start address to 1, this is also the default setting
// You can change this address at any time during the program
dmx_slave.setStartAddress (1);

// Set led pin as output pin
pinMode ( ledPin, OUTPUT );
pinMode ( dmxShieldEnablePin, OUTPUT );

// Enable DMX Shield
digitalWrite ( dmxShieldEnablePin, LOW );

// Enable DMX slave interface and start recording
// DMX data
dmx_slave.enable ();
}

// the loop routine runs over and over again forever:
void loop()
{
static unsigned long lastMillis = millis ();

//
// EXAMPLE DESCRIPTION
//
// If the first channel comes above 50% the led will switch on
// and below 50% the led will be turned off

// NOTE:
// getChannelValue is relative to the configured startaddress
if ( dmx_slave.getChannelValue (1) > 127 )
digitalWrite ( ledPin, HIGH );
else
digitalWrite ( ledPin, LOW );

// every two second send values to serial port with shield disabled
if ( millis () - lastMillis > 2000 )
{
// Stop dmx receiver and disable shield
dmx_slave.disable ();
digitalWrite ( dmxShieldEnablePin, HIGH );

char dmx_debug_str[52];
snprintf ( dmx_debug_str,
52,
"\r\n0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x ",
dmx_slave.getBuffer()[1],
dmx_slave.getBuffer()[2],
dmx_slave.getBuffer()[3],
dmx_slave.getBuffer()[4],
dmx_slave.getBuffer()[5],
dmx_slave.getBuffer()[6],
dmx_slave.getBuffer()[7],
dmx_slave.getBuffer()[8],
dmx_slave.getBuffer()[9],
dmx_slave.getBuffer()[10]
);

//
// In this example I used the software serial library
// to avoid a clah between the DMX library and the Hardware serial
// library... Of course you can manipulate the TX data register yourself
// as long you are not using the USART TX interupt
//
SoftwareSerial sw_serial ( 0, 1 );
sw_serial.begin ( 115200 );
for ( int i=0; i < 52 ; i++ )
sw_serial.write ( dmx_debug_str );

  • sw_serial.end ();*

  • // Enable shield and start dmx receiver*

  • digitalWrite ( dmxShieldEnablePin, LOW );*

  • dmx_slave.disable ();*

  • lastMillis = millis ();*

  • }*
    }
    [/quote]
    The library I'm using can be downloaded from: DMX Library for Arduino download | SourceForge.net