Git Product home page Git Product logo

artnetwifi's People

Contributors

2bbb avatar charno avatar eddwatts avatar floedelmann avatar natcl avatar niliha avatar rstephan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

artnetwifi's Issues

Lag after 30 sec

Hello,

I'm using an ESP32 to control a LED COB with a PWM.
After the upload, everything is fine. But after 30 sec, the data received by the ESP32 in wifi start to lag. I tried with the debugging program but nothing works: after a few seconds, the data received on the serial are jerky.

I think it's a memory problem, do you have any solutions?

artnet stopping

Hi. I have a problem using this sceetch:

/*
This example will transmit a universe via Art-Net into the `Network.
  This example may be copied under the terms of the MIT license, see the LICENSE file for details
*/

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <ArtnetWifi.h>
#include <MIDI.h>

float britnes = 0;
int cha = 0;
float britnesm[520];



int i;



unsigned long currentMillis;
unsigned long previousMillis;

//Wifi settings
const char* ssid = "louna"; // CHANGE FOR YOUR SETUP
const char* password = "woolstreet"; // CHANGE FOR YOUR SETUP

MIDI_CREATE_DEFAULT_INSTANCE();

// Artnet settings
ArtnetWifi artnet;

const int startUniverse = 2;
const char host[] = "192.168.0.255";


// 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.");
    digitalWrite(12,LOW);
  }

  return state;
}

void setup()
{
 
   pinMode(12, OUTPUT);
 digitalWrite(12,HIGH);


  //Serial.begin(115200);
  ConnectWifi();
  artnet.begin(host);
  artnet.setLength(512);
  artnet.setUniverse(startUniverse);

  MIDI.begin(MIDI_CHANNEL_OMNI);
  MIDI.setHandleControlChange(MyHandleNoteOn);


 
}
  


void loop()
{

  currentMillis = millis();

  if (currentMillis - previousMillis >= 5000) {

    previousMillis = currentMillis;


    for (i = 0; i <= 511; i++) {

     
      artnet.setByte(i, britnesm[i]);

      artnet.write();
    }
    }
    
  MIDI.read();
  
  if (WiFi.status() == 6) {
  digitalWrite(12,LOW);
 }
 
  yield();

}

void MyHandleNoteOn(byte channel, byte number, byte value) {

  if (channel = 1) {

    cha = number - 1;
    britnes = value * (255.0 / 127.0);
   

    artnet.setByte(cha, britnes);

   artnet.write();
  
 
britnesm[cha] = britnes;

  }

  }

When ESP 07 working for 1 - 12 hours artnet sending stoped. Wifi connection is good. But artnet don't send something (And artnet node is not show in net)

When i add this code problem is out. But it's not good to begin host every loop:

yield();

  artnet.begin(host);
  artnet.setLength(512);
  artnet.setUniverse(startUniverse);

}

Unable to poll

Hi,

Thanks you for the work you have put into this! Any changes I make I will ensure i submit a PR!

I have been able to make your code work correctly with regards to receiving an artnet packet and acting upon it by changing the state of my neopixel, however the software I am using (Onyx) is not able to detect the unit.... does the library contain the functionality to respond with the appropriate discovery/polling messages?

Sorry if this doesn’t make sense. I am still in early days of working with artnet!

Thanks.

ESP8266 Library

Where do I find the ESP8266 Library that includes ESP8266WiFi.h file. I've downloaded what I thought was the correct library however the build still fails first as it is missing the file "#include "

Wifi ArtNet Timing

Thank you very much for sharing your code. I can receive ArtNet data I generate with MadMapper. Unfortunately, I get some stuttering. The ArtNet packages are generated at 44 fps. Using Wireshark, I can see these packages at the ethernet port at approximately every 0,02 s. However, my router "groups" the packages and transmits e.g. ten with 0,0002 s temporal spacing. Afterwards there is a small break and so on. Almost all packets are received, but with a wrong timing. Because this is the case for both of the available routers (FritzBox and TimeCapsule) I was wondering if someone else had run into the same issue. Maybe there is a way to force the wifi router to preserve the ArtNet timing?

Ws2812

Is it possible to use this code with ws2812b?

Different artnet sub nets

How might I go about setting a different artnet subnet. Im building a large led matrix which will need16 universes but i still need a couple for my regular dmx lighting?
Thanks

Network timeout

Code seems stable but when the node connects without artnet data being sent it renews its lifetime counter for 20:00 if i send artnet data the timer never renews and eventually the unit disconnects and reboots. If I ping the unit then the timer stays live and connection stays stable. Do you know why it does this?

ws2801 lagging / skipping a frame every few seconds + flickering

Hello,
First of all, thank you for your work!

I tried to rework an old ws2801 led matrix, which is driven by a Raspberry Pi with OLA as an artnet->pixel gateway, with an ESP32 based on this firmware. My goal was to be able to free the Pi incl. USB Wifi adapter for other projects and to replace it with a more economical, slimmer always-on solution.
The matrix consists of 4 panels connected in series with 8x8 pixels each. So it is basically a long string of 256 ws2801 modules.
The voltage adjustment of the data and clock signals from 3.3 to 5V is done with a 74HCT08P.
The pixels are divided into 2 universes with 384 channels each, the control is currently done with Jinx and this setup has worked very well so far.

The change from the Raspberry Pi to an ESP32 board was pretty straightforward and so the matrix lit up again very quickly.
After the initial joy that everything seemed to work as I hoped it would, I quickly noticed two problems that didn't occur with the RasPi setup:

  1. The animations stop every few seconds for a fraction of a second.
    The intervals between the dropouts are felt to be random and are in the range of 1...2 seconds. As if a buffer is running empty.
    It can be observed that the dropouts do not occur for a short time immediately after resetting the ESP.
    I can also observe in the web interface of my access point that a better data rate is displayed for the ESP module immediately after the connection is established, which quickly drops to a lower value and generally doesn't seem to be within the range of 802.11n, but rather b.
    Maybe this has something to do with it.

  2. With the ESP32 suddenly the typical flickering of the leds appears, which indicates an unclean signal or a too high SPI speed, and I don't get it turned off completely.
    It shows up by default only in the last leds of the last panel. Since I suspected the SPI speed, I tried to reduce it by calling FastLED.addLeds with the parameter DATA_RATE_MHZ(1) or even DATA_RATE_KHZ(500). The results were relatively similar and there was no real improvement. However, with a higher data rate I was able to quickly increase the flickering... What is the default rate anyway?
    In my RasPi-OLA setup 2MHz SPI speed is set and nothing flickers. Also I still use the 74HCT08P circuit as a 5V "driver", so I can hardly explain this sudden deterioration. By the way, changing the output pins didn't change anything either.

I realize that there are many components involved here, and this may not be the best place to address these issues. But maybe you or someone here has had a similar situation before and can give me a hint in the right direction. If you need further information, please let me know.
Thank you very much.

Delay

I am using an ESP32 and a custom made PCB to covert an art-net signal to a 0-10v analogue signal for a dimmer rack however i am noticing some issues with delay. increasing the brightness of a fixture is delayed by approximately 4 seconds and decreasing the brightness is approximately 8 seconds.

During development i had it set so that i sent values via the serial monitor and that was instant so i know it isn't an issue with my circuitry or the way im interfacing with it.

i can also see that other devices on my network react instantly even over WIFI so i believe my transmission is fine.

This is my code https://pastebin.com/RdDEFgNu

Any help would be appreciated.
Thanks

Add stop() function

Hello,
thank you for this lib !
It would be great to be able to have a stop() function that stops the udp server to reduce power consumption when we want to disable artnet reception, in my case it's esp32's on battery and before the show we keep them connected but at minimum power, so disabling the UDP server would save some juce :)

Is it possible to manually set the IP Address?

Just curious if there's a variable I can use to set the IP Address of my ESP8266 board manually in the code instead of the board choosing an address automatically? I'm having the issue where if I reset my modem and the board the IP Address changes and then my other software that's trying to point to it can't find it anymore.

Thanks!

UDP not broadcasting

Hi there,

I am trying to get this to work on a NodeMCU Board.
so far so good, it's just that I can't get it to broadcast the Artnet Node.

in QLC+ I can manually set the IP, but I cannot do this with other software.

any suggestions?

receive and transmit simultaneously

Hi, I would like to have my ESP32 receive LED data from and transmit sensor data to a base node. Can artnetwifi do this? If so, how? I tried using a single ArtnetWifi object and combining the two examples, and I tried making two objects, one for sending and one for receiving. Neither worked clearly. The base node is a computer using python running stupidArtnet, and I have tested that it can both send to and receive from the ESP32. Just not both at the same time. Thanks!

More than 512 leds, no light comes through

I'm using an ESP32 and trying to get 1024 LEDs to run, but if I make numLeds more than 512, even 513, the entire light array goes black. Some investigation finds that onDmxFrame sets sendFrame to 0 every time it's called. I tried to eliminate sendFrame but the FPS seems to drop significantly. Any suggestions?

const int lastUniverse=startUniverse+maxUniverses;

void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
{
if(universe<startUniverse||universe>lastUniverse)
return;

// 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();
}

trying to make use of readartnet project

Hello,
I had great success using your ArtnetWifi lib on ESP8266.
I'd like now to use this https://github.com/derrgis/readartnet with ESP32.
Based on OpenFrameworks it reads a video, automatically resize the matrix and convert to artnet.
(Video columns are universes)
So I wonder how it would be possible to use multiple pins on a ESP32 to send each universe (video column as said) to different ledstrips.
Is that possible with your ArtnetWifi ?
Thank you.

5v and 3.3v matching for data pin?

Hello, can you provide some information about connecting ESP with 5v(or even 12v) stripes? Is 3.3v is enough for data and i can just use dc-dc stepdown converter for ESP VIN pin?

Error

What do I do to remove the library function error

THANKS so much

thank you . you have done really a great job ... i really needed some thing like this wireless neopixel ...i am not too much in to coding things and know nothing about that .. your code was very helpful on my ESP32 WROOM .... i am too late here to thank you coz i got my ESPs just few days ago and have been working with them recently .....Once again Thank you ..

Splitting Universe Channels

I've been using this for a while now and it has been super helpful. Currently, I'm using a collection of ESP32s to control both LED's and stepper motors via ArtNet, splitting the information over different universes as set out in #9 .

However, I'm scaling up the project and it seems wasteful to use two universes per ESP32 when all the information could fit within one universe.

What would be the best way to be able to split a universes' channels into multiple outputs?

I.E:

  • Output A (Which will be set to 'leds1'): Universe 0 Channels 1-100
  • Output B (Which would be set to 'leds2': Universe 0 Channel 101 - 200
  • Output C (Which defines 'StepperPosition'): Universe 0, Channel 201

Cheers!

Add buffer for 3 frames

Hi!! Is it possible to add buffer for fastled for 3 frames and show it after with constant delay ( 40ms for 25fps). That could fix irregularity of packet receiving

Multiple Universes

First of all, thank you for writing such a reliable and great code. I have 2 quick questions.
Is there any way to have the device always connect with the same IP without going to my router settings? I am in an apartment and do not have access to the provided router configuration page.

Also, the beginning of the "ArtnetWifiNeoPixel" says "This example will receive multiple universes via Artnet and control a strip of ws2811 leds via...". Does this mean I can have another data pin control another independent universe? Such as Net0, Subnet0, Universe 1 and 2?
I currently have this running on a NodeMCU v2 with CH340. It controls 150 pixels of a WS2812B strip. Runs great.

Thank you!

Universe per ESP/node

Hi,

Thanks a bunch for all your work on artnetwifi.

Similar to the issue - Splitting Universe Channels - and referring to rstephan response specifically - per node based firmware :
I'm a bit lost to how exactly I would go about setting this up with the following as an example:

170 leds -> ESP8266 -> Universe 0
170 leds -> ESP8266 -> Universe 1
170 leds -> ESP8266 -> Universe 2
170 leds -> ESP8266 -> Universe 3

My guess would be that similar to the IP offset example being provided in the issue linked above, I'm assuming that I'd need a similar offset for the universe configured per node.
Unfortunately, my coding experience is not that great, so reaching out for some/any possible assistance from anyone for an example of where I'd have to adjust the configuration to compensate?

(fwiw: My current referenced code is based off the FastLED example, but NeoPixel reference would be fine as well.)

Thanks in advance

BW16 (RTL8720DN)

Hope this is the correct place to ask this. But could someone add the possibility to use this library on a BW16 . I really need 5Ghz. 2.4Ghz has to much interferences these days in TV studio's.
Thanks in advance. Olivier

Latency When Writing to 620 LEDs (1860 Channels)

Using 5 universes ( i know could be less but the way my fixtures are set up makes 5 universes easier).
Using Adafruit NeoPixel as my LED driver. Writing out of GPIO3 (Rx).
Board: Nodemcu 1.0 ESP12E

I've been experiencing pretty drastic latency with this setup, but this makes no sense given the refresh time for NeoPixel is 30ms for 1000LEDs as is described in this article.

I've simplified onDmxFrame() as follows:

void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
{
  // Serial.printf("Universe = %u | Length = %u | Sequence = %u | Data[0] = %u\n", 
  //               universe, length, sequence, data[0]);
  for (int i = 0; i < num_universes; i++) {
    if (universe == universes[i]) {
      int k = 0;
      for (int j = start_pixel[i]; j < start_pixel[i] + leds_per_universe[i]; j++) {
        int l = k * 3;
        leds.setPixelColor(j, data[l], data[l + 1], data[l + 2]);
        k++;      
      }
    }
  }
  leds.show();
}

Here are the relevant definitions as well:

IPAddress ip(192,168,1,109);
const int num_universes = 5;
const int universes[num_universes] = {11, 12, 13, 14, 15};
const int leds_per_universe[num_universes] = {138, 137, 138, 138, 69};
const int start_pixel[num_universes] = {0, 138, 275, 413, 521};   
const int numLeds = 620;
const int data_pin = 3;

I guess I could hash the universe matching but i don't think that's the issue. I'm thinking it's because the Artnet packets are being dropped when the esp is stuck in onDmxFrame(). I found an interrupt-based (async) sACN library that solved this issue, but my visualizer program only supports artnet.

I have 9 strips all being powered in parallel by a 5v/10a power supply with 16AWG wiring, so no voltage drop to contribute to signal loss. The data line snakes through the setup with the 22AWG wire that is standard for the ws2812b. The lag isuniversal for the whole setup, though, so i don't think this is the issue.

I'm unicasting packets for each universe using Resolume at 30 fps. My computer is also hard-wired in, so the only considerable network latency is between the router and the node. I can also unicast to 7+ nodes with no drop in performance.

I have a feeling there's a way to make this many LEDs possible with the esp8266, but I can't see any readily available solutions. Would love any tips!

Here's a link to the client code for more detail.

LED strip stops working after some time with high FPS

I'm currently using ArtnetWifiNeoPixel example on Arduino Nano 33 IoT with a strip of 46 LEDs.

After a successful connection to Wi-Fi, the animation of the LEDs is smooth and correct for some time, but after ~20 seconds it starts lagging, then all LEDs turn off. If the board is rebooted, it connects to Wi-Fi again, and works well for another ~20 seconds.

I discovered that with lower FPS values, the time before the lag begins is increased. With 9 FPS the time from power on to the state where no LEDs turn on anymore is ~2 minutes. With FPS values of 6 and lower this doesn't happen at all.

What can possibly be causing this? I tried several Wi-Fi routers, and it doesn't seem to be the problem.

ws2811 led fliker

Hello,
I have been testing your code using the resolume or touchdesigner.
Before the connection is established is all ok just after the connection the leds start to flick and changing the position as well as colors.
Do you have a clue what can it be?
Thanks

ws2812b flickering every 1sec +-

hey guys!
first of all:
thanks for the library!
it's the first that i tried that works with esp8266 and ws2812b. (others the stip flickers alot)
this one works great but sometimes (every 2 or 1 second +-) the strip blinks.
anyone has the same issue?

Max WS2811

What is the number maximum of WS2811 in ESP8266 with artnet ?

thanks :)

Changing the type of artDmxCallback

Hi,
Have you considered changing the type of artDmxCallback from raw function pointer to
std::function <void (uint16_t, uint16_t, uint8_t, uint8_t*)>?

This would allow more flexibility for the callbacks (e.g. member functions, lambdas). Should be backward compatible as function pointers are automatically converted to std::function.

I did a quick test and seems to work properly.

Multiple ESP32 boards on one Universe with offset start adress

Hi

I have to control multiple (hundreds) esp board wirelessly. I use a normal lighting console and unfortunately have not unlimited universes available. Each esp is controlling only a single neopixel(rgb).
Is it possible to offset the start adress of an esp?

Esp no. 1 - universe 1 - adress 1
Esp no. 2 - universe 1 - adress 4
Esp no. 3 - universe 1 - adress 7
........

Thanks a lot

add active universe in short name string

I apologize for the trivial question.
I need to insert, at the end of the short name string, the dmx universe that is configured . eg: "shortname^1".
Can you suggest me how to do this?
I tried ,but unfortunately my arduino programming knowledge does not allow me to achieve the goal.
Thanks to anyone who can help me.
Mario

Const variables to Int variables

Hello, first of all thank you very much for the library, it has served me perfectly so far.

I want to improve my project and add WifiManager (Tzapu). In addition to requesting the Wifi to which the arduino must connect, I want to request the startUniverse and the numLeds through custom fields.

It is giving me the problem that the variables:

numLeds
numberOfChannels
startUniverse
maxUniverses

They are constants and I can't change them to int because universesReceived[maxUniverses]; it gives me the following error:

array bound is not an integer constant before ']' token

Can you think of how I could modify the library to be able to set those values ​​as variables and not as constants?

Thanks in advance

artnetwifi

Hi

I have one project i need to use the art net WiFi for it, i have use the ESP-6288-12 with this http://www.ulrichradig.de/home/index.php/dmx/wlan-art-net-node

the project consist of 50 DMX Led Strip, each strip connect to 1 art net WiFi and using Madrix software to control them

when i connect 1 strip universe to the WiFi router it work fine and it still work fine till i connect the 10 universe

after that there is problem in synchronizing

watch these videos

https://www.youtube.com/watch?v=CZTpHP-Du6U
https://www.youtube.com/watch?v=K4GPopkt9f0
https://www.youtube.com/watch?v=eHDBiMwNT1A

i try many routers all are the same is there any solution you know about this
Zaki

startUniversity > 2 causes problems

Hi and thanks for the library!

I'm having some problems with my current setup. I have a setup containing 6 ESP32s and each of them have 240 pixels of WS2812. My plan was that 1st ESP32 uses 0 and 1st universum, 2nd ESP32 2nd and 3rd and so on, as 240 pixels are out of limits of 1 universum. My problem is, that if I set startUniverse higher than 2 I'm unable to get ESPs working. If I change startUniverse back to 0, it starts working. Now two of my units are working (startUniverse 0 and 2). I'm using MadMapper to send the ArtNet.

I also tried to set startUniverse back to 0 and send ArtNet packets as unicast, but that didn't work neither. But it worked instantly when changed back to multicast (EPSs were receving the same data of course). Is there some special requirements when using unicast ArtNet with ArtNetWifi?

I also noticed that ESPs were unable to connect to wifi when the ArtNet stream was on. There was also a huge latency when pinging ESPs during the ArtNet stream, over 3 sec. Is this normal behaviour?

I'm using some regular ESP32 dev boards from Ali Express and the code is basicly the ArtnetWifiFastLED example with static IP.

Thank you for your time!

Multiple Receivers, Monitoring

I am using the ArtNetWifiTransmit example which is working really well with 1 client but in the transmit example you set the ip for the destination and if I have multiple esp8266 receiving then how do I allow them all to receive it, also does the transmitter work with any monitoring apps as so far I haven’t found one that works (I am looking at eventually making a esp8266 that runs a HTML dashboard (not running from the transmitter because I don’t want to overload it.))

LED Panels Only Receiving Broadcast Artnet

Hi there- thanks much for putting together this library!

I'm working on a project that uses 8 32 x 32 RGB LED panels; so in total about 65 universes. Each LED panel has it's own ESP8266 that is running the ArtnetWifi library. All the panels are tied to a router in AP mode- my laptop which runs MadMapper is connected to the AP through a managed network switch. When all panels are running and complex light changes are happening I sometimes get some panels lagging behind- however overall they're fairly stable if I output unicast Artnet to them from MadMapper.

I've been troubleshooting some of the lag issues to see if I could get it cleaned up a bit. I recently used Wireshark to monitor the network traffic while sending Artnet to the panels from my laptop, and see a ton of ArtSync packets being sent over the broadcast IP, but I don't see any of the ArtDMX I'm assuming I should be seeing sent to individual panels. The panels are definitely receiving packets, as they're lighting up, but I'm not seeing it in Wireshark.

Is there something I'm missing that is causing the Artnet packets to be sent as broadcast rather than unicast? I've included my code below. Any suggestions on how to cut down the lag even further when using a lot of universes is much appreciated!

Thanks,
Amina

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

#include <Adafruit_BusIO_Register.h>
#include <Adafruit_I2CDevice.h>
#include <Adafruit_I2CRegister.h>
#include <Adafruit_SPIDevice.h>
#include <PxMatrix.h>

#include <Ticker.h>
Ticker display_ticker;
#define P_LAT 16
#define P_A 5
#define P_B 4
#define P_C 15
#define P_D 12
#define P_E 0
#define P_OE 2

#define matrix_width 32
#define matrix_height 32                                    //Adjust as needed based on display size.

// Display settings
const uint8_t panelNumber = 7;                              //Number of LED matrix panel in array of panels. Added mostly for convenience to alter startUniverse and last octect of IP address with 1 variable.
const uint8_t scan_rate = 16;                               //8 for 1/8, 16 for 1/16, 32 for 1/32.
uint8_t display_draw_time = 30;                             //30-70 is usually fine
//PxMATRIX display(32,16,P_LAT,P_OE,P_A,P_B,P_C);           //Enable for 1/8 scan.
PxMATRIX display(32,32,P_LAT,P_OE,P_A,P_B,P_C,P_D);         //Enable for 1/16 scan.
//PxMATRIX display(32,32,P_LAT,P_OE,P_A,P_B,P_C,P_D,P_E);   //Enable for 1/32 scan.

// Wifi settings
const uint8_t ipOctet = 110 + panelNumber;                  //Sets last octet of ip address based on panelNumber.
const char* ssid = "xxx";
const char* password = "xxx";
IPAddress ip(10, 0, 0, ipOctet);
IPAddress gateway(10, 0, 0, 1);
IPAddress subnet(255, 255, 255, 0);

// LED settings
const int numLeds = (matrix_width*matrix_height);
const int numberOfChannels = numLeds * 3;

// Art-Net settings
ArtnetWifi artnet;
const int startUniverse = 50 + (7 * panelNumber);           //Start universe 
const int maxUniverses = 7;
bool universesReceived[maxUniverses];
bool sendFrame = 1;
int previousDataLength = 0;

const int CHANNELS_PER_UNIVERSE = 510;                      //510 because 170 LEDS * 3 = 510. 512 causes an LED to overlap into multiple universes.
uint8_t CHANNEL_VAL[510 * maxUniverses];
uint8_t PAST_CHANNEL_VAL[510 * maxUniverses];

void display_updater(){
  display.display(display_draw_time);
}

void display_update_enable(bool is_enable){
  if (is_enable)
    display_ticker.attach(0.004, display_updater);
  else
    display_ticker.detach();
}

bool newValue(uint8_t x, uint8_t y){                        //Checks if each LED's RGB values have changed since previous packet.
  uint16_t channel = ((x*3)*matrix_height)+(y*3);
  
  if(CHANNEL_VAL[channel]   != PAST_CHANNEL_VAL[channel]   ||
     CHANNEL_VAL[channel+1] != PAST_CHANNEL_VAL[channel+1] ||
     CHANNEL_VAL[channel+2] != PAST_CHANNEL_VAL[channel+2])
  {
    PAST_CHANNEL_VAL[channel]   = CHANNEL_VAL[channel];
    PAST_CHANNEL_VAL[channel+1] = CHANNEL_VAL[channel+1];
    PAST_CHANNEL_VAL[channel+2] = CHANNEL_VAL[channel+2];
    return true;
  }
  else{return false;};
}

void drawPixels(){                                          //Draws all pixels that have changed values since last packet.
  for(uint8_t x=0; x<matrix_width; x++){
    for(uint8_t y=0; y<matrix_height; y++){
      if(newValue(x,y)){
        uint16_t channel = ((x*3)*matrix_height)+(y*3);
        display.drawPixelRGB888(x,y,CHANNEL_VAL[channel],CHANNEL_VAL[channel+1],CHANNEL_VAL[channel+2]);
      };
    };
  };
}

void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data){
  sendFrame = 1;

  uint16_t lastUniverse = universe == ((startUniverse + (maxUniverses - 1)) ? CHANNELS_PER_UNIVERSE - (CHANNELS_PER_UNIVERSE - 12) : 0);
  uint16_t numChannels = CHANNELS_PER_UNIVERSE - lastUniverse;

  for(uint8_t i=0; i<maxUniverses; i++){
    if (!universesReceived[i]){
      sendFrame = 0;
      break;
    };
  };

  for(uint8_t i=0; i<maxUniverses; i++){
    if(universe == startUniverse + i){
      universesReceived[i] = 1;
      for(uint16_t channel=0; channel<numChannels; channel++){
        CHANNEL_VAL[channel + (CHANNELS_PER_UNIVERSE * i)] = data[channel];
      };
      break;
    };
  };

  drawPixels();

  if (sendFrame){
    drawPixels();
    memset(universesReceived, 0, maxUniverses);
  };
};

void setup(){
  WiFi.config(ip, gateway, subnet);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {delay(10);};

  artnet.begin();
  artnet.setArtDmxCallback(onDmxFrame);

  display.begin(scan_rate);
  display.clearDisplay();
  display_update_enable(true);
}

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

Start DMX channel

HI! thanks a lot for library.

Can i set start dmx channel in your library? For example if i want set start 0 universe and channel 100 or 3 universe channel 50.

Thanks!

DMX-Workshop won't detect this

For some reason DMX-Workshop and some other apps don't detect this node software. They don't allow manually entering an IP address so it isn't possible to use this software with them. I found one app called ArtNet Controller that does allow manual IP entry. Using that app this node software does work with WS2812B that I tried. The IP assigned from my router is 10.0.0.72 which I entered into the app. Is there some discovery mechanism that needs to be implemented, or how do programs like DMX-Workshop locate DMX nodes on the network?

Unable to make a Artnet to DMX with esp_dmx

Hi,

Maybe not really an issue, but is someone here can help me with this simple project? I'm trying to use the esp_dmx library (https://github.com/someweisguy/esp_dmx) with the ArtnetWifi library to make a simple Art-Net to DMX node. I can easily send DMX with esp_dmx library and I can easily receive Art-Net with ArtnetWifi, but I'm unable to make them work together. Can someone here help me with this? Here is my code :

`

#include <Arduino.h>
#include <esp_dmx.h>

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

//Wifi settings
const char* ssid = "LRB_UBNT";
const char* pwd = "UBNT2LRB";
const IPAddress ip(192, 168, 1, 201);
const IPAddress gateway(192, 168, 1, 1);
const IPAddress subnet(255, 255, 255, 0);

WiFiUDP UdpSend;
ArtnetWifi artnet;
const int startUniverse = 0; // CHANGE FOR YOUR SETUP most software this is 1, some software send out artnet first universe as 0.

// Check if we got all universes
const int numberOfChannels = 512;
const int maxUniverses = numberOfChannels / 512 + ((numberOfChannels % 512) ? 1 : 0);
bool universesReceived[maxUniverses];
bool sendFrame = 1;

/* First, lets define the hardware pins that we are using with our ESP32. We
  need to define which pin is transmitting data and which pin is receiving data.
  DMX circuits also often need to be told when we are transmitting and when we
  are receiving data. We can do this by defining an enable pin. */
int transmitPin = 17;
int receivePin = 16;
int enablePin = 5;
/* Make sure to double-check that these pins are compatible with your ESP32!
  Some ESP32s, such as the ESP32-WROVER series, do not allow you to read or
  write data on pins 16 or 17, so it's always good to read the manuals. */

/* Next, lets decide which DMX port to use. The ESP32 has either 2 or 3 ports.
  Port 0 is typically used to transmit serial data back to your Serial Monitor,
  so we shouldn't use that port. Lets use port 1! */
dmx_port_t dmxPort = 1;

/* Now we want somewhere to store our DMX data. Since a single packet of DMX
  data can be up to 513 bytes long, we want our array to be at least that long.
  This library knows that the max DMX packet size is 513, so we can fill in the
  array size with `DMX_PACKET_SIZE`. */
byte dataDMX[DMX_PACKET_SIZE];

/* This variable will allow us to update our packet and print to the Serial
  Monitor at a regular interval. */
unsigned long lastUpdate = millis();


bool ConnectWifi(void)
{
  bool state = true;
  int i = 0;

  WiFi.begin(ssid, pwd);
  WiFi.config(ip, gateway, subnet);
  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;
  
  // 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;
    }
  }

  // read universe and put into the right part of the display buffer
  for (int i = 0; i < length; i++) {
      dataDMX[i] = data[i];
      
    }
    dmx_write(dmxPort, dataDMX, DMX_PACKET_SIZE);

  if (sendFrame)
  {
    
    dmx_send(dmxPort, DMX_PACKET_SIZE);
    dmx_wait_sent(dmxPort, DMX_TIMEOUT_TICK);

    Serial.print(" DataDMX (");

     for (int i = 0; i < 512; i++) {
      Serial.print(dataDMX[i], HEX);
      Serial.print(" ");
    }
    Serial.println();  

    // Reset universeReceived to 0

    memset(universesReceived, 0, maxUniverses);
  }


  
}

void setup() {
  /* Start the serial connection back to the computer so that we can log
    messages to the Serial Monitor. Lets set the baud rate to 115200. */
  Serial.begin(115200);
  ConnectWifi();
  artnet.begin();

  /* Set the DMX hardware pins to the pins that we want to use. */
  dmx_set_pin(dmxPort, transmitPin, receivePin, enablePin);

  /* Now we can install the DMX driver! We'll tell it which DMX port to use and
    which interrupt priority it should have. If you aren't sure which interrupt
    priority to use, you can use the macro `DMX_DEFAULT_INTR_FLAG` to set the
    interrupt to its default settings.*/
  dmx_driver_install(dmxPort, DMX_DEFAULT_INTR_FLAGS);

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



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

`

Thanks,

Lag

Hi! I ran into some problems using this library on a NodeMCU 1.0. When using the library in combination with QLC+, it seemed to work previously without problems. I could control 4 led strips without any lag. But now the 8266 does not seem to be keeping up with the data, making the controls lag. The following times in ms are reported per onDmxFrame iteration:

169
1
2
2
2
1
2
2
1
2
190
1
2
2
3
2
1
2
1
2
etc.

So it seems to be working fine, until every 10th package where the time to process the data rises significantly. Occasionally it works realtime for a few seconds and it shows this sequence:

13
20
20
20
21
19
20
20
22
5
6
6
5
6
7
5
18
20
20
20
20
19
21
19

Which seems for feasible since QLC+ sends Artnet at 50hz, so around 20ms is the max time per iteration to prevent lag. This problems rises with both the 80Mhz and 160Mhz mode on different 8266-modules. Do you have any idea why this sudden spike in processing time arises?

Not working with ESP32 ethernet

I am using the Olimex ESP32-EVB board and I am having trouble making the library work.

My code:

#include <WiFiUdp.h>
#include <ArtnetWifi.h>
#include <ETH.h>

static bool eth_connected = false;

void WiFiEvent(WiFiEvent_t event)
{
  switch (event) {
    case SYSTEM_EVENT_ETH_START:
      Serial.println("ETH Started");
      //set eth hostname here
      ETH.setHostname("esp32-ethernet");
      break;
    case SYSTEM_EVENT_ETH_CONNECTED:
      Serial.println("ETH Connected");
      break;
    case SYSTEM_EVENT_ETH_GOT_IP:
      Serial.print("ETH MAC: ");
      Serial.print(ETH.macAddress());
      Serial.print(", IPv4: ");
      Serial.print(ETH.localIP());
      if (ETH.fullDuplex()) {
        Serial.print(", FULL_DUPLEX");
      }
      Serial.print(", ");
      Serial.print(ETH.linkSpeed());
      Serial.println("Mbps");
      Serial.print("DNS:\t\t");
      Serial.println(ETH.dnsIP());
      eth_connected = true;
      break;
    case SYSTEM_EVENT_ETH_DISCONNECTED:
      Serial.println("ETH Disconnected");
      eth_connected = false;
      break;
    case SYSTEM_EVENT_ETH_STOP:
      Serial.println("ETH Stopped");
      eth_connected = false;
      break;
    default:
      break;
  }
}

#include <NeoPixelBrightnessBus.h> // instead of NeoPixelBus.h
// LED Strip
const int numLeds = 288; // Change if your setup has more or less LED's
const int numberOfChannels = numLeds * 4; // Total number of DMX channels you want to receive (1 led = 3 channels)
#define DATA_PIN 2 //The data pin that the WS2812 strips are connected to.
NeoPixelBrightnessBus<NeoRgbwFeature, Neo800KbpsMethod> strip(numLeds, DATA_PIN);

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

bool sendFrame = 1;
int previousDataLength = 0;

void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
{
  Serial.println("Received DMX frame on universe " + String(universe) + String(" with length ") + String(length));
  sendFrame = 1;
  // set brightness of the whole strip
  if (universe == 15)
  {
    strip.SetBrightness(data[0]);
  }
  // read universe and put into the right part of the display buffer
  for (int i = 0; i < length / 4; i++)
  {
    int led = i + (universe - startUniverse) * (previousDataLength / 4);
    if (led < numLeds)
    {
      strip.SetPixelColor(led, RgbwColor(data[i * 4], data[i * 4 + 1], data[i * 4 + 2],  data[i * 4 + 3]));
    }
  }
  previousDataLength = length;
  strip.Show();
}

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

  WiFi.onEvent(WiFiEvent);
  ETH.begin();
  ETH.config(IPAddress(10, 0, 0, 2), IPAddress(10, 0, 0, 1), IPAddress(255, 255, 255, 0));


  //WiFi.setSleep(false);
  //ConnectWifi();
  artnet.begin();
  strip.Begin();
  strip.Show();

  // 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();
}

Wifi artnet connection

Hi,

I tried yesterday your program "ArtnetWifiNeoPixel.ino". It connected to router and it also did do the initTest and I can see it in my router so connection is there and led controlling works. But when I try to send data to the wemos D1 mini lite, nothing happens. I tried with jinx and q light control plus. Ip is correct and universe is correct. In stead the routers wifi connection crashes and then disappears.
Any good ideas what happens or how to debug this?
Otherwise great code! Clean and understandable.

Auto Effect

Hi, how can I do a specific task, such as displaying an auto-effect, when the data does not arrive to the ESP07? Thank you

ESP-01 issue

Im trying to get this to work on ESP-01 and have issues. InitTest works but when trying to send via Jinx or Glediator no joy.

Any specific setting need to be set up ?

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.