magnify
Home Arduino projects Arduino based DMX ArtNet-Node
formats

Arduino based DMX ArtNet-Node

 

Arduino based DMX ArtNet-Node

Or how to make an Art-Net node for less than $ 50

Updated 13-01-2013

In this post we show you how to build an Art-Net node based on Arduino UNO or Arduino Mega with two output DMX universes (1024 DMX channels on mega). This node answers to the basic messages of the Art-Net protocol, so that any controller that meets the protocol will be able to detect it and use it as DMX output.

What do we need?

– An Arduino UNO, Arduino Mega 2560 or Mega 1280, the assembly and the code has been tested with Arduino UNO and Arduino Mega 2560, should work without problems in 1280.

– An ethernet shield based on Wiznet W5100 (Arduino ethershield)

– The DMX shield based on included schematic, or Tinkerkit DMX shield.

– Library Deskontrol 4 DMX universes (included in package)

Arduino IDE v0023 (The code for the Art-Net node does not work for now with higher versions)

New version 0.2:
Arduino based DMX ArtNet-Node v0.2

Old version 0.1:
Arduino based DMX ArtNet-Node v0.1

Changes in version 0.2 beta
—————————-
– Not needed anymore modifications on file hardwareserial.cpp
– Now using deskontrol DMX library version 0.3
– Support for Tinkerkit DMX shield in UART mode
– Support for universe address
– Unified code for Arduino MEGA and Arduino UNO
– 1 universe (512 channels) with Arduino UNO
– 1, 2 or 3 universes (512, 1024 or 1536 channels) with Arduino MEGA

Installation Instructions:

Copy the folder “Dmx” included in the package to the folder arduino-0023/libraries/

Copy the folder “artnet_node” to Arduino sketches folder, in my case “Arduino”

Now we can open the sketch of the “artnet_node”, compile the code and upload to Arduino.

*****************************************************************
IMPORTANT:
To program the Arduino via USB, will be necessary to remove the DMX shield, and put it back once programmed!
*****************************************************************

To test the performance I have used the software “MADRIX”, the utility “DmxWorkshop” of Artistic license, and the utility “artnet-discover” that is part of the library libartnet of Simon Newton.

You can also try the program WhiteCat lighting from Christoph Guillermet.

All these programs are for windows, if you want to try Linux you can use “Q-light.” (Configure your computer with the IP 2.0.0.1, subnet-mask 255.0.0.0, gateway 2.0.0.1)

I hope to share your experiences in the Blog.

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
58 Comments  comments 

58 Responses

  1. Gustaf Gagge

    Great work!

    I am very keen to try this.
    do you think the hardware in a arduino uno could handle like a single universe node?
    did some experiments with Christophs code and the dmx_smiple library it worked for just a few seconds before it crashed i guess i has to do with my poor programing skills and some buffer that got full. it would be great to condens this to a library.

    anyway great work!

    • Toni Merino

      Maybe you need some small modifications in the DMX library (currently only tested on mega and nano), if the Arduino Uno have the clock to 16 MHz should work well like Arduino Mega.
      As when I have an Arduino Uno proves it works and makes the necessary modifications.
      Regards.

  2. Manuel

    Almost got the UNO working… flawlessly with MEGA. Excellent. Anything about DMX to ArtNet? Thanks there!

    • Toni Merino

      For use with Arduino UNO change this line:

      const int MAX_BUFFER_UDP = 1650;

      by:

      # if defined (__AVR_ATmega1280__) | | defined (__AVR_ATmega2560__)
      const int MAX_BUFFER_UDP = 1650;
      # elif defined (__AVR_ATmega328P__) | | defined (__AVR_ATmega168__)
      const int MAX_BUFFER_UDP = 550;
      # endif

      Whenever I get some time modifies the article.
      Regards.

  3. Rowan

    Hiya,
    (I ask this without actually having read the code – so excuse me if the answer is obvious!)
    The hardware and DMX library supports 4 universes; is there a possibility the artnet node could utillze these extra outputs, or inputs? Any possibility that the device itself could use two inputs and send artnet data from those as well as using two outputs? Maybe merge modes?
    Cheers!

    • Toni Merino

      Hi.
      DMX input is not implemented yet. Will be in future revision.
      Regarding the use of multiple output universes, over two universes the output frame rate is very low, but possible.
      Surely it is necessary to optimize the code more for AVR, losing compatibility with Arduino.

      Regards.

  4. Peter

    Hi Toni

    I have now build your Artnet Node but i’m stuck 🙁
    I can Ping the node at Ip 2.0.0.1 and get an answer, but then i use DmxWorkshop i can’t see the node. I also tryed with MA on Pc to send DMX via Artnet, but no luck :/

    I did
    – copy hardwareSerial
    – Copy Dmx folder
    – Configure Pc to ip 2.0.0.1, subnetmarsk 255.0.0.0, gateway 192.168.0.1 (can’t reconfigure this – router locked)

    In order to compile i had to only define USE_UNIVERSE_0 and edit the code in
    #if defined(USE_UNIVERSE_0)
    ArduinoDmx3.set_control_pin(28);
    Arduino.Dmx3…..
    …..

    to
    #if defined(USE_UNIVERSE_0)
    ArduinoDmx0.set_control_pin(11);
    ArduinoDmx0…..
    …….

    And also change from 3 to 0 in order to compile
    line 182
    memcpy(ArduinoDmx0.TxBuffer, packet->data, ARTNET_DMX_LENGTH);

    I use IDE 0023 to complie.

    I hope you can help me 🙂

  5. Peter

    Hi

    Thank you for helping me!

    I use Mega 2560 so i just defined it in the code as

    #define __AVR_ATmega2560__

    I replaced the libary, changed the hardware serial back.
    Still i can ping it at 2.0.0.10, but i can’t see it in DmxWorkshop. Then i used your program (discover.exe) but it selfclosed after 1-2 seconds.
    But with a quick sreenshot i can see that it see the node.

    I used the config:

    uint8_t factory_mac [6] = { 1, 2, 3, 0, 0, 10}; // the mac address of node
    uint8_t factory_localIp [4] = { 2, 0, 0, 10}; // the IP address of node
    uint8_t factory_broadcastIp [4] = { 2, 255, 255, 255}; // broadcast IP address
    uint8_t factory_gateway [4] = { 2, 0, 0, 1}; // gateway IP address (use ip address of controller)
    uint8_t factory_subnetMask [4] = { 255, 0, 0, 0}; // network mask (art-net use 'A' network type)

    Computer:
    Ip: 2.0.0.1
    subnetmask: 255.0.0.0

    Does the ip has to be in the 2.x.x.x ?

  6. Jan

    Hello Toni,
    Great work!

    Works fantastic on my Arduino Mega 2560 Now I can dedicate my ENTEC ODE to DMX input.

    Now I will need my Mega for another project (sending OSC to my iPad for controlling Luminair) So I’ll buy another ‘duino specific for outputting one universe of DMX.

    I’ve read that the UNO works so I guess the Arduino Ethernet will work just as good as the UNO + ethernet shield?

  7. Stratos Bichakis

    Hi Tony,

    You have made such a nice Arduino implementation!
    I managed to make a working version of your ArtNet-Node that works under Arduino v1.0.1

  8. Tom

    Hi,

    Many thanks for a great piece of software. Does the tx LED indicator within the code work? If so could you please explain to me how to get it working.

    I have defined pin 47 for the LED as an output, and placed this pin number into the following line of the code:

    ArduinoDmx3.set_tx_led_pin(47); // tx signal indicator led pin, don’t care

    Many Thanks.

    • Hi Tom.

      LED Indicator is removed in the new version of DMX library.

      For implement indicator: look for function handle_dmx

      int handle_dmx(artnet_dmx_t *packet)
      {
        digitalWrite(LEDPIN,HIGH); //***************************
      
        if(packet->universe == 0)
        {   
          #if defined(USE_UNIVERSE_0)
            memcpy (ArduinoDmx3.TxBuffer, packet->data, ARTNET_DMX_LENGTH);
          #endif
        }
        else if(packet->universe == 1)
        {   
          #if defined(USE_UNIVERSE_1)
            memcpy (ArduinoDmx2.TxBuffer, packet->data, ARTNET_DMX_LENGTH);
          #endif
        }
        else if(packet->universe == 2)
        {   
          #if defined(USE_UNIVERSE_2)
            memcpy (ArduinoDmx1.TxBuffer, packet->data, ARTNET_DMX_LENGTH);
          #endif
        }
        else if(packet->universe == 3)
        {   
          #if defined(USE_UNIVERSE_3)
            memcpy (ArduinoDmx0.TxBuffer, packet->data, ARTNET_DMX_LENGTH);
          #endif
        }
      
        digitalWrite(LEDPIN,LOW); //***************************
      }
      

      Or look for ideas at:
      http://blog.deskontrol.net/arduino-four-universes-dmx-512-library/#comment-129

      Regards.

  9. Chris

    Hi Toni,

    I am trying to change the subnet of the output ports, however when I change the 0 to a 1 in the following code the output still seems to be on universe 0x00 rather than universe 0x10.

    node->sub = 0;

    Am I doing something wrong here?

    Thanks.

    • Toni Merino

      Hi Chris.

      I am trying to change the subnet of the output ports, however when I change the 0 to a 1 in the following code the output still seems to be on universe 0×00 rather than universe 0×10.

      This is not implemented yet, in a few days I send the necessary modifications.
      Regards.

  10. Sean James

    This project looks like exactly what I need, but I can’t compile the artnet_node sketch. I’m only using UNIVERSE_0, and I’ve commented out the:

    ArduinoDmx3.set_rx_led_pin(-1);
    and
    ArduinoDmx3.set_tx_led_pin(-1);

    lines, since the compiler didn’t like them, but now I’m stuck on:

    artnet_node.cpp: In function ‘int handle_dmx(artnet_dmx_t*)’:
    artnet_node:181: error: invalid conversion from ‘volatile void*’ to ‘void*’
    artnet_node:181: error: initializing argument 1 of ‘void* memcpy(void*, const void*, size_t)’

    with the line:

    memcpy (ArduinoDmx3.TxBuffer, packet->data, ARTNET_DMX_LENGTH);

    highlighted, and I have no idea what that means…

    • Toni Merino

      Hi Sean.
      That’s right, the indicators can not be used with this version:
      //ArduinoDmx3.set_rx_led_pin(-1);
      //ArduinoDmx3.set_tx_led_pin(-1);

      In function “void handle_dmx(artnet_dmx_t *packet)” change:

      memcpy (ArduinoDmx3.TxBuffer, packet->data, ARTNET_DMX_LENGTH);
      to
      memcpy ((uint8_t *)ArduinoDmx3.TxBuffer, packet->data, ARTNET_DMX_LENGTH);

      This afternoon I’ll upload the modified code.
      Regards.

  11. Sean James

    Perfect – all compiles happily now, and I can move on to the next stage of what will eventually be an ArtNet controlled wireless battery-powered RGB lamp.

    Many thanks.

  12. Hi Toni Merino

    In first place thank you for your excelente work.
    I had made some modifications in your code to use the new DMX Library (v0.3) and also added some basic code (I’m not a programmer)to use a small 2×6 LCD, just to easily see active universes and how many channels are defined in active universes.
    I would like to send you this modified code for your evaluation, and if you wish, adjust it or publish it.
    The code is runing well in a prototype box, using 2 universes to control near 800 channels of LED’s (IC 6808 Led Strips, with a dedicated DMX to SPI decoder).
    If you are interested, how can I send you the code?

    Best Regards
    A. Caneira

  13. pieter

    Hi Toni

    great work. I want to use this in my home automation system (using dmx dimmers) and I’m trying to get things working. I downloaded the code to an arduino ethernet and I can ping the arduino. Because I want to use it outside the artnet I configeerd it to be on 192.168.0.30 and gateway 255.255.255.0. When I hookup a dmx lamp I’m not able to get it to do somthing. I’m currently sending the following string to UDP port 6454 “Art-Net P 000E0000000200″ and then 512x”FF”
    Any Idea where I go wrong?

    Best Regards
    Pieter

    • Toni Merino

      Hi Pieter.
      Header for DMX packet is 18 bytes length, follow this example in basic:

      Private Sub SetupArtNet()
      Dim TmpINT As Integer
          'uint8_t  id[8];       // 0-7
          'uint16_t opCode;      // 9-8  ARTNET_DMX = 0x5000,
          'uint8_t  verH;        // 10
          'uint8_t  ver;         // 11
          'uint8_t  sequence;    // 12
          'uint8_t  physical;    // 13
          'uint16_t universe;    // 15-14
          'uint8_t  lengthHi;    // 16
          'uint8_t  length;      // 17
          'uint8_t  data[ARTNET_DMX_LENGTH]; // 18 -> end
          
          'uint8_t  id[8];       // 0-7
          ArtnetPacket(0) = Asc("A")
          ArtnetPacket(1) = Asc("r")
          ArtnetPacket(2) = Asc("t")
          ArtnetPacket(3) = Asc("-")
          ArtnetPacket(4) = Asc("N")
          ArtnetPacket(5) = Asc("e")
          ArtnetPacket(6) = Asc("t")
          ArtnetPacket(7) = 0 'NULL char
          'uint16_t opCode;      // 9-8  ARTNET_DMX = 0x5000,
          ArtnetPacket(8) = &H0
          ArtnetPacket(9) = &H50
          'uint8_t  verH;        // 10 protocol version
          'uint8_t  ver;         // 11 "
          ArtnetPacket(10) = 0
          ArtnetPacket(11) = 14
          'uint8_t  sequence;    // 12
          ArtnetPacket(12) = 0    'secuence number, 0 if not used
          'uint8_t  physical;    // 13
          ArtnetPacket(13) = 0    'physical, 0 if not used
          'uint16_t universe;    // 15-14
          ArtnetPacket(14) = 0    'universe
          ArtnetPacket(15) = 0    'universe
          'uint8_t  lengthHi;    // 16 dmx packet length, ** REQUIRED **
          'uint8_t  length;      // 17
          TmpINT = 512 
          ArtnetPacket(16) = (TmpINT And 65535) \ 256   'len hi
          ArtnetPacket(17) = TmpINT And 255
      
          '512 bytes from here
      End Sub
      
  14. Sean James

    A Happy New Year to you – Question: is it possible to use the MEGA to do an HTP mux of one universe of Artnet and one universe of wired DMX?

    I’d love to be able to run Luminair as an adjunct to my usual lighting desk, and while I could use one node for Artnet to DMX, then another for muxing, that seems inelegant if the MEGA can do both jobs…

    • Toni Merino

      Hi Sean.

      Question: is it possible to use the MEGA to do an HTP mux of one universe of Artnet and one universe of wired DMX?

      In the published Artnet node is not implemented support for multiple Artnet controllers.
      To mix two universes, you have to use a Arduino mega separately, it is still possible that the frame rate with two complete universes is slower than necessary.

      In the examples for deskontrol DMX library, you have the sample code to mix two universes.

      Regards.

  15. Nicholas West

    Has anyone tried this with a Tinkerkit dmx shield? I am having problems getting it to work. Thanks!

Leave a Reply

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