We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
DMX output (Read 2224 times)
DMX output
Jan 24th, 2008, 4:48am
 
Has anybody had an experience with outputting DMX?

I'm looking at purchasing either the enttec usb pro or the lanbox, unless anybody has had any luck with anything else.
Re: DMX output
Reply #1 - Jan 25th, 2008, 7:21pm
 
We've just started a project at UCLA where Processing will be controlling DMX. I hope to report back when things are up and running.
Re: DMX output
Reply #2 - Jan 26th, 2008, 4:10am
 
Great news - two questions - will you be using a lanbox or enttec style dmx box?and any idea of a timeline?
Re: DMX output
Reply #3 - Jan 29th, 2008, 11:07am
 
have a look here (forum search works pretty well Wink

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=os_libraries_tools;action=display;num=1128939792;start=7#7

i use this code with the little enttec box and it works great.
Re: DMX output
Reply #4 - Feb 25th, 2008, 9:29pm
 
Hi,
i have an ENTTEC OPENDMX BOX and I'd like to use this with my laptop (Powerbook 1.33GHz - OS X). I've searched some freeware software of lighting control but there aren't one that work.

Have you got some idea about this problem?

thanks
Luca

Re: DMX output
Reply #5 - Feb 25th, 2008, 11:27pm
 
Apart from the processing example posted above, I have found this piece of software http://www.jgelectronics.nl/USBDMX.html
I haven't tried it yet but it may be worth a look.

Cheers
Re: DMX output
Reply #6 - Feb 26th, 2008, 10:20am
 
Thank you. Now i'll take a look.
Do you think, if this works, that i use Processing with ENTTEC OPEN DMX and  FTDI VCP driver OSX PPC to control lighting?

Luca
www.fusestudio.it
Re: DMX output
Reply #7 - Apr 14th, 2008, 5:36pm
 
Hi, for the project reas mentioned in his post, I wrote a program that controls LEDs through the DMX USB pro adapter. For that program I implemented a little class to handle DMX messages:

http://users.design.ucla.edu/~acolubri/home/Group/PopMotion/code/DMX.pde

based on the example here:

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=os_libraries_tools;action=display;num=1128939792;start=0

Re: DMX output
Reply #8 - May 24th, 2008, 1:37pm
 
Nice work ac

thanks for posting that, makes things nice and easy.
Re: DMX output
Reply #9 - May 28th, 2008, 1:49am
 
ac, nicely done!

Just a note: you may want to update the comments in that class so it mentions the model of DMX controller and maybe a link to the ENTTEC docs.  The reason I suggest this is that the code isn't universal, it just implements one command from the serial protocol used by that *specific* controller.  Pointing this out in the comments could help to prevent potential frustration for people with less experience trying to use the class with incompatible hardware.


If you're interested, you can get the spec here which outlines the rest of the supported messages.  You can do some cool stuff like read the firmware version, set the DMX broadcasting frequency, etc..

http://www.enttec.com/docs/dmx_usb_pro_api_spec.pdf
Re: DMX output
Reply #10 - May 28th, 2008, 5:04am
 
yes, I agree that some more comments are needed in order to avoid confusion. I'll do it as soon as I get free from  school work (at the end of the quarter now).

It would also be great to have some more functionality built into the class... I'll definitely take a look at the API specs.
Re: DMX output
Reply #11 - May 28th, 2008, 9:46am
 
ac,

This would make a great library, but at the very least I think it should be added to the Hacks part of the site.

Casey

Re: DMX output
Reply #12 - May 28th, 2008, 8:40pm
 
My plan when I originally started messing with DMX (and resulted in the code I posted quite some time ago) was to make a modular library that could be hooked up to various hardware devices.  Here's sort of what I'm talking about, maybe it will be helpful to this discussion?  Anybody want to join forces and build this into a library that will work with other DMX hardware?

(note, I just hacked this out, it hasn't been tested with the actual device and is just to illustrate my ideas for architecture)

ideas? thoughts?

Code:


void setup()
{
size(200,200);
DMXDevice foo = new ENTTECUsbPro(this, "COM1", 10);

foo.setChannelValue( byte(4), byte(10) );
}

void draw()
{
}


/* interface for all DMX devices */
public interface DMXDevice
{
public void setChannelValue( byte channel, byte value );
}

/* abstract implementation to handle simple caching of channel data to reduce work */
abstract class AbstractDMXDevice implements DMXDevice
{
protected byte[] channelValues;
protected int universeSize;

protected AbstractDMXDevice()
{
this(10);
}

protected AbstractDMXDevice( int universeSize )
{
this.universeSize = universeSize;
this.channelValues = new byte[universeSize];
}

public void setChannelValue( byte channel, byte value )
{
if(this.channelValues[channel] != value)
{
this.channelValues[channel] = value;
this.refreshDevice();
}
}

protected abstract void refreshDevice();
}

/* hardware-specific implementation, there would be one of
these for each type of DMX device. It only handles initialization and the specific logic needed to send the channel values to the hardware by implementing the "refreshDevice" method */
class ENTTECUsbPro extends AbstractDMXDevice
{
private byte[] message;

private Serial serial;

private final int SERIAL_RATE = 19200;
private final int HEADER_LENGTH = 5;
private final byte DMX_PRO_MESSAGE_START = byte(0x7E);
private final byte DMX_PRO_MESSAGE_END = byte(0xE7);
private final byte DMX_PRO_SEND_PACKET = byte(6);

public ENTTECUsbPro( PApplet parent, String port, int universeSize )
{
super(universeSize);
this.serial = new Serial(parent, port, this.SERIAL_RATE);

int dataSize = universeSize + this.HEADER_LENGTH + 1; // 5 byte header + 1 byte for "message end"

message = new byte[dataSize];

message[0] = DMX_PRO_MESSAGE_START;
message[1] = DMX_PRO_SEND_PACKET;
message[2] = byte(dataSize & 255);
message[3] = byte((dataSize >> 8) & 255);
message[4] = 0;

for (int i = 0; i < universeSize; i++)
{
message[i + HEADER_LENGTH] = byte(0);
}

message[dataSize - 1] = DMX_PRO_MESSAGE_END;
}

/* overrides AbstractDMXDevice */
void refreshDevice()
{
// just copy the new channel data into the current message array
System.arraycopy( this.channelValues, 0, this.message, HEADER_LENGTH, this.universeSize );

this.serial.write( message );
}
}



Page Index Toggle Pages: 1