Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Controlling DMX with AS3

Community Beginner ,
Dec 02, 2011 Dec 02, 2011

I am looking to write a program in AS3 (probably using Flex SDK)  that controls a theater lighting system using DXM Pro USB. The program needs to be able to send data to multiple DMX channels to control the level of lights, allowing lighting schemes to be pre-set and executed in a given order.

I have seen libraries for working with DXM inr VB and C#, but I am trying to determine if anyone has written an AS3 library for sending data to the DXM Pro USB device. I have never used AS3 to communicate directly with a USB device, so I am at a bit of a loss as to where to start. Obviously, this will be a project written for AIR, since it will need access to system devices.

Does anyone know of such a library? If not, can someone point me in the right direction for reading up on communicating with USB devices in AS3?

TOPICS
ActionScript
7.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Dec 14, 2011 Dec 14, 2011

I didn't want a wrapper, as I wanted it to be installed with the Adobe AIR installer. And I checked out Netlab. It worked well, but I wanted to handle the problem at the code level so I could have more control over it.

I finally resolved the problem using Serproxy, which runs in the background and makes USB ports available via ports 5331-5334 (COM 1-4) on localhost. Because the DMX USB Pro emulates a COM port, it was easy enough to connect via Serproxy (as long as I made sure the DMX USB Pro was

...
Translate
Guest
Dec 03, 2011 Dec 03, 2011

It does not need to be AIR, though I think AIR should be fine. I think all of the Flash wrapper applications like SWFKit, Zinc, et al. will allow you to write data to a com/usb port. I've used SWFKit in the past to control a USB relay that turned a pump on/off. At least for the relay all I needed was to figure out the control codes and then send the proper data to the port as a hex string. Seems like you'd be able to do the same...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 04, 2011 Dec 04, 2011

Check out the netlab toolkit! It solves your problem and more!

I've used it with the Dmx USB pro several times.

Regards

Kristian

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 14, 2011 Dec 14, 2011

I didn't want a wrapper, as I wanted it to be installed with the Adobe AIR installer. And I checked out Netlab. It worked well, but I wanted to handle the problem at the code level so I could have more control over it.

I finally resolved the problem using Serproxy, which runs in the background and makes USB ports available via ports 5331-5334 (COM 1-4) on localhost. Because the DMX USB Pro emulates a COM port, it was easy enough to connect via Serproxy (as long as I made sure the DMX USB Pro was not assigned a port higher than 4).

I used NativeProcess, which is new in AIR 2.0. I was unfamiliar with that object, so I thought I would share the code here in case others want to use it.

if (NativeProcess.isSupported)   var file:File = File.applicationDirectory.resolvePath("serproxy.exe");   var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();   nativeProcessStartupInfo.executable = file;   nativeProcessStartupInfo.workingDirectory = File.applicationDirectory;   process = new NativeProcess();   process.addEventListener(Event.ACTIVATE, handleProcessActivation);   process.start(nativeProcessStartupInfo);} else {   Alert.show("Unable to start Serproxy.");}

I then connected to the port on localhost via the Socket, and used a ByteArray to pass the proper information to the DMX USB Pro.I also had an event handler to exit the NativeProcess when the application closed.

Thanks to everyone who responded. If anyone needs help figuring out the correct information to pass to the DMX USB Pro, I would be glad to share what I know. Their documentation is a bit sparse, but a little experimentation allowed me to find the correct bytes to send.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 14, 2011 Dec 14, 2011

Hey kwilson

That is really awesome!

I am very interested in learning a bit more about your setup!

Would you also share some info on your project, why you're using dmx from flash/air?

Regards

Kristian

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 15, 2011 Dec 15, 2011

Kristian,

Thanks for your interest. I am happy to share about my project.

I work with several community theaters in my area. One of them recently asked me to run their lights for a production. They use the DMX USB Pro to connect to four Matrix DMX Pro Dimmers, giving them up to 16 channels for lights.

They have been using StageConsole, an OpenSource program written in VisualBasic. The program is good for simple lighting, but the theater company wanted more control. I originally downloaded the StageControl source code in hopes of updating it, as it doesn't seem to have been updated in about four years. It was at that point I discovered that it used VisualBasic 6. That is an older version of VB that doesn't use the .NET framework. I decided at that point that it would be simpler to start from scratch. I teach Flex and Flash programming, do I decided to use AIR just because I most comfortable with ActionScript.

Up until this point, I have merely been trying to connect to the DMX USB Pro and figure out the data packets that need to be sent to it. Since I have resolved that issue, I am now moving on to the more enjoyable task of actually writing the program (when I can find the free time).

Kevin

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 03, 2012 Jan 03, 2012

Hello.

This looks great, I wanted to ahcieve a similar thing but have'n thad any chance to try anything out yet due to other commitments.  Would you mind sharing more information about your project?  Had you though about writing up a tutorial or anything?

I have a USB Pro on the way to me so I can also develop a simple lighting control system (all it needs to do is change a single mutli-colour LED to 5/6 specific RGB values) but I'm not sure where to start.  Mine to is for a group of people working in community theatre.

Cheers,

A.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 16, 2013 Feb 16, 2013

Hi Kevin,

It's been a wile since this topic was updated, but i'm really interested in your project. I have an Enttec USB pro as well and I want to controll it directly from Flash.

How did connect the dmx pro to flash? (do you have examples?) And how (and what) can you send packets tot the dmx pro?

I had communication with the dmx pro in two different ways untill now, with netlab and with flosc with D::light. Both actually use air or jave to get from utp to OSC and then mediacontrol_pc or D:light dmx to go to usb/com.

I want a more direct approach to send data to the com port directly. Can you provide some insights?

Do you also have experince with libusbx? (this is the driver D::light dmx uses) I'm not sure what it does exactly, but i think its not a com port. Has a different library anyways, so means different packets i gues?

Thanks in advance!

Piet

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 21, 2013 Aug 21, 2013

I'd be insterested in knowing more about this as well. I'm currently working with the dmx usb pro device and while I can connect to it via socket, I'm not sure what bytes I need to send it to get it to do anything. Failing this, I might go with an ANE based on the developer samples.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 12, 2013 Sep 12, 2013

Hi Rhuno,

As I discovered you need to send the following:

7E (the startbit)

06 (label for sending dmx)

01 02 (lenght info or something)

00-FF (Dmx value, you send it for every channel, so 512 times)

E7 (the stop bit)

So for example:

7E 06 01 02 00 66 00 00 00 00 00 00 00 00 00 00 00 FE 7F

00 00 7F FE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 E7

I don't really understand the 01 02 at the beginning, but the rest is quite easy.

Can you explain to me (or send me an example) about how you connect to socket? I'm not getting that part working yet.

Thanks in advance!

Greetings

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 16, 2016 Aug 16, 2016
LATEST

Hi all

A lilttle bit late on this, but I've just needed a DMX connection from As3 Air and found a way.

Of course is based on Enttec USB adapters and a Serial Port connection.

The serial connection is based on BenKuper fantastic NativeSerial.ane work (https://github.com/benkuper/AIR-NativeExtensions/tree/master/NativeSerial)

The DMX data structure is based on Enttec examples and on a sample found on a Processing Forum.

You can have a look a try:

GitHub - colorao/as3: collection of some as3 classes

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines