Welcome to %s forums

BrainModular Users Forum

Login Register

Artnet sends data outside of computer like OSC?

General Discussion about whatever fits..
Post Reply
dmitriyc
Member
Posts: 84
Contact:

Artnet sends data outside of computer like OSC?

Unread post by dmitriyc » 08 May 2023, 23:13

Hey There. Been a long time. Had a fun little AI fueled rabbit hole that led me back to Usine 5. I'm trying to catch Artnet to an arduino to drive LEDS using Octows2811 and teensy 4.1 with ethernet attachment. Finally got the right libraries and am seeing my arduino node on the network using ArtNetominator as well as Usine itself and am seeing something odd.... I'm seeing the artnet in real time being sent on the local machine 127.0.0.1 on port 6454, but when I look at my router through ArtNetominator, I don't see the Artnet data leaving the computer and going on the network. Am I missing something here? I am using the Color Array to Artnet Module.

dmitriyc
Member
Posts: 84
Contact:

Unread post by dmitriyc » 09 May 2023, 01:52

so after looking at the documentation a little more carefully, i realized plots are the answer, as they have all the send out data. I made a plot, put an LED on it and then configured everything properly to the point where the test is seen on ArtNetominator on the network, and I'm getting LEDs lighting up! Now the pesky task of actually sending color to the artnet proves more difficult. I tried to point the exact IP address of the arduino and the trusty 192.168.1.255 (broadcasting IP) and nothing yet. I remain optimistic...

Edit:

Ok, now we're cooking, but more questions than answers...I am able to change the colors of the LEDS by using Direct ArtNet module and an array of numbers (ie 255;0;0 to make the 1st LED red), which I thought that's what color Array to ArtNet module was doing, but I guess not. Just had a thought. My arduino is catching an array of numbers per channel, but perhaps that's not what color array is sending to ArtNet. The input isn't a string, so its not the name of the color.... is it the hex code for the color?

User avatar
senso
Site Admin
Posts: 4424
Location: France
Contact:

Unread post by senso » 09 May 2023, 13:49

Usine use the ArtNet DMX protocol: it sends "frames" made of 512 values in the range [0..255], one value per channel. In other words it's an array of Bytes. The Direct-Artnet module fille this array and send it to the ArtNet client.
If your want to light a RGB device is on the channel 1, you have to send the array R,G,B,0,0,0,....0 (509 zeros)

User avatar
oli_lab
Member
Posts: 1261
Location: Brittany, France
Contact:

Unread post by oli_lab » 10 May 2023, 17:02

Hi there,

I did some experiment with LOLIN D1 mini pro ESP8266, RGB led matrix and RGBW led

artnet thru wifi

I'm happy to share :

// pour LOLIN D1 mini pro ESP8266

// first DMX start address
#define DMXSTART 0//canal de départ -1

#include <FastLED.h> // include FastLED *before* Artnet

// Please include ArtnetWiFi.h to use Artnet on the platform
// which can use both WiFi and Ethernet
#include <ArtnetWiFi.h>
// this is also valid for other platforms which can use only WiFi
// #include <Artnet.h>

// WiFi stuff
const char* ssid = "xxxxxxxxx";
const char* pwd = "xxxxxxxxxxx";
const IPAddress ip(192, 168, 0, 112);
const IPAddress gateway(192, 168, 0, 253);
const IPAddress subnet(255, 255, 255, 0);

ArtnetWiFiReceiver artnet;

uint8_t universe = 0; // 0 - 15

// FastLED
#define NUM_LEDS 64
CRGB leds[NUM_LEDS];
const uint8_t PIN_LED_DATA = D5;

uint8_t decalage;

//for RGB LED
void LedSet(uint8_t ledNb, uint8_t redCh, uint8_t greenCh, uint8_t blueCh) {
leds[ledNb] = CRGB(redCh, greenCh, blueCh);
}


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

FastLED.addLeds<NEOPIXEL, PIN_LED_DATA>(leds, NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 1000);
// WiFi stuff
WiFi.begin(ssid, pwd);
WiFi.config(ip, gateway, subnet);
while (WiFi.status() != WL_CONNECTED) {
Serial.println(".");
leds[0] = CRGB(10, 0, 0);//debug : check if fastled OK
FastLED.show(); // Envoyer les couleurs aux LED
delay(50);
leds[0] = CRGB(0, 0, 0);//debug : check if fastled OK
FastLED.show(); // Envoyer les couleurs aux LED
delay(950);
}
Serial.print("WiFi connected, IP = ");
Serial.println(WiFi.localIP());
leds[0] = CRGB(0, 100, 0);//debug : check if fastled OK
FastLED.show(); // Envoyer les couleurs aux LED
delay(1000);
leds[0] = CRGB(0, 0, 0);//debug : check if fastled OK
FastLED.show(); // Envoyer les couleurs aux LED


artnet.begin();

// artnet.subscribe_net(0); // optionally you can change
// artnet.subscribe_subnet(0); // optionally you can change
artnet.shortname("8 x 8 LED panel 1");//keep < 18 char
artnet.longname("8 x 8 LED panel 1 64 RGB LED");//keep <64 char

// if Artnet packet comes to this universe, this function (lambda) is called
artnet.subscribe(universe, [&](const uint8_t* data, const uint16_t size) {
//Serial.print("lambda : artnet data (universe : ");
//Serial.print(universe);
// Serial.print(", size = ");
//Serial.print(size);
//Serial.print(") :");
// for (size_t i = 0; i < size; ++i) {
// Serial.print(data);
// Serial.print(",");
//}
// Serial.println();
if (universe == 0) {
for (int i = 0; i < 170; i++) {
//Serial.println(i);
// get values from DMX
decalage = i * 3;
LedSet(i, data[DMXSTART + decalage], data[DMXSTART + decalage + 1], data[DMXSTART + decalage + 2]);
}
}

if (universe == 1) {
for (int i = 170; i < 256; i++) {
//Serial.println(i);
// get values from DMX
decalage = i * 3;
LedSet(i, data[DMXSTART + decalage], data[DMXSTART + decalage + 1], data[DMXSTART + decalage + 2]);
}
}

});
}

void loop() {
artnet.parse(); // check if artnet packet has come and execute callback
//leds[0] = CRGB(100, 0, 0);//debug : check if fastled OK
//leds[1] = CRGB(0, 100, 0);//debug : check if fastled OK

FastLED.show(); // Envoyer les couleurs aux LED
}
http://oli-lab.org

Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces

follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social

dmitriyc
Member
Posts: 84
Contact:

Unread post by dmitriyc » 24 Jun 2023, 17:44

Ok! I figured it out. Thanks all! Oil_Lab thats great code there!

Post Reply

Who is online

Users browsing this forum: No registered users and 61 guests