Issues with DMXOut connection to an ESP32 board via WiFi

LED for Forum.toe (9.4 KB)
I have just built an LED system with 8 bars, each containing 57 W2812b pixels. Using an Arduino ESP32 board, I receive information from TouchDesigner via WiFi with a private router.

The issue is that most of the time, the information packets do not arrive correctly at the ESP32, and the physical lights end up appearing fragmented and not very smooth. It’s as if only some frames of what is sent actually make it through.

I’m not sure if the problem lies in the Arduino code not reading fast enough, in the TouchDesigner fps (project at 60 and DMXOut tested at 44 and 30, none successful), in the router, or in using more than one ESP32 board… I don’t know.

The thing is, if I install the WLED app on the ESP32, I don’t have any problems. All effects load correctly.

I am quite new to all of this, so it is challenging for me to figure out where the solution might be.

The Arduino code is based on what SparkFun suggests, obviously adapted in terms of the number of LEDs, GPIO PIN, SSID, etc., for my system: SparkFun Artnet/DMX ESP32 Code

I am also attaching the TouchDesigner project in case it clarifies anything for someone.

Thank you very much in advance.

How many ESPs do you have, and how many LED strips does each of them drive?
From a brief glance, the null3 TOP that is the input for the toptoCHOP has a resolution of 256x256. The gaps that you can see causes the fragmented appearance on your LEDs. Instead, try combining each rectangleTOP into a single TOP in such a way that the resolution is 57x8, each row representing a single LED strip, with no gap. Have a look at this:
LED for Forum 8x57 TOP.toe (10.6 KB)
Hope this helps!

Please provide the piece of code that handles the ArtNet data on your ESP for better understanding of your situation.

Hi, thank you very much for your answer.

It still doesn’t working. I have 1 ESP32 for all the 456 pixels (8 LED Strips x 57). ¿Maybe are too many pixels for only one ESP?

The piece of code is this one (a copy-paste from Using Artnet DMX and the ESP32 to Drive Pixels - SparkFun Learn) :

#include <WiFi.h>
#include <WiFiUdp.h>
#include <ArtnetWifi.h>
#include <FastLED.h>

//Wifi settings - be sure to replace these with the WiFi network that your computer is connected to

const char* ssid = "myWiFi";
const char* password = "myPassword";

// LED Strip
const int numLeds = 456; // Change if your setup has more or less LED's
const int numberOfChannels = numLeds * 3; // Total number of DMX channels you want to receive (1 led = 3 channels)
#define DATA_PIN 4 //The data pin that the WS2812 strips are connected to.
CRGB leds[numLeds];

// Artnet settings
ArtnetWifi artnet;
const int startUniverse = 0;

bool sendFrame = 1;
int previousDataLength = 0;

// connect to wifi – returns true if successful or false if not
boolean ConnectWifi(void)
{
  boolean state = true;
  int i = 0;

  WiFi.begin(ssid, password);
  Serial.println("");
  Serial.println("Connecting to WiFi");

  // Wait for connection
  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
    if (i > 20){
      state = false;
      break;
    }
    i++;
  }
  if (state){
    Serial.println("");
    Serial.print("Connected to ");
    Serial.println(ssid);
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());
  } else {
    Serial.println("");
    Serial.println("Connection failed.");
  }

  return state;
}

void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
{
  sendFrame = 1;
  // set brightness of the whole strip 
  if (universe == 15)
  {
    FastLED.setBrightness(data[0]);
  }
  // read universe and put into the right part of the display buffer
  for (int i = 0; i < length / 3; i++)
  {
    int led = i + (universe - startUniverse) * (previousDataLength / 3);
    if (led < numLeds)
    {
      leds[led] = CRGB(data[i * 3], data[i * 3 + 1], data[i * 3 + 2]);
    }
  }
  previousDataLength = length;     
  FastLED.show();
}

void setup()
{
  Serial.begin(115200);
  ConnectWifi();
  artnet.begin();
  FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, numLeds);

  // onDmxFrame will execute every time a packet is received by the ESP32
  artnet.setArtDmxCallback(onDmxFrame);
}

void loop()
{
  // we call the read function inside the loop
  artnet.read();
}

Thanks in advance

Apart from incorporating your proposed change, I have been testing my ESP32 with just one LED strip programmed and connected and it still gives me the same errors :frowning:

Hmm, I will try to recreate it as soon as I get home tomorrow. But 456 pixels should be okay for 1 ESP to handle. It would be helpful you could attach a video of what you see on the LEDs as well. Thanks!

Thank you very much.

I attach a Youtube link because it seem is not possible to atttach videos in the forum (https://www.youtube.com/shorts/Q4L9BeSqOu8?feature=share)

Try adding a netaddress column to your routingtable. Right now you are broadcasting all data to all EPS devices. This means that they anyway receive all the universes and at least have to check them.

Addresses can be specified by adding rows for each channel and specifying net, subnet, universe, and netaddress. The net, subnet, universe, and netaddress columns are optional and correspond to the DMX Out CHOP’s Net, Subnet, Universe, and Network Address parameters respectively.

I will test it, but seeing that I have only 1 ESP32 it shouldn’t make difference isn’t it?

Thanks you.

Would an Enttec device be the solution? I would lose the wireless connection, but I understand that I would be able to solve the problem, right?

I’ve never used an Enttec before, so some guidance would also be helpful!

Ah sorry, was under the assumption that there is one ESP per fixture.
I just threw this in as we had issues with motocontrollers being overwhelmed when we broadcastet ArtNet to pixelStripes.