DMX network

Dear all

I’m fairly new to doing more serious projects with Arduino.

Let me describe my project very shortly: An Arduino Mega reads analog and digital inputs, and will output dmx appropriately.
So far everything is working out fine. I’m using a MAX485 (RS485) chip (bought here) to go from the Arduino to a DMX-signal. I’m using the library “dmxSimple” to create the signal that goes into the MAX485.

In the situation that I’m going to be deploying this project, I will need to have multiple Arduino’s and I will need to link them by DMX. Meaning that besides a DMX output, I also need a DMX input. There is a good reason why I need to go over DMX to link several Arduino’s. I’m not going to elaborate here, but can explain someone if interested.

Now I cannot find anything online on how to use the MAX485 as DMX input card, nor how to program the Arduino properly. I could think of a loop that reads all channels except the ones it controls itself, but I’m not sure on the read command for the DMX input.

Other solutions beside the MAX485 are definitely welcome. But I already searched for multiple hours online and haven’t found anything else. Because all boards (like the CTC-DRA-10-R2 for example) can only do sending or receiving, not both at once.

I hope to find someone who can give me the clue for making this project happen!

I don’t know if it’s useful, but I added my current code and setup (with 1 MAX485 for DMX output).

Many thanks in advance!
Anthony Leliaert

#include <DmxSimple.h>

void setup() {
  Serial.begin(9600);
  Serial.println("Arduino dmx started");
  
  DmxSimple.usePin(3); /* Default digital pin is 3, change here if necessary */
  DmxSimple.maxChannel(512); /* Change heighest channelnumber to be sent */

  pinMode(10,INPUT_PULLUP);
  pinMode(13, OUTPUT);
}

void loop() {

  /* DECLARING AND READING */
    /* ANALOG INPUTS */
    int AnIn0 = map(analogRead(A0), 0, 1023, 0, 255);

    /* DIGITAL INPUTS */
    int DigIn10 = digitalRead(10);

  /* OUTPUTTING DMX-DATA */
    /* FIXED OUTPUTS */
    DmxSimple.write(100, 255); /* TEST OUTPUT 1 */
  
    /* ANALOG INPUTS */
    DmxSimple.write(1, AnIn0); /* POTENTIOMETER */

    /* DIGITAL INPUTS */
    if (DigIn10 == HIGH) { DmxSimple.write(2, 0); } else { DmxSimple.write(2, 255); } /* BUTTON */

    /* ONBOARD TEST */ 
    if (DigIn10 == HIGH) {
      digitalWrite(13, LOW);
    } else {
      digitalWrite(13, HIGH);
    }
  
  delay(1); /* Delay for stability of readings */
}

You can use Arduino Mega's with 4x hardware serial ports and a 4x Universe library (here) and you will be able to read/write DMX with a suitable shield.