Esp32 smartmatrix artnet

Hello,
has anyone developed Artnet projects with panels and smartmatrix?
I’m trying some codes but with poor results …
I think it is interesting to be able to send graphics, video, remotely with software such as: Resolume, madmapper, Jinx, etc.
Thanks.

Artnet works with FastLED, does it not?
If you have it working on FastLED::NeoMatrix, it should work trivially with SmartMatrix::GFX

Hi Marc,
currently the code i am testing is wrong …
I’m making clothes with addressable LEDs like yours,
I would like to insert a 64x32 matrix but with artnet I have difficulties.
I have seen your projects and they are very interesting!
Have you tried driving them with artnet? or have you ever done tests?
I’d be happy to share the developments with you …
thank you very much!

Sorry, Arnet is not something I’ve had the time to play with, although I need to at some point.
What would be the main benefits of arnet for you?
What matrix size are you aiming for?

Artnet is a useful protocol for managing content remotely, compatible with the world of lights, therefore managed by lighting console. moreover, the video graphics can be managed at the moment, placed in timeline with backing tracks, in sync with other lights etc. for now I would like to manage a 64x32 matrix. if you want I can share the code that I am testing

I’m interested in seeing how you get ArtNet and SmartMatrix working together. One concern I have is the bandwidth for receiving that amount of pixel data over WiFi, but it looks like someone else has done even larger dimensions. I believe his code is open source, and he was actively commenting on YouTube, and he’s also active in the FastLED Reddit, so maybe you can try his code if that helps:

Hi
I have already made large LEDs and everything works very well, but with LEDs WS2812B, and not with LED panels, I am now trying with these.
for example with a 32x32 matrix of ws2812b the bandwidth is 900Kbps (very little).
I’m also testing an olimex esp32 with lan cable …

#include <WiFi.h>
#include <WiFiClient.h>
#include <Artnet.h>
#include <WiFiUdp.h>
#define FASTLED_ALLOW_INTERRUPTS 0 
#define INTERRUPT_THRESHOLD 1 
#include "FastLED.h"
FASTLED_USING_NAMESPACE
#define FASTLED_SHOW_CORE 0
#define LED_PANEL_WIDTH 32
#define LED_PANEL_HEIGHT 32
#define NUM_PANELS 4 
#define NUM_LEDS_PANEL LED_PANEL_WIDTH*LED_PANEL_HEIGHT 
#define NUM_LEDS NUM_LEDS_PANEL*NUM_PANELS  
#define UNIVERSE_SIZE 170 


#define BRIGHTNESS          200 


CRGB leds[NUM_LEDS];

Artnet artnet;

static TaskHandle_t FastLEDshowTaskHandle2 = 0;
static TaskHandle_t userTaskHandle = 0;

void FastLEDshowESP322()
{
    if (userTaskHandle == 0) {
        const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 );
        userTaskHandle = xTaskGetCurrentTaskHandle();
        xTaskNotifyGive(FastLEDshowTaskHandle2);
    }
}

void FastLEDshowTask2(void *pvParameters)
{
    const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 500 );
     for(;;) {
         ulTaskNotifyTake(pdTRUE,portMAX_DELAY);
         memcpy(leds,artnet.getframe(),NUM_LEDS*sizeof(CRGB));
         FastLED.show();
         userTaskHandle=0;
     }
}
/*//
void initTest()
{
  for (int i = 0 ; i < NUM_LEDS ; i++) {
    leds[i] = CRGB(127, 0, 0);
  }
  FastLED.show();
  delay(500);
  for (int i = 0 ; i < NUM_LEDS ; i++) {
    leds[i] = CRGB(0, 127, 0);
  }
  FastLED.show();
  delay(500);
  for (int i = 0 ; i < NUM_LEDS ; i++) {
    leds[i] = CRGB(0, 0, 127);
  }
  FastLED.show();
  delay(500);
  for (int i = 0 ; i < NUM_LEDS ; i++) {
    leds[i] = CRGB(127, 127, 127);
  }
  FastLED.show();
  delay(500);
  for (int i = 0 ; i < NUM_LEDS ; i++) {
    leds[i] = CRGB(0, 0, 0);
  }
  FastLED.show();
}
*/
void setup() {
 Serial.begin(115200);
   xTaskCreatePinnedToCore(FastLEDshowTask2, "FastLEDshowTask2", 1000, NULL,3, &FastLEDshowTaskHandle2, FASTLED_SHOW_CORE);
   WiFi.mode(WIFI_STA);
   Serial.printf("Connecting ");


IPAddress ip(2, 0, 0, 45);
IPAddress gateway(2, 0, 0, 1);
IPAddress subnet(255, 0, 0, 0);

   
   WiFi.config(ip, gateway, subnet);
   WiFi.begin("pixel", "password");  
   
   while (WiFi.status() != WL_CONNECTED) {
     Serial.println(WiFi.status());
     delay(500);
     Serial.print(".");
    }
    Serial.println("");
    Serial.println("WiFi connected.");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
   
   // limit my draw to 1A at 5v of power draw
   //FastLED.setMaxPowerInVoltsAndMilliamps(5,1000); 
   // limit my draw to 5W
   //FastLED.setMaxPowerInMilliWatts(5000);
   FastLED.addLeds<NEOPIXEL, 23>(leds, 0, NUM_LEDS_PANEL); 
   FastLED.addLeds<NEOPIXEL, 13>(leds, NUM_LEDS_PANEL, NUM_LEDS_PANEL);
   FastLED.addLeds<NEOPIXEL, 14>(leds, 2 * NUM_LEDS_PANEL, NUM_LEDS_PANEL);
   FastLED.addLeds<NEOPIXEL, 12>(leds, 3 * NUM_LEDS_PANEL, NUM_LEDS_PANEL); 
   
   FastLED.setBrightness(BRIGHTNESS);
   artnet.begin(NUM_LEDS,UNIVERSE_SIZE,1);
  // initTest(); 
}

void loop() {
  artnet.read();
  FastLEDshowESP322();
  artnet.resetsync();
 
}
this is what I'm using with a 64x32 panel instead:

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

//matrixCreation
#define COLOR_DEPTH 24                  // known working: 24, 48 - If the sketch uses type `rgb24` directly, COLOR_DEPTH must be 24
const uint8_t kMatrixWidth = 64;        // known working: 32, 64, 96, 128
const uint8_t kMatrixHeight = 32;       // known working: 16, 32, 48, 64
const uint8_t kRefreshDepth = 36;       // known working: 24, 36, 48
const uint8_t kDmaBufferRows = 4;       // known working: 2-4, use 2 to save memory, more to keep from dropping frames and automatically lowering refresh rate
const uint8_t kPanelType =  SMARTMATRIX_HUB75_32ROW_MOD16SCAN   ;   // use SMARTMATRIX_HUB75_16ROW_MOD8SCAN for common 16x32 panels
const uint8_t kMatrixOptions = (SMARTMATRIX_OPTIONS_NONE);      // see http://docs.pixelmatix.com/SmartMatrix for options
const uint8_t kBackgroundLayerOptions = (SM_BACKGROUND_OPTIONS_NONE);
SMARTMATRIX_ALLOCATE_BUFFERS(matrixx, kMatrixWidth, kMatrixHeight, kRefreshDepth, kDmaBufferRows, kPanelType, kMatrixOptions);
SMARTMATRIX_ALLOCATE_BACKGROUND_LAYER(backgroundLayer, kMatrixWidth, kMatrixHeight, COLOR_DEPTH, kBackgroundLayerOptions);

const int defaultBrightness = 100*(255/100);    // full brightness

//artnetCreation
ArtnetWifi artnet;
const int startUniverse = 0; 
const int numberOfChannels = 6144;
byte channelBuffer[numberOfChannels + 1]; 
const int maxUniverses = (numberOfChannels / 512 + ((numberOfChannels % 512) ? 1 : 0));   
bool universesReceived[maxUniverses];
bool sendFrame = 0;

// WiFi INFO
const char ssid[] = "pixel"; 
const char pwd[] =  "password" ; 

//On DMX *Artnet packet
void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
{ 
 
  sendFrame = 1;
 
 if (universe < maxUniverses) universesReceived[universe] = 1; // Store which universe has got in

  for (int i = 0; i < length; i++) // Load data into the channelBuffer arrey at the right spot 
  {
    int bufferIndex = i + ((universe - startUniverse) * length);
    if (bufferIndex < numberOfChannels) // to verify
      channelBuffer[bufferIndex] = byte(data[i]);
  }
  
  for (int i = 0; i < maxUniverses; i++) //check if all universes are there
  {
    if (universesReceived[i] == 0)
    {
      sendFrame = 0;
      break;
    }
  }
  
  if (sendFrame) //if all universes are there, send frame to display
  {
    
  int ii = 0;

  //Split Loading into 2 smaller loops *for some reason it works faster 
  for (int16_t y=0;y<kMatrixHeight/2; y++)
  for (int16_t x=0;x<kMatrixWidth; x++)
  {
    backgroundLayer.drawPixel(x, y, CRGB( channelBuffer[(ii * 3)] , channelBuffer[(ii * 3) + 1], channelBuffer[(ii * 3) + 2]));
    ii++;
  } 
  for (int16_t y=16;y<kMatrixHeight; y++)
  for (int16_t x=0;x<kMatrixWidth; x++)
  {
    backgroundLayer.drawPixel(x, y, (CRGB(channelBuffer[(ii * 3)] , channelBuffer[(ii * 3) + 1], channelBuffer[(ii * 3) + 2])));
    ii++;
  } 
       
    backgroundLayer.swapBuffers(); //Display the loaded frame
    memset(universesReceived, 0, maxUniverses);// Reset universeReceived to 0   
  }
}


void setup() 
{

   //Wait for it lol (slowish boot)
   delay(3000);
   
   matrixx.addLayer(&backgroundLayer); //pretty self exp .. creates a new "background layer"
   matrixx.begin(); //starts SmartMatrix
   backgroundLayer.enableColorCorrection(true); //Reduce blinding brightness
   backgroundLayer.swapBuffers(); //Clear buffer loaded to error check 
 
  Serial.begin(115200); //Start Serial Output 
  Serial.print("Start"); 

 //WiFiConnectionInitialization
  WiFi.mode(WIFI_STA);
IPAddress ip(2, 0, 0, 100);
IPAddress gateway(2, 0, 0, 1);
IPAddress subnet(255, 0, 0, 0);

   
   WiFi.config(ip, gateway, subnet);
  
  WiFi.begin(ssid, pwd);
  while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); }
  Serial.print("WiFi connected, IP = "); Serial.println(WiFi.localIP());

  //ArtnetInitialization
  artnet.begin();
  artnet.setArtDmxCallback(onDmxFrame); //gets called if a frame comnplete


 }

void loop() 
{
  artnet.read(); 
}

I edited your posts to add your code in a “Preformatted text” block, so it’s easier to read. The button for that looks like </> in the editing toolbar.

currently the code i am testing is wrong …

I would like to insert a 64x32 matrix but with artnet I have difficulties.

What are the issues you’re seeing?

What Artnet library are you using?


I can’t address the LEDs individually
but when I address a single LED, a line of 64 lights up simultaneously

Have you tested with an example sketch, and is that displaying properly?

Yes, OK
the problem is when I use the panel 64x32 with smartmatrix

You didn’t describe the problem

I can’t address the LEDs individually
but when I address a single LED, a line of 64 lights up simultaneously