Giter Club home page Giter Club logo

Comments (5)

rstephan avatar rstephan commented on August 16, 2024

It's hard to tell.
How many Art-Net frames per second?
How many Art-Net channels?
Only one LED, just brightness up and down?

Can you share your code, maybe a snipped?
The onDmxFrame() should only be a one-liner, am I right?

In many cases it's just bad WiFi.

from artnetwifi.

paulcaillard avatar paulcaillard commented on August 16, 2024
  • I use QLC+ to send Art-net Data ; I think it sends data at 30 fps.
  • Only 1 Art-Net channel, in one universe
  • Yes, I send fade up and fade down signal.

Here's my code :

#include <ArtnetWifi.h>
#include <Arduino.h>

// PWM
const int freq = 5000; // 5000 Hz
const int ledChannel = 0;
const int resolution = 8; // Résolution de 8 bits

// LED COB RGBW
const int ledPinR = 15;
int ledValueR;

// WIFI
const char* ssid = "xxxxx";
const char* password = "xxxxx";
WiFiUDP UdpSend;

// connect to wifi – returns true if successful or false if not
bool ConnectWifi(void)
{
  bool 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(IPAddress(WiFi.localIP()));
  } else {
    Serial.println("");
    Serial.println("Connection failed.");
  }
  
  return state;
}

// ARTNET
ArtnetWifi artnet;
const int startUniverse = 0; // CHANGE FOR YOUR SETUP most software this is 1, some software send out artnet first universe as 0.
const int numberOfChannels = 3; // Total number of channels you want to receive
// Check if we got all universes
const int maxUniverses = numberOfChannels / 512 + ((numberOfChannels % 512) ? 1 : 0);
bool universesReceived[maxUniverses];
bool sendFrame = 1;


void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data) {
  
  sendFrame = 1;
  
    // range check
  if (universe < startUniverse)
  {
    return;
  }
  uint8_t index = universe - startUniverse;
  if (index >= maxUniverses)
  {
    return;
  }

  // Store which universe has got in
  universesReceived[index] = true;

  for (int i = 0 ; i < maxUniverses ; i++)
  {
    if (!universesReceived[i])
    {
      sendFrame = 0;
      break;
    }
  }
  if (sendFrame) {
  // PWM
  ledcWrite(ledChannel, data[1]);
  // Reset universeReceived to 0
  memset(universesReceived, 0, maxUniverses);
  }
}


void setup() {
  
  Serial.begin(115200);
  ConnectWifi();

  // ARTNET
  // this will be called for each packet received
  artnet.setArtDmxCallback(onDmxFrame);
  artnet.begin();

  // PWM
  // Configure le channel 0
  ledcSetup(ledChannel, freq, resolution);
  // Attache le channel 0 sur les 3 pins
  ledcAttachPin(ledPinR, ledChannel);
}

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

If you think it might be the bad wifi, I would try to create a wifi access point with another ESP32.

from artnetwifi.

paulcaillard avatar paulcaillard commented on August 16, 2024

I tried to connect my PC & the esp32 to an esp32 wifi access point ; this doesn't work either.

from artnetwifi.

rstephan avatar rstephan commented on August 16, 2024

There is nothing wrong with the code.
I can reproduce the "error" only if my PC (Art-Net transmitter) is also connected via WiFi.
With a cable connection to my PC I don't see a problem at all. A test ran over many hours flawlessly.

So, as I said, bad WiFi is the problem in my opinion.

from artnetwifi.

HankLloydRight avatar HankLloydRight commented on August 16, 2024

I'm also having a similar delay problem -- my Artnet transmitter (PC program) is on ethernet, but sometimes it takes 20 seconds or more for the ESP32 to receive the DMX changes. And then sometimes it's immediate, so it's a very strange intermittent problem.

I'm sure it's not this library, but my question is-- where are those Art-Net packets going for 20 or 30 seconds before the ESP32 receives and processes them?

from artnetwifi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.