29 Dec

DMX Lasers with Arduino

Walking though Jaycar yesterday I happened to spot something shiny in the corner of my eye. Luckily not too shiny, it was a laser. I have a goal of building a laser operated Asteroids game. Inspired from this: http://jv4779.blogspot.ca/2013/03/laser-projector-playing-mame-vector.html

So, first things first, how can we control a laser with a computer…

After much research last night I decided to buy the laser in Jaycar. Reason being is that it supports a protocol called DMX512. DMX, for those who don’t know, and neither did I shortly ago, is an industry standard in the lighting and entertainment market. It allows the addressing and control of lasers, lights, fog machines and all that jazz.

It consists of a Master, multiple slaves, and each device takes up multiple channels. Channels are allocated manually and sequentially.

Now, to make a long story short so you do not have to go though all the hair pulling that I did I’ll show you exactly how to get a DMX LASER going with your Arduino!

You will need:

  • DMX laser – Jaycar SL3436
  • Arduino 5V
  • XLR Male/Female cable – Jaycar WA7041
  • MAX485 IC
  • 100 Ohm resistor

 

DMX protocol uses an RS485 standard. So we wire up the MAX485 as seen below. You can also substitute for MAX418, MAX487, SN75176 or 75LBC184.

Arduino DMX interface using MAX485 chip

Arduino DMX interface using MAX485 chip

I then cut my XLR cable. The laser input needs a female end so I cut it close to the male end. Wiring the female lead to the circuit above I then connected that to the laser.

For good measure the manual suggests putting a 120 Ohm resistor on the final DMX item in the chain. Thus, I used the cut off male end and soldered in the resistor from the red to white wire.

Laser DMX termination resistor

Laser DMX termination resistor – Its in there!

Ok, now we are done with the electronics. Onto the software.

Installing this library

http://www.pjrc.com/teensy/arduino_libraries/DmxSimple.new.zip

There were a couple problems with other versions of the DMXSimple library i.e. compatibility issues. This one works a treat.

Open the Serial to DMX example

Open Serial to DMX example

Open Serial to DMX example

Verify + Upload then open the Serial Console at 9600 baud

Now, we can say XXXcYYYw, where XXX is the channel number and YYY is the value to be set. As mentioned before, each device has to have a channel set. I set mine to 1, do this using the dip switches. All off except position 1. By also setting Position 10 to off you set it for DMX mode in this model.

Laser DMX DIP switches

Laser DMX DIP switches

So, we need to know what we want to do, let’s consult the manual

Laser DMX manual settings

 

Ok, three things take my interest:

  1. Turn it to manual by setting Channel 1 to 210 (Arduino Serial: 1c210w)
  2. Set the Horizontal position by setting Channel 3 between 0 to 160 (Arduino Serial: 3c10w)
  3. Set the Vertical position by setting Channel 4 between 0 to 160 (Arduino Serial: 4c10w)

#WINNING

Laser Firing on Arduino DMX command!

Laser Firing on Arduino DMX command!

Taking it further. You can automate this using the same library by using functions rather than the serial terminal. We have the function

DmxSimple.write(XXX,YYY);

Now you can set the laser flailing on command! Let me know how you go and I’ll share where I get to.

Cheers,

John

 

 

 

2 thoughts on “DMX Lasers with Arduino

  1. Hi John,

    Can arbitrary shapes can be drawn with the laser or only preprogrammed ones? Could I supply x and y coordinates of my own choosing to place a point? I am sure you are busy, I appreciate your time.

    Many thanks.

    KayBee

    • Hi KayBee,
      With DMX you can only more it to an XY coord. As in it can not move fluidly from one point to another. 1,1 then 1,2 etc but won’t sweep. For that you need ILDA which is the next adventure.

Leave a Reply

Your email address will not be published. Required fields are marked *