Pages: [1]   Go Down
Author Topic: E1.31 DMX over Ethernet  (Read 2199 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am looking to send commands using the E1.31 protocol to control DMX devices on the network.  Has anyone tried sending E1.31 network commands with the Arduino?  
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'll start by saying that i'm extremely freaked out by the fact that someone by the name of mercer (also my surname) has posted almost the exact question that I want to ask.

I've only just joined this forum and this is my first post.

I am a student working on my final year project and I want to control an Arduino Uno with Ethernet Shield and DMX shield from a browser interface.

I have so far managed to use just the Uno and Ethernet Shield to control 3 LEDs using a form created by editing some example code i found.

It's worth mentioning that I am a complete novice at writing/understanding code and I havent got much time to learn.

I havent bought or tried anything with a DMX shield yet either.

This is the code I currently have:

/*
  Web Server
 
 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield.
 
 */

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0xE9, 0x21 };
IPAddress ip(192,168,1,177);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup()
{
  Serial.begin(9600);    //  open up serial port connection to PC
  pinMode(5, OUTPUT);    //  Set digital pin 5, 6, 3 as output
  pinMode(6, OUTPUT);
  pinMode(3, OUTPUT);
 
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
}

void showLEDstatus (EthernetClient client){
          if (digitalRead(5)){  //  1<-- Display LED status
            int val = analogRead (5);
            client.print("RED LED is ON: ");
            client.print(val);
            client.println("<br />");
          }else{
            client.print("   RED LED is OFF");
            client.println("<br />");
          }
         
          if (digitalRead(6)){  //  1<-- Display LED status
            int val = analogRead (6);
            client.print("   YELLOW LED is ON: ");
            client.print(val);
            client.println("<br />");
          }else{
            client.print("   YELLOW LED is OFF");
            client.println("<br />");
          }
         
          if (digitalRead(3)){  //  1<-- Display LED status
            int val = analogRead (3);
            client.print("   Green LED is ON: ");
            client.print(val);
            client.println("<br />");
          }else{
            client.print("   Green LED is OFF");
            client.println("<br />");
          }
         
          client.println("<br />");
}

void loop()
{
  // listen for incoming clients
  EthernetClient client = server.available();
 
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    String buffer = "";  //  Declare the buffer variable

    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.print(c);  //  Send every character read to serial port
        buffer+=c;        //  Assign to the buffer

        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          showLEDstatus (client);

          // 2<-- Create a form
          client.print("<FORM action=\"http://192.168.1.177/\" >");
          client.print("<P> <INPUT type=\"radio\" name=\"statusred\" value=\"1\"> RED ON\n");
          client.print("<P> <INPUT type=\"radio\" name=\"statusred\" value=\"0\"> RED OFF\n");
          client.print("<P> <INPUT type=\"radio\" name=\"statusyel\" value=\"1\"> YELLOW ON\n");
          client.print("<P> <INPUT type=\"radio\" name=\"statusyel\" value=\"0\"> YELLOW OFF\n");
          client.print("<P> <INPUT type=\"radio\" name=\"statusgre\" value=\"1\"> GREEN ON\n");
          client.print("<P> <INPUT type=\"radio\" name=\"statusgre\" value=\"0\"> GREEN OFF\n");
          client.print("<P> <INPUT type=\"submit\" value=\"Go\"> </FORM>");

          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
          buffer="";       //  Clear the buffer at end of line
        } else if (c == '\r') {           
          if(buffer.indexOf("GET /?statusred=1")>=0)
            digitalWrite(5, HIGH);  // Catch ON status and set LED
         
          if(buffer.indexOf("GET /?statusred=0")>=0)
            digitalWrite(5, LOW);  // Catch OFF status and set LED
         
          if(buffer.indexOf("GET /?statusyel=1")>=0)
            digitalWrite(6, HIGH);  // Catch ON status and set LED
         
          if(buffer.indexOf("GET /?statusyel=0")>=0)
            digitalWrite(6, LOW);  // Catch OFF status and set LED
           
          if(buffer.indexOf("GET /?statusgre=1")>=0)
            digitalWrite(3, HIGH);  // Catch ON status and set LED
         
          if(buffer.indexOf("GET /?statusgre=0")>=0)
            digitalWrite(3, LOW);  // Catch OFF status and set LED
       
        }
        else {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
  }
}

I have no idea how i would integrate DMX output code so that it could be controlled by 0-255 faders for red green and blue on the browser.

Thanks in advance for any help.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Is interesting for me too.

I have example how to send DMX from Arduino. But they are on my work PC and will post tomorrow.

But I have questions:

Mercer, because I don't have any device who support E1.31 DMX is available software who support E1.31 protocol?
I like first to test receiving E1.31 protocol, next will try to send when have ready E1.31 receiver.

Wmercer, do you have DMX device? LED Moving Head or similar?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Check out the following page:  http://arduino.cc/playground/Learning/DMX.  There is an example that sends ArtNet using UDP.  I haven't tried the example, but this may provide a good starting point.  You may need to modfiy the data package being sent.

Also, see http://sacnview.sourceforge.net/.  This tool allows you to send/recieve DMX commands on the network using E1.31.  This would allow you verify the Arduino is working without investing in more hardware. 
Logged

Pages: [1]   Go Up
Jump to: