Seeking help with Opta for Artnet over Ethernet

I've been working on a lighting project and have been building with the Arduino Opta. I am successfully sending artnet data over ethernet, but it times out after about 6-10 minutes. All traffic from the port stops, but serial monitor shows it is still processing data. Here is some debugging code. There are some things that were suggested to try and this has been simplified for testing. Thanks for taking a look!

#include <ArtnetEther.h>
#include <Ethernet.h>

// Ethernet Configuration
const IPAddress ip(192, 168, 0, 201);
const IPAddress dns(192, 168, 0, 1);
const IPAddress gateway(192, 168, 0, 1);
const IPAddress subnet(255, 255, 255, 0);
uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB};

// Art-Net Configuration
ArtnetSender artnet;
const String target_ip = "192.168.0.1";
uint16_t universe = 0;

// DMX Data
const uint16_t size = 512;
uint8_t data[size];
unsigned char maxBrightness = 200;
unsigned char minBrightness = 35;

// Fading Parameters
unsigned long fadeTime[] = {20000, 15000, 12000, 18000, 11000};

void setup() {
    Serial.begin(115200);
    delay(1000);

    Ethernet.begin(mac, ip, dns, gateway, subnet);
    artnet.begin();
    memset(data, 0, size);

    Serial.println("Art-Net DMX Sender Started");
}

void loop() {
    static unsigned long lastFrame = 0;
    static unsigned long lastDebug = 0;
    unsigned long now = millis();

    // Frame update every 25ms
    if (now - lastFrame >= 25) {
        calculateBrightness();
        sendArtNet();
        lastFrame = now;
    }

    // Debugging every 1 second
    if (now - lastDebug >= 1000) {
        Serial.println("Loop is running...");
        lastDebug = now;
    }

    Ethernet.maintain(); // Keep Ethernet connection alive
}

void calculateBrightness() {
    unsigned long time = millis();

    for (int i = 0; i < 27; i++) {
        unsigned long currentFadeTime = fadeTime[i % 5];
        unsigned long currentStep = time % (currentFadeTime * 2);
        unsigned char brightness;

        // Fading logic
        if (currentStep <= currentFadeTime) {
            brightness = currentStep * maxBrightness / currentFadeTime;
        } else {
            brightness = maxBrightness - (currentStep - currentFadeTime) * maxBrightness / currentFadeTime;
        }

        brightness = constrain(brightness, minBrightness, maxBrightness);
        data[i] = brightness;

        // Debugging
        if (i < 5) { // Print for the first few channels
            Serial.print("Channel ");
            Serial.print(i + 1);
            Serial.print(": ");
            Serial.println(brightness);
        }
    }
}

void sendArtNet() {
    artnet.setArtDmxData(data, size);
    artnet.streamArtDmxTo(target_ip, universe);
    Serial.println("Art-Net packet sent.");
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.