Artnet+teensy more than 1 universe fixture (solved)
  • lagelat
    junior Member
    Posts: 7
    Joined: Wed May 17, 2017 8:10 am

    Artnet+teensy more than 1 universe fixture (solved)

    by lagelat » Wed May 17, 2017 8:26 am

    Hi.
    My fixture is a 2 meters 286 led (APA102) bar wired on two output (Data&Clock) of a teensy (with a 3v-5v adapter). I receive data by artnet (Wiz820 adaptor).
    I use artnet natcl library + fastled.
    With other fixture less than 170 leds, no problem, eveything works.
    With this fixture of 286 led on universe 6+7, it's lagging.
    What's wrong?

    My DMX settings are:
    Capture d’écran 2017-05-16 à 16.26.19.png
    Capture d’écran 2017-05-16 à 16.26.19.png (81.02 KiB) Viewed 991 times
    Last edited by lagelat on Thu May 18, 2017 8:57 am, edited 1 time in total.
  • mad-matt
    garageCube team
    Posts: 343
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: Artnet+teensy more than 1 universe fixture

    by mad-matt » Wed May 17, 2017 10:08 am

    MadMapper will send the packets correctly, it's been used in so many situations (even more than 500 universes at 60FPS) that I trust it 100%. Anyway that part can be verified with wireshark easiely.
    The problem might be: in the teensy code, or in the ethernet chipset on the teensy. When you have two universes, MadMapper will send two times more packets to this IP address, so maybe the device is skipping some because the network buffer is too small, or because your teensy loop doesn't process the packets fast enough.
    It happened to us on a project where we were still using broadcast for some reason, that packets were lost because of the ArtNet->DMX node. The solution we found was to reduce the network speed from 1GBps to 100MBps... Because the chipset of the node is not a fast processing unit and then it had enough time to process data before new data is coming...
    Let me know if you have more info or if you solved.
    Btw, which hardware are you using for network on the teensy ? Did you write the teensy code yourself or you use a patch you found somewhere ?
  • lagelat
    junior Member
    Posts: 7
    Joined: Wed May 17, 2017 8:10 am

    Re: Artnet+teensy more than 1 universe fixture

    by lagelat » Wed May 17, 2017 10:37 am

    I use teensy 3.2 with Wiz820 adaptator with W5500 chip (https://www.pjrc.com/store/wiz820_sd_adaptor.html and https://www.aliexpress.com/item/Free-Shipping-Q00216-1-Piece-USR-ES1-W5500-Chip-New-SPI-to-LAN-Ethernet-Converter-TCP/32785286870.html?spm=2114.13010608.0.0.DjMTN4)
    I use artnet natcl (https://github.com/natcl/Artnet) to receive artnet and fastled to write leds.
    I don't write the code myself (I'm a light designer and a bad programmer) but i use the exemple sketches of artnet and fastled and merge them.
    Here is my sketch:

    Code: Select all

    /*
    This example will receive multiple universes via Artnet and control a strip of ws2811 leds via
    Adafruit's NeoPixel library: https://github.com/adafruit/Adafruit_NeoPixel
    This example may be copied under the terms of the MIT license, see the LICENSE file for details
    */

    #include <Artnet.h>
    #include <Ethernet.h>
    #include <EthernetUdp.h>
    #include <SPI.h>
    #define FASTLED_FORCE_SOFTWARE_SPI
    #include "FastLED.h"
    //#include <Adafruit_NeoPixel.h>

    // Neopixel settings
    //const int numLeds = 100; // change for your setup
    //const int numberOfChannels = numLeds * 3; // Total number of channels you want to receive (1 led = 3 channels)
    //const byte dataPin = 2;
    //Adafruit_NeoPixel leds = Adafruit_NeoPixel(numLeds, dataPin, NEO_GRB + NEO_KHZ800);

    //Fastled settings
    #define NUM_LEDS 286
    #define DATA_PIN 14
    #define CLOCK_PIN 2
    const int numberOfChannels = NUM_LEDS * 3; // Total number of channels you want to receive (1 led = 3 channels)
    CRGB leds[NUM_LEDS];


    // Artnet settings
    Artnet artnet;
    const int startUniverse = 6; // 0 pour le n°1

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

    // Change ip and mac address for your setup
    byte ip[] = {192, 168, 0, 118};// 192.168.0.112 pour le n°1
    byte mac[] = {0x90, 0xA2, 0xDA, 0x00, 0x44, 0xC7};//0x90, 0xA2, 0xDA, 0x00, 0x44, 0xC1 pour le n°1

    void setup()
    {
     
      //Serial.begin(115200);
      artnet.begin(mac, ip);
      FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, BGR, DATA_RATE_MHZ(1)>(leds, NUM_LEDS);
      //leds.begin();
      initTest();

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

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

    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)
      {
        //leds.setBrightness(data[0]);
        FastLED.setBrightness(255);
        //leds.show();
        FastLED.show();
      }

      // Store which universe has got in
      if ((universe - startUniverse) < maxUniverses)
        universesReceived[universe - startUniverse] = 1;

      for (int i = 0 ; i < maxUniverses ; i++)
      {
        if (universesReceived[i] == 0)
        {
          //Serial.println("Broke");
          sendFrame = 0;
          break;
        }
      }

      // 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 < NUM_LEDS)
          //leds.setPixelColor(led, data[i * 3], data[i * 3 + 1], data[i * 3 + 2]);Néopixel
          leds[led].setRGB(data[i * 3], data[i * 3 + 1], data[i * 3 + 2]);
         
      }
      previousDataLength = length;     
     
      if (sendFrame)
      {
        //leds.show();Neopixel
        FastLED.show();
        // Reset universeReceived to 0
        memset(universesReceived, 0, maxUniverses);
      }
    }

    void initTest()
    {
      for (int i = 0 ; i < NUM_LEDS ; i++)
        leds[i].setRGB(127, 0, 0);
     
      FastLED.show();
      delay(500);
      for (int i = 0 ; i < NUM_LEDS ; i++)
        leds[i].setRGB(0, 127, 0);
      FastLED.show();
      delay(500);
      for (int i = 0 ; i < NUM_LEDS ; i++)
        leds[i].setRGB(0, 0, 127);
      FastLED.show();
      delay(500);
      for (int i = 0 ; i < NUM_LEDS ; i++)
        leds[i].setRGB(0, 0, 0);
      FastLED.show();
    }
  • mad-matt
    garageCube team
    Posts: 343
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: Artnet+teensy more than 1 universe fixture

    by mad-matt » Wed May 17, 2017 10:48 am

    You can try to increase DATA_RATE_MHZ(1) to DATA_RATE_MHZ(2). Does it help ?
  • lagelat
    junior Member
    Posts: 7
    Joined: Wed May 17, 2017 8:10 am

    Re: Artnet+teensy more than 1 universe fixture

    by lagelat » Wed May 17, 2017 11:12 am

    I tried 2 Mhz, 3Mhz, the behaviour is the same.
    Beyond (10Mhz), my cables are not enough shielded (i will soon replace it by cat5).
  • mad-matt
    garageCube team
    Posts: 343
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: Artnet+teensy more than 1 universe fixture

    by mad-matt » Wed May 17, 2017 11:36 am

    1- to exclude electrical (mostly powering issue), you can keep same configuration (send 2 universes from MM and keep same setup in arduino patch) but put only 170 leds on the output. Does it change anything to fluidity of first 170 leds ?
    2- to exclude Arduino patch issue (and then point to network issue), you can try to use the same arduino patch than on other teensies (only one input universe) but continue sending 2 universes from MM. Does it help ?
  • lagelat
    junior Member
    Posts: 7
    Joined: Wed May 17, 2017 8:10 am

    Re: Artnet+teensy more than 1 universe fixture

    by lagelat » Wed May 17, 2017 11:55 am

    Forget this post it's not a good way, sorry. I don't know how to delete it so....
    Last edited by lagelat on Wed May 17, 2017 3:45 pm, edited 3 times in total.
  • lagelat
    junior Member
    Posts: 7
    Joined: Wed May 17, 2017 8:10 am

    Re: Artnet+teensy more than 1 universe fixture

    by lagelat » Wed May 17, 2017 12:39 pm

    1- to exclude electrical (mostly powering issue), you can keep same configuration (send 2 universes from MM and keep same setup in arduino patch) but put only 170 leds on the output. Does it change anything to fluidity of first 170 leds ?

    That doesn't work, the sketch attempt for univers 7 and if i only patch 170 leds, MM doesn't send U7.

    I try to patch two fixture, one 170 leds on U6 and one 116 leds on U7 and it's lagging even if the second fixture is black (so it's not a problem of powering)

    2- to exclude Arduino patch issue (and then point to network issue), you can try to use the same arduino patch than on other teensies (only one input universe) but continue sending 2 universes from MM. Does it help ?


    It's already done. I'v got 6x 170 leds devices on univers 0 to 5 which works perfectly together. To use my 286 leds work for the show, i change the sketch for a 170 led_num.

    Another strange thing with two devices 170leds:U6 & 116 leds:U7
    I use siren effect. When the repeat parameter is low, its lagging. When it's high, no lag but if i put to zero the luminosity of the second fixture, it's lagging.
  • lagelat
    junior Member
    Posts: 7
    Joined: Wed May 17, 2017 8:10 am

    Re: Artnet+teensy more than 1 universe fixture

    by lagelat » Wed May 17, 2017 3:36 pm

    By testing i found something.
    When i change values of 1st & 2nd Universe at the same time, no lag.
    When i change only values of 1st universe, it's lagging.
    When i move only values of 2nd universe, it's lagging.

    Do MM send the corresponding frame if no values are changed?

    I think that the library is testing Universes count and work only mm sends the two frames of both universes.
  • lagelat
    junior Member
    Posts: 7
    Joined: Wed May 17, 2017 8:10 am

    Re: Artnet+teensy more than 1 universe fixture (resolved)

    by lagelat » Wed May 17, 2017 5:00 pm

    Fine, that was the problem, when i comment the Universe check in my sketch everything seems to be allright. Natcl will have to do a special library for MM.

    Code: Select all

     // Store which universe has got in
     /* if ((universe - startUniverse) < maxUniverses)
        universesReceived[universe - startUniverse] = 1;

      for (int i = 0 ; i < maxUniverses ; i++)
      {
        if (universesReceived[i] == 0)
        {
          //Serial.println("Broke");
          sendFrame = 0;
          break;
        }
      }*/
  • mad-matt
    garageCube team
    Posts: 343
    Joined: Mon Sep 09, 2013 5:50 pm

    Re: Artnet+teensy more than 1 universe fixture

    by mad-matt » Thu May 18, 2017 8:24 am

    Okay. I had not reviewed the full code but yes, MadMapper won't pollute the network with network packets for universes that have not changed (except one packet each 4 seconds as defined in official ArtNet spec). The code you use is wrong, it should use the ArtSync packet (synchronize) that MadMapper sends after having processed DMX output. ArtSync is really made for our situation (cf http://art-net.org.uk/?page_id=456 search for ArtSync)
    Cheers !

Who is online

Users browsing this forum: No registered users and 2 guests