Forum Rule: Always post complete source code & details to reproduce any issue!
Page 17 of 19 FirstFirst ... 7 15 16 17 18 19 LastLast
Results 401 to 425 of 472

Thread: Artnet to OctoWS2811?

  1. #401
    Junior Member
    Join Date
    Apr 2015
    Location
    Montreal
    Posts
    8
    In the meantime, still using my beaglebone as a relay between my computer and teensy. This is my latest install : https://www.youtube.com/watch?v=UQ-URdyuB04
    Older stuff here : http://www.quadbyte.net/

  2. #402
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Looks nice !
    I wish I could dig deeper into the performance of Ethernet but it's beyond my skills :/

  3. #403
    Junior Member
    Join Date
    Apr 2015
    Location
    Montreal
    Posts
    8
    Same here, let's hope someday Paul or another expert will notice this thread.

  4. #404
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Quadbyte:
    Comique, j'ai aussi travaillé sur le piano interactif du Casino du Lac Leamy (celui en casino)

  5. #405
    Junior Member
    Join Date
    Apr 2015
    Location
    Montreal
    Posts
    8
    nlecaude : excellent, le monde est petit. bcp de gens impliqués sur le casino.

  6. #406
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    924
    Quote Originally Posted by quadbyte View Post
    In the meantime, still using my beaglebone as a relay between my computer and teensy. This is my latest install : https://www.youtube.com/watch?v=UQ-URdyuB04
    Older stuff here : http://www.quadbyte.net/
    mmm, nice drop 0:56

  7. #407
    Junior Member
    Join Date
    Mar 2015
    Posts
    7
    I'm unfortunately in the same boat, BUT, I have found a decent work around in a pinch.

    On a mac, you can slow down the ethernet output to 10base instead of the default 100 or 1000. Go to System Preferences>Network>Advanced>Hardware and configure the speed manually.

    On 100base, I would receive universes 0-6 & 13, but with 10base I reliably receive all 16** universes.

    I'm going to give your 24mhz spi speed a shot, will report back.

    edit: 24mhz spi update did not fix the issue
    Last edited by jmzjmzjmz; 05-11-2015 at 05:16 PM.

  8. #408
    Junior Member
    Join Date
    Jun 2015
    Posts
    9
    Hello There,

    Well Let me start by saying nlecaude and mortonkopf, you guys are legends, this is amazing work, I literally just finished reading the entire thread and it is amazing the support you guys are giving.

    Now down to Flashy things, I am working on a project to which the final setup is going to be 2x 1 teensy 3.1 controlling 1 string of +/- 700 Leds. this Leds are APA102s and I am using FastLed. I have tried using both your guys libraries, that is the reason why I have come to read this entire thread, and I have gotten stuck a bit.

    My test setup is a little strip of 80 LEDS, controlling them from a Chamsys MagicQ lighting desk.

    So, far I have been succesfull in running the strip as long as the Leds are patched on universe 1 (artnet uni 0). If I patch them at the desk on universe 2 and up it gets interesting. Using your library nLecaude, I dont get nothing, using yours mortonkopf I get response on universe 2, but if I select anything on universe 1, it starts flickering and getting all sorts of funky things.

    I have tried changing the startUniverse to 1 (to select the second universe) but I dont get nothing.

    My problem is that this project is for a theater, so on the lighting desk we already have about 8 patched universes with other lighting fixtures. Is there a way to "Mask" the information for the first 8 universes (512 channels / universe)? I have read on this thread about having the Teensy listen to only X universe, which is what I want, but I have been very unsuccessful at this.

    Also I am wondering, once I get the setup ready to go, I will be using almost 4 full universes (512 channels) out of a single Teensy, and in the current Board that I made for this and other projects, I have a WIZ812MJ Ethernet adaptor... Do I need to change it for the WIZ820? I am working on Rev 2 of the board, so I could consider it on the design if I absolutely need to.

    Any help will be really really appreciated.

    Thanks a lot guys

  9. #409
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Thanks for the nice words !
    What sketch are you using exactely ?

  10. #410
    Senior Member
    Join Date
    Jan 2013
    Posts
    966
    I would definitely use the WIZ820io. It is much faster than the WIZ812mj and a lot smaller in case that matters.
    Particularly if you are going to make a new version of your board anyway. Those $20 can save you a lot of headaches.

    There is some good info in this thread :
    https://forum.pjrc.com/threads/23904...light=wiz820io

    And in this thread:
    https://forum.pjrc.com/threads/17951...light=wiz820io

    Make sure to connect:
    - the PWDN on the WIZ820io to GND
    - Reset on the WIZ820io to pin 9 on the Teensy 3
    That will allow seamless integration with the Ethernet library.

  11. #411
    Junior Member
    Join Date
    Jun 2015
    Posts
    9
    Only speaking the truth the Code that I am using is a modified version of the Example you posted, the modifications are only to use FastLed and APA102, nothing modified on the Artnet code itself.


    Code:
    /*
    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 "FastLED.h"                                          // FastLED library.
    //#include <DmxReceiver_CrisEdit.h>
    
    #define LED_DT 4                                             // Serial data pin
    #define LED_CK 5                                             // Serial clock pin for APA102 or WS2801
    #define COLOR_ORDER BGR                                     // It's GRB for WS2812B
    #define LED_TYPE APA102                                      // What kind of strip are you using (APA102, WS2801 or WS@2812B
    #define NUM_LEDS 80
    
    struct CRGB leds[NUM_LEDS];
    
    
    #include <Artnet.h>
    #include <Ethernet.h>
    #include <EthernetUdp.h>
    #include <SPI.h>
    
    // Artnet settings
    Artnet artnet;
    const int startUniverse = 0; // CHANGE FOR YOUR SETUP most software this is 1, some software send out artnet first universe as zero.
    const int numberOfChannels = NUM_LEDS * 3; // Total number of channels you want to receive (1 led = 3 channels)
    byte channelBuffer[numberOfChannels]; // Combined universes into a single array
    
    // Check if we got all universes
    const int maxUniverses = numberOfChannels / 512 + ((numberOfChannels % 512) ? 1 : 0);
    bool universesReceived[maxUniverses];
    bool sendFrame = 1;
    
    // Change ip and mac address for your setup
    byte ip[] = {2, 101, 100, 102};
    byte mac[] = {0x04, 0xE9, 0xE5, 0x00, 0x69, 0xEC};
    
    void setup()
    {
      Serial.begin(115200);
      artnet.begin(mac, ip);
      
    FastLED.addLeds<LED_TYPE, LED_DT, LED_CK, COLOR_ORDER>(leds, NUM_LEDS); // Use this for APA102 or WS2801
    fill_solid( leds, NUM_LEDS, CRGB:: Black); 
      FastLED.show();
      
      FastLED.setCorrection(TypicalSMD5050);
      //FastLED.setTemperature(Candle);
      FastLED.setTemperature(Tungsten40W);
      //FastLED.setTemperature(Tungsten100W);
      //FastLED.setTemperature(Halogen);
      //FastLED.setTemperature(HighNoonSun);
      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 == 25)
      {
        FastLED.setBrightness(data[0]);
        FastLED.show();
      }
    
      // Store which universe has got in
      if (universe < maxUniverses)
        universesReceived[universe] = 2;
    
      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 ; i++)
      {
        int bufferIndex = i + ((universe - startUniverse) * length);
        if (bufferIndex < numberOfChannels) // to verify
          channelBuffer[bufferIndex] = byte(data[i]);
      }      
     Serial.println(channelBuffer[1]);
      // send to leds
      for (int i = 0; i < NUM_LEDS; i++)
      {
        leds[i].setRGB(channelBuffer[(i) * 3], channelBuffer[(i * 3) + 1], channelBuffer[(i * 3) + 2]);
      }      
      
      if (sendFrame)
      {
        FastLED.show();
        // Reset universeReceived to 0
        memset(universesReceived, 0, maxUniverses);
      }
    }
    
    void initTest()
    {
        fill_solid( leds, NUM_LEDS, CRGB(127,0,0));
      FastLED.show();
      delay(500);
      fill_solid( leds, NUM_LEDS,  CRGB(0,127,0));
      FastLED.show();
      delay(500);
      fill_solid( leds, NUM_LEDS,  CRGB(0,0,127));
      FastLED.show();
      delay(500);
      fill_solid( leds, NUM_LEDS,  CRGB(0,0,0));
      FastLED.show();
      delay(500);
    }

    @Headroom, Thanks for the advice, I will consider this on the new revision of the board, the test one that I have already has the WIZ812MJ so I will continue to experiment with that, specially since a "demo" of the project is due very soon (Theater director is getting impatient) But I will definitely change it on the design.

  12. #412
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Hmm the issue might be that WIZ812MJ is too slow.

    Otherwise you could try changing this line:

    Code:
    if (universe < maxUniverses)
    To this:
    Code:
    if ((universe -startUniverse) < maxUniverses)

  13. #413
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Also you might one to use the version of Github which is slightly optimized:
    https://github.com/natcl/Artnet/blob...OctoWS2811.ino
    It gets rid of the channelBuffer array which is redundant...

  14. #414
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Oops, the full code to change would be
    Code:
    if ((universe - startUniverse) < maxUniverses)
        universesReceived[universe - startUniverse] = 1;

  15. #415
    Junior Member
    Join Date
    Jun 2015
    Posts
    9
    I will definitely try those things, and I will come back with an answer

  16. #416
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    924
    yes, probably the bottle neck of the wiz module. You should run the artnetReceive test to see what is actually coming in. This will give you a clear idea of whether packets are lost, messed up, etc. You can then examine the output in the serial monitor and go from there.

  17. #417
    Junior Member
    Join Date
    Jun 2015
    Posts
    9
    Well, Sorry for the delay, it being sunday I am not at the theater and I had to do a bit of an adapted test setup... but here are my findings:

    - Once again to prove you are a legend, the updated example still didnt work but as soon as I modified the code to those lines you told me to:

    "if ((universe - startUniverse) < maxUniverses)
    universesReceived[universe - startUniverse] = 1;

    It all worked good after that, it will read the information on Universe 2, I will test to check on higher universes.

    - The problem I am facing right now is that I think mortonkopf is absolutely right on the WIZ812MJ being to slow, because it all works fine on universe 2, until I send any data on universe 1, the whole thing freezes and I have to either reset the teensy or reload the whole sketch, neither of them good at all.

    I have 2 questions for you though...

    - What exactly does this line mean:

    Code:
    const int maxUniverses = numberOfChannels / 512 + ((numberOfChannels % 512) ? 1 : 0);
    the reason I am asking is because reading in the rest of the thread, Everybody here calls universes to a "random" amount of channels, yet I am pretty sure that my lighting desk handles 512 channels per universe, no more no less, so if I understand that correctly, the size of the universe in the code depends on the number of channels, meaning, in my code, that each universe is 240 channels?? If that is right, then I think that may be a problem since the desk will output 512 per universe, so that should create an offset...

    - For "demo" purposes I will try to group the Leds in groups of 4, in other words, lowering the resolution of the strip, this way I can actually fit the entire strip in one universe (495 channels in total), do you think the example code you posted somewhere using -for loops- to copy the data from one pixel on to 4 leds could work in this case? even though they are in the same 1 strip, not spread around in different strips?

    - Here is just a little bonus question, If I understand this process correctly, the Code will basically merge all the universes (let's say 2) into only one long array of data (1024 channels), and then sort that data on the Leds own array. A little curve ball of my own little project is that this controller will control 660ish leds aaaaaaaaaaaand 2 PWM pins + 2 Solid state Relays... yeah, punch me to the ground right now, I like complicated things the reason for this is that this piece of scenery also needs a couple of "DMX controlled" solenoids and a little DC motor drive sooooooo, If I was to get the value of the first 4 channels for this purposes, and then offset everything after that, it shouldn't affect when it jumps to the next universe right? if I was to use a line like...

    Code:
     if (led < numLeds + ledsOffset)
          leds[i].setRGB(data[i * 3 + ledsOffset], data[i * 3 + 1 + ledsOffset ], data[i * 3 + 2 + ledsOffset]);
    where the ledsOffset is 4 for this example.

    I will end up trying this but well, having a bit of a "yes you are in the right direction" or "what are you thinking??" always helps.

    Hope I dont overwhelm this thread with this massive post, but I guess all this information and questions can always help another lost soul like me at some point.

    Here is the code of the example with the modification you suggested and modified to work with FastLed and APA102

    cheers,

    Code:
    /*
    This example will receive multiple universes via Artnet and control a strip of ws2811 leds via 
    Paul Stoffregen's excellent OctoWS2811 library: https://www.pjrc.com/teensy/td_libs_OctoWS2811.html
    This example may be copied under the terms of the MIT license, see the LICENSE file for details
    */
    
    #include "FastLED.h"                                          // FastLED library.
    //#include <DmxReceiver_CrisEdit.h>
    
    #define LED_DT 4                                             // Serial data pin
    #define LED_CK 5                                             // Serial clock pin for APA102 or WS2801
    #define COLOR_ORDER BGR                                     // It's GRB for WS2812B
    #define LED_TYPE APA102                                      // What kind of strip are you using (APA102, WS2801 or WS@2812B
    #define NUM_LEDS 80
    
    struct CRGB leds[NUM_LEDS];
    
    #include <Artnet.h>
    #include <Ethernet.h>
    #include <EthernetUdp.h>
    #include <SPI.h>
    #include <OctoWS2811.h>
    
    // OctoWS2811 settings
    const int ledsPerStrip = NUM_LEDS; // change for your setup
    const byte numStrips= 1; // change for your setup
    const int numLeds = ledsPerStrip * numStrips;
    const int numberOfChannels = numLeds * 3; // Total number of channels you want to receive (1 led = 3 channels)
    //DMAMEM int displayMemory[ledsPerStrip*6];
    //int drawingMemory[ledsPerStrip*6];
    //const int config = WS2811_GRB | WS2811_800kHz;
    //OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
    
    
    // Artnet settings
    Artnet artnet;
    const int startUniverse = 1; // 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 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[] = {2, 101, 100, 102};
    byte mac[] = {0x04, 0xE9, 0xE5, 0x00, 0x69, 0xEC};
    
    void setup()
    {
      //Serial.begin(115200);
      artnet.begin(mac, ip);
      
        
    FastLED.addLeds<LED_TYPE, LED_DT, LED_CK, COLOR_ORDER>(leds, NUM_LEDS); // Use this for APA102 or WS2801
    fill_solid( leds, NUM_LEDS, CRGB:: Black); 
      FastLED.show();
      
      FastLED.setCorrection(TypicalSMD5050);
      //FastLED.setTemperature(Candle);
      FastLED.setTemperature(Tungsten40W);
      //FastLED.setTemperature(Tungsten100W);
      //FastLED.setTemperature(Halogen);
      //FastLED.setTemperature(HighNoonSun);
      
      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;
    
      // 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)
        {
          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 < numLeds)
          leds[i].setRGB(data[i * 3], data[i * 3 + 1], data[i * 3 + 2]);
      }
      previousDataLength = length;      
      
      if (sendFrame)
      {
            FastLED.show();
        // Reset universeReceived to 0
        memset(universesReceived, 0, maxUniverses);
      }
    }
    
    void initTest()
    {
        fill_solid( leds, NUM_LEDS, CRGB(127,0,0));
      FastLED.show();
      delay(500);
      fill_solid( leds, NUM_LEDS,  CRGB(0,127,0));
      FastLED.show();
      delay(500);
      fill_solid( leds, NUM_LEDS,  CRGB(0,0,127));
      FastLED.show();
      delay(500);
      fill_solid( leds, NUM_LEDS,  CRGB(0,0,0));
      FastLED.show();
      delay(500);
    }

  18. #418
    Junior Member
    Join Date
    Jun 2015
    Posts
    9
    well, The Offset scenario is done, I will have to check it again once I get the rest of the LEDs and hopefully the multiuniverse section sorted out. but here it is:

    Code:
    /*
    This example will receive multiple universes via Artnet and control a strip of ws2811 leds via 
    Paul Stoffregen's excellent OctoWS2811 library: https://www.pjrc.com/teensy/td_libs_OctoWS2811.html
    This example may be copied under the terms of the MIT license, see the LICENSE file for details
    */
    
    #include "FastLED.h"                                          // FastLED library.
    //#include <DmxReceiver_CrisEdit.h>
    
    #define LED_DT 4                                             // Serial data pin
    #define LED_CK 5                                             // Serial clock pin for APA102 or WS2801
    #define COLOR_ORDER BGR                                     // It's GRB for WS2812B
    #define LED_TYPE APA102                                      // What kind of strip are you using (APA102, WS2801 or WS@2812B
    #define NUM_LEDS 81
    #define LEDS_OFFSET 3                                         //channels to be used for other purposes AT THE BEGINING OF THE UNIVERSES
    
    struct CRGB leds[NUM_LEDS];
    
    #include <Artnet.h>
    #include <Ethernet.h>
    #include <EthernetUdp.h>
    #include <SPI.h>
    #include <OctoWS2811.h>
    
    // OctoWS2811 settings
    const int ledsPerStrip = NUM_LEDS; // change for your setup
    const byte numStrips= 1; // change for your setup
    const int numLeds = ledsPerStrip * numStrips;
    const int numberOfChannels = (numLeds * 3) + LEDS_OFFSET; // Total number of channels you want to receive (1 led = 3 channels)
    //DMAMEM int displayMemory[ledsPerStrip*6];
    //int drawingMemory[ledsPerStrip*6];
    //const int config = WS2811_GRB | WS2811_800kHz;
    //OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);
    
    
    // Artnet settings
    Artnet 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 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[] = {2, 101, 100, 102};
    byte mac[] = {0x04, 0xE9, 0xE5, 0x00, 0x69, 0xEC};
    
    void setup()
    {
      //Serial.begin(115200);
      artnet.begin(mac, ip);
      
        
    FastLED.addLeds<LED_TYPE, LED_DT, LED_CK, COLOR_ORDER>(leds, NUM_LEDS); // Use this for APA102 or WS2801
    fill_solid( leds, NUM_LEDS, CRGB:: Black); 
      FastLED.show();
      
      FastLED.setCorrection(TypicalSMD5050);
      //FastLED.setTemperature(Candle);
      FastLED.setTemperature(Tungsten40W);
      //FastLED.setTemperature(Tungsten100W);
      //FastLED.setTemperature(Halogen);
      //FastLED.setTemperature(HighNoonSun);
      
      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;
    
      // 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)
        {
          sendFrame = 0;
          break;
        }
      }
    
      // read universe and put into the right part of the display buffer
      for (int i = 0; i < (length / 3) + LEDS_OFFSET; i++)
      {
        int led = i + (universe - startUniverse) * (previousDataLength / 3) + LEDS_OFFSET;
        if (led < numLeds + LEDS_OFFSET)
          leds[i].setRGB(data[i * 3 + LEDS_OFFSET], data[i * 3 + 1 + LEDS_OFFSET ], data[i * 3 + 2 + LEDS_OFFSET]);
      }
      previousDataLength = length;      
      
      if (sendFrame)
      {
            FastLED.show();
        // Reset universeReceived to 0
        memset(universesReceived, 0, maxUniverses);
      }
    }
    
    void initTest()
    {
        fill_solid( leds, NUM_LEDS, CRGB(127,0,0));
      FastLED.show();
      delay(500);
      fill_solid( leds, NUM_LEDS,  CRGB(0,127,0));
      FastLED.show();
      delay(500);
      fill_solid( leds, NUM_LEDS,  CRGB(0,0,127));
      FastLED.show();
      delay(500);
      fill_solid( leds, NUM_LEDS,  CRGB(0,0,0));
      FastLED.show();
      delay(500);
    }

    Now I just have to create some variables and assign the pins to them so I can get the data for those channels...

  19. #419
    Junior Member
    Join Date
    Jun 2015
    Posts
    9
    Got the extra GPIO to work... the only part I am still stuck with is the multiple universe part any help ANY will be sooooo appreciated

  20. #420
    Junior Member
    Join Date
    Jun 2015
    Location
    London, UK
    Posts
    1
    Excellent work everyone, I've been looking for a resource like this for a long time!

    I'm looking to build something along the lines of what Cristobal is making, without the added complications of relays, initially to be run off an ION (but I have a ChamSys pc setup on the test bench, just to make life easier)

    Initially I need two identical setups of 5m runs (different universes, separate teensys as they're on opposite sides of the stage), what's everyone doing about power supplies for the LEDs? Presumably not running of the same supply as the teensy?

    Also, is there likely to be any issue using ws2812b LEDs instead of 2811s? For this project I need to be without flicker.

    One final question, also related, is there a suitable project box for this or am I better off making one of my own? Output to the LED strip will be to an XLR connection, with a view to using the same boxes for future projects with different setups.

    Thanks in advance for any help!

  21. #421
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    924
    @Phloot, have a read of the posts related to large pixel array for power supply info. Theres lots of things to deal with, and the discussion revolves around dedicated power blocks for the leds, ensuing that power comes into the led array at sufficient points, not just the head of the chain, and ensuring good shared earthing.

    ws2812 should be fine with the octows2811 code according to others, but I have not used them. Searching through the forum posts RE ws2812b, it looks like the octo lib works well.

  22. #422
    Junior Member
    Join Date
    Apr 2015
    Posts
    9
    Hi I'm currently using a teensy 3.1 Octows2811 and wiz820 running the very much the same as listed in Pauls example and it works great with Madrix software however I have a problem trying to get 2 systems to work in madrix only one works at anyone time. I've given each one a different Mac and IP Address and both unit seem to respond to the artnet data but only one works. If I change the mac address to the one that works and keep a different ip address both unit do the same thing.
    I'm not sure if it's a madrix issue or my code any ideas?

    This example will receive multiple universes via Artnet and control a strip of ws2811 leds via
    Paul Stoffregen's excellent OctoWS2811 library: https://www.pjrc.com/teensy/td_libs_OctoWS2811.html
    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>
    #include <Wire.h>
    #include <Adafruit_GFX.h>
    #include <Adafruit_SSD1306.h>
    #include <OctoWS2811.h>

    // OctoWS2811 settings
    const int ledsPerStrip = 576; // 1150 change for your setup
    const byte numStrips= 2; // change for your setup
    DMAMEM int displayMemory[ledsPerStrip*6];
    int drawingMemory[ledsPerStrip*6];
    const int config = WS2811_RGB | WS2811_800kHz;
    OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config);

    // Artnet settings
    Artnet artnet;
    const int startUniverse = 0; // CHANGE FOR YOUR SETUP most software this is 1, some software send out artnet first universe as zero.
    const int numberOfChannels = ledsPerStrip * numStrips * 3; // Total number of channels you want to receive (1 led = 3 channels)
    byte channelBuffer[numberOfChannels]; // Combined universes into a single array

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

    // Change ip and mac address for your setup
    byte ip[] = {192, 168, 1, 10};
    byte mac[] = {0x04, 0xE9, 0xE5, 0x00, 0x69, 0xEC};


    // If using software SPI (the default case):
    #define OLED_MOSI 9
    #define OLED_CLK 10
    #define OLED_DC 11
    #define OLED_CS 12
    #define OLED_RESET 13
    Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);

    /* Uncomment this block to use hardware SPI
    #define OLED_DC 6
    #define OLED_CS 7
    #define OLED_RESET 8
    Adafruit_SSD1306 display(OLED_DC, OLED_RESET, OLED_CS);
    */

    void setup()
    {
    display.begin(SSD1306_SWITCHCAPVCC);
    display.clearDisplay();
    display.setTextSize(1);
    display.setTextColor(WHITE);
    display.setCursor(0,0);
    display.println("192.168.01.10");
    display.setTextColor(BLACK, WHITE); // 'inverted' text
    display.println("Neopixel");
    // display.setTextSize(2);
    // display.setTextColor(WHITE);
    // display.print("0x"); display.println(0xDEADBEEF, HEX);
    display.display();
    delay(2000);
    //Serial.begin(115200);
    artnet.begin(mac, ip);
    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;

    // Store which universe has got in
    if (universe < maxUniverses)
    universesReceived[universe] = 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 ; i++)
    {
    int bufferIndex = i + ((universe - startUniverse) * length);
    if (bufferIndex < numberOfChannels) // to verify
    channelBuffer[bufferIndex] = byte(data[i]);
    }

    // send to leds
    for (int i = 0; i < ledsPerStrip * numStrips; i++)
    {
    leds.setPixel(i, channelBuffer[(i) * 3], channelBuffer[(i * 3) + 1], channelBuffer[(i * 3) + 2]);
    }

    if (sendFrame)
    {
    leds.show();
    // Reset universeReceived to 0
    memset(universesReceived, 0, maxUniverses);
    }
    }

    void initTest()
    {
    for (int i = 0 ; i < ledsPerStrip * numStrips ; i++)
    leds.setPixel(i, 127, 0, 0);
    leds.show();
    delay(500);
    for (int i = 0 ; i < ledsPerStrip * numStrips ; i++)
    leds.setPixel(i, 0, 127, 0);
    leds.show();
    delay(500);
    for (int i = 0 ; i < ledsPerStrip * numStrips ; i++)
    leds.setPixel(i, 0, 0, 127);
    leds.show();
    delay(500);
    for (int i = 0 ; i < ledsPerStrip * numStrips ; i++)
    leds.setPixel(i, 0, 0, 0);
    leds.show();
    }

    void testscrolltext(void) {
    display.setTextSize(2);
    display.setTextColor(WHITE);
    display.setCursor(10,0);
    display.clearDisplay();
    display.println("Vexica");
    display.setCursor(10,20);
    display.println("Artnet");
    display.setCursor(20,40);
    display.println("1020");
    display.display();

    display.startscrollright(0x00, 0x0F);
    delay(2000);
    display.stopscroll();
    delay(1000);
    display.startscrollleft(0x00, 0x0F);
    delay(2000);
    display.stopscroll();
    delay(1000);
    display.startscrolldiagright(0x00, 0x07);
    delay(2000);
    display.startscrolldiagleft(0x00, 0x07);
    delay(2000);
    display.stopscroll();
    }

  23. #423
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Did you try running the simple ArnetReceive example to see if both units are getting data ?

  24. #424
    Junior Member
    Join Date
    Apr 2015
    Posts
    9
    I've just run the ArnetReceive example and it looks like everything works ok. So after that I added the debug info into my code with the same results ie it receives all the artnet data correctly. I think the issue is both drive only want to output universes 1 to 7 to the ws2811 chip and universe 8 and up is just ignored. ive tried to change const int startUniverse = 0; to const int startUniverse = 7; with no affect.
    how do I assign which universes are used for the outputs?

  25. #425
    Senior Member
    Join Date
    Jun 2013
    Location
    Montréal
    Posts
    467
    Try changing to this:

    Code:
    if ((universe - startUniverse) < maxUniverses)
        universesReceived[universe - startUniverse] = 1;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •