The Laser Box

Posted by Gnewt on 1 March 2009
This is a long-exposure photo of me being scanned by the laser.

Parts list:

  • OpenDMX USB dongle

A while ago I was given a SHINP CL-16RGY by 3ric, to play with. We had no software for it, no experience with the box, and no clue what we could make it do. Here's the story of what I did to make it work, and what we're going to use it for in the future.

First, I needed to install a driver the Enttec Open DMX USB dongle. This is how we send signals to the laser. The first bit of info I found was here, a tutorial on exactly the USB dongle we have. One problem: it's for a Linux box. I have a Windows laptop. I fired up my Ubuntu virtual machine and got to work.

Compiling the driver was fairly easy. Mentioned in the tutorial I linked to is a driver from All I had to do was run a git command, make, copy the driver into the right directory, and then depmod. Voila, plugged the dongle into my laptop and it was recognized by Ubuntu as /dev/dmx0. Perfect! Next step was figuring out how to send it commands. I found some sample code somewhere (though unfortunately I can't remember where). It looked like this:

#include <stdio.h>
#include <string.h>
#include <fcntl.h>

int main()
  unsigned char buffer[513];
  int fd;

  memset(buffer, '\0', 513);

  fd = open("/dev/dmx0", O_WRONLY, 0);
  while (1) {
    write(fd, buffer, sizeof(buffer));
The CL-16RGY from

This worked to prove that the driver was working. The laser box has a little green LED on the back which signifies DMX512 data being received. It was blinking furiously. I thought "well, since it's receiving data, everything after this will be easy." I was very wrong. The manual told me that certain channels controlled certain things (channel 1 for X position, channel 2 for Y position, etc), and I assumed that the information would be correct. No. Of course not. It can't be that easy.

I nearly gave up the project at this point. The terrible layout of the buffer was pissing me off. After a while though, I found a Windows DMX program. It didn't work how I would have liked it do, but it let me adjust the channels in realtime, so I could figure out what things were. I squealed with joy (on the inside, of course) and took note of which channels corresponded to which functions. At the time, my code was in Python, so I edited the Python file and ran it. LAZOR WORKING! I tried editing a few of the channel values to make sure I was editing the correct positions in the buffer, and it worked just like it should.

My code at this time was in Python though, and I wanted the end result in C. I pretty much recreated the same code in C, implemented getopt, and cleaned up the code. It ended up being beautiful! Here is the sourcecode, a binary, and the CL-16RGY manual:

Posted in: Code, Electronics, Featured  Tags: , , ,

6 Responses

  1. Gnewt Said,

    Test failed, you fell into the lava.

    Posted on March 5th, 2009 at 4:58 pm

  2. Alexei Nikiforov Said,

    Why did you need all that complication with that linux and virtual machine stuff if you are Windows user? Open DMX USB was invented by as a fully opensource dongle - it's schematic is available freely and most part and it has a simple FTDI chipset and it has a Windows driver here: and also example of C++ program to use that driver. Also OpenDMX USB is well-supported by few open-source cross-platform programs like FreeStyler or some proprietary programs like Sunlite older versions or MagicQ

    Posted on March 15th, 2009 at 12:37 pm

  3. amatus Said,

    He went through all that trouble because windows sux and linux rox.

    Posted on April 2nd, 2009 at 12:31 pm

  4. 3ricj Said,


    we needed to have a really simple laser pattern, and have very exact control of it for doing 3d scanning. While yes, there is performance lighting software which could likely be taught how to do this exact thing, this was a great exercise to allow him to learn a bunch of stuff.

    Frequently, it's the journey not the destination which matters.

    Posted on June 4th, 2009 at 12:39 pm

  5. CL Said,

    He went through all that trouble because windows sux and linux rox.

    Posted on October 5th, 2009 at 3:01 pm

  6. Jobe Said,

    On windows, use littlecat:

    it is a little dos program that drops UDP packets onto your OpenDMX USB interface. It can also do artnet. The program is meant to be used with vvvv but all you need to do is take a 512byte DMX packet, slap a UDP header on it and blast the packets at the ip of the machine running littlecat. DMX packet is really simple. The offset of the byte is your channel number, and the byte is the 0-255 value that you are sending to a channel. It's really that simple. You have to register to download. Email me if you need a copy.

    Posted on November 25th, 2009 at 12:08 pm

Add A Comment



Tag Cloud