BlackLed problems with ws2812

Status
Not open for further replies.

a9965

Member
Hello everyone.
I'm trying blackled because it seems it's better than octows2811 and artnet

I have tried with jinx and madrix and it does not work

when I turn on the teensy it does not turn on the rgb test.

I have wiznet w5100 chinese and teensy 3.2


Code:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// initial user defined settings
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define NUM_OF_OUTPUTS 4
#define MAX_NUM_LED_PER_OUTPUT 280
#define NUM_CHANNEL_PER_LED 4 // do not change this

//#define blackOnOpSyncTimeOut //recoment more than 20000 ms
//#define blackOnOpPollTimeOut //recoment more than 20000 ms
const static uint32_t OpSyncTimeOut = 300000;
const static uint32_t OpPollTimeOut = 30000;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// definitions calculated from user settings
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const int num_channel_per_output = MAX_NUM_LED_PER_OUTPUT * NUM_CHANNEL_PER_LED;

const int num_universes_per_output = (num_channel_per_output%512) ? num_channel_per_output/512+1 : num_channel_per_output/512;

const int num_led_per_output = num_universes_per_output*512/NUM_CHANNEL_PER_LED;

const int num_artnet_ports = num_universes_per_output*NUM_OF_OUTPUTS;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// includes and lib
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <SPI.h>
#include <Ethernet.h>
#include <ArtNode.h>
#include "ArtNetFrameExtension.h"

#include <OctoWS2811.h>

#include "TeensyMAC.h"
#include <EEPROM.h>

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// settings error check
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#if F_BUS < 60000000
#error "Teensy needs to run at 120MHz to read all packets in time"
#endif

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// real code starts hear
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#define VERSION_HI 0
#define VERSION_LO 9

#define PIN_RESET 9

EthernetUDP udp;
uint8_t udp_buffer[600];

boolean locateMode = 0;

// variables for the node.report
float tempVal = 0;
float fps = 0;
float avgUniUpdated = 0;
uint8_t numUniUpdated = 0;
unsigned long currentMillis = 0;
unsigned long previousMillis = 0;

uint32_t lastPoll = 0;
uint32_t lastSync = 0;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// octoWS2811
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

uint32_t dmxMemory[num_led_per_output * 8];
DMAMEM uint32_t displayMemory[num_led_per_output * 8];
uint32_t drawingMemory[num_led_per_output * 8];

const int LEDconfig = WS2811_RBG | WS2811_800kHz;

OctoWS2811 LEDS(num_led_per_output, displayMemory, drawingMemory, LEDconfig);

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Art-Net config
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

ArtConfig config = {
  {0xDE, 0xAD, 0xBE, 0x00, 0x00, 0x00}, // MAC - last 3 bytes set by Teensy
  {2, 0, 0, 1},                         // IP
  {255, 0, 0, 0},                       // Subnet mask
  0x1936,                               // UDP port
  false,                                // DHCP

  // These fields get overwritten by loadConfig:
  0, 0,                                 // Net (0-127) and subnet (0-15)
  "BlackLED_6",                           // Short name
  "BlackLED_6_port",                     // Long name
  num_artnet_ports, // Number of ports
  { PortTypeDmx | PortTypeOutput,
    PortTypeDmx | PortTypeOutput,
    PortTypeDmx | PortTypeOutput,
    PortTypeDmx | PortTypeOutput
  }, // Port types
  {0, 0, 0, 0},                         // Port input universes (0-15)
  {0, 1, 2, 3},                          // Port output universes (0-15)
  VERSION_HI,
  VERSION_LO
};

ArtNodeExtended node;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// artnetSend - takes a buffer pointer and its length
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void artnetSend(byte* buffer, int length) {
  udp.beginPacket(node.broadcastIP(), config.udpPort);
  udp.write(buffer, length);
  udp.endPacket();
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Blink test all the leds r,g,b,w
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void blink() {
  for (int i = 0 ; i < 8 * num_led_per_output ; i++)
    LEDS.setPixel(i, 127, 0, 0, 0);
  LEDS.show();
  delay(1000);
  for (int i = 0 ; i < 8 * num_led_per_output  ; i++)
    LEDS.setPixel(i, 0, 127, 0, 0);
  LEDS.show();
  delay(1000);
  for (int i = 0 ; i < 8 * num_led_per_output  ; i++)
    LEDS.setPixel(i, 0, 0, 127,0);
  LEDS.show();
  delay(1000);
  for (int i = 0 ; i < 8 * num_led_per_output  ; i++)
    LEDS.setPixel(i, 0, 0, 0, 127);
  LEDS.show();
  delay(1000);
  for (int i = 0 ; i < 8 * num_led_per_output  ; i++)
    LEDS.setPixel(i, 0, 0, 0, 0);
  LEDS.show();
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// EEPROM setup
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// ID of the settings block
#define CONFIG_VERSION "ls1"

// Tell it where to store your config data in EEPROM
#define CONFIG_MEM_START 16
#define CONFIG_START 17
#define CONFIG_END 2

int oemCode = 0x0000; // OemUnkown

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// loadConfig - loads configurations from EEPROM
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void loadConfig() {
  // To make sure there are settings, and they are YOURS!
  // If nothing is found it will use the default settings.
  if (EEPROM.read(CONFIG_MEM_START + 0) == CONFIG_VERSION[0] &&
      EEPROM.read(CONFIG_MEM_START + 1) == CONFIG_VERSION[1] &&
      EEPROM.read(CONFIG_MEM_START + 2) == CONFIG_VERSION[2]) {
    for (unsigned int t = CONFIG_START; t < sizeof(config) - CONFIG_END; t++) {
      *((char*)&config + t ) = EEPROM.read(CONFIG_MEM_START + t + 3 - CONFIG_START);
    }
  }
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// saveConfig - saves configurations to EEPROM
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void saveConfig() {
  EEPROM.write(CONFIG_MEM_START + 0, CONFIG_VERSION[0]);
  EEPROM.write(CONFIG_MEM_START + 1, CONFIG_VERSION[1]);
  EEPROM.write(CONFIG_MEM_START + 2, CONFIG_VERSION[2]);
  for (unsigned int t = CONFIG_START; t < sizeof(config) - CONFIG_END; t++) {
    EEPROM.write(CONFIG_MEM_START + t - CONFIG_START + 3, *((char*)&config + t));
  }
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// setup
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void setup() {
  //saveConfig(); //<-- uncomment to force the EEPROM config to your settings on eatch reboot
  ArtConfig tempConfig = config;
  loadConfig();
  config.numPorts = tempConfig.numPorts;
  config.numPorts = tempConfig.numPorts;
  config.verHi = tempConfig.verHi;
  config.verLo = tempConfig.verLo;
  saveConfig();


#ifdef PIN_RESET
  pinMode(PIN_RESET, OUTPUT);
  digitalWrite(PIN_RESET, LOW);
  delayMicroseconds(2);
  digitalWrite(PIN_RESET, HIGH);
  delay(150);
#endif

  // Read MAC address
  mac_addr mac;
  for (int i = 3; i < 6; i++) {
    config.mac[i] = mac.m[i];
  }

  // Calculate IP address
  config.ip[0] = 2;
  config.ip[1] = config.mac[3] + (oemCode & 0xFF);// + ((oemCode >> 16) & 0xFF);
  config.ip[2] = config.mac[4];
  config.ip[3] = config.mac[5];

  // Open Ethernet connection
  IPAddress gateway(config.ip[0], 0, 0, 1);
  IPAddress subnet(255, 0, 0, 0);

  Ethernet.begin(config.mac, config.ip,  gateway, gateway, subnet);
  udp.begin(config.udpPort);

  // Open ArtNet
  node = ArtNodeExtended(config, sizeof(udp_buffer), udp_buffer);

  LEDS.begin();
  LEDS.show();

  blink();

  // to read internal temperature
  analogReference(INTERNAL);
  analogReadResolution(12);

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// main loop
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void loop() {
  while (udp.parsePacket()) {
    // First read the header to make sure it's Art-Net
    unsigned int n = udp.read(udp_buffer, sizeof(ArtHeader));
    if (n >= sizeof(ArtHeader)) {
      ArtHeader* header = (ArtHeader*)udp_buffer;
      // Check packet ID
      if (memcmp(header->ID, "Art-Net", 8) == 0) {  //is Art-Net
        // Read the rest of the packet
        udp.read(udp_buffer + sizeof(ArtHeader), udp.available());
        // Package Op-Code determines type of packet
        switch (header->OpCode) {

          // Poll packet
          case OpPoll: {
              //T_ArtPoll* poll = (T_ArtPoll*)udp_buffer;
              //if(poll->TalkToMe & 0x2){

              #ifdef blackOnOpPollTimeOut
                lastPoll = millis();
              #endif

              float tempCelsius = 25.0 + 0.17083 * (2454.19 - tempVal);
              sprintf(node.pollReport, "numOuts;%d;numUniPOut;%d;temp;%.1f;fps;%.1f;uUniPF;%.1f;", NUM_OF_OUTPUTS, num_universes_per_output, tempCelsius, fps, avgUniUpdated);
              node.createPollReply(); //create pollReply
              artnetSend(udp_buffer, sizeof(ArtPollReply)); //send pollReply
              //}
              break;
            }

          // DMX packet
          case OpDmx: {
              ArtDmx* dmx = (ArtDmx*)udp_buffer;
              int port = node.getAddress(dmx->SubUni, dmx->Net) - node.getStartAddress();
              if (port >= 0 && port < config.numPorts) {
                uint16_t portOffset = port * 512/NUM_CHANNEL_PER_LED;

                //write the dmx data to the Octo frame buffer
                uint32_t* dmxData = (uint32_t*) dmx->Data;
                for (int i = 0; i < 128; i++) {
                  LEDS.setPixel(i + portOffset, dmxData[i]);
                }
                numUniUpdated++;
              }
              break;
            }

          // OpSync
          case 0x5200: {
              LEDS.show();

              #ifdef blackOnOpSyncTimeOut
                lastSync = millis();
              #endif

              // calculate framerate
              currentMillis = millis();
              if(currentMillis > previousMillis){
                fps = 1 / ((currentMillis - previousMillis) * 0.001);
              } else {
                fps = 0;
              }
              previousMillis = currentMillis;

              // calculate average universes Updated
              avgUniUpdated = numUniUpdated * 0.16 + avgUniUpdated * 0.84;
              numUniUpdated = 0;

              break;
            }

          // OpAddress
          case OpAddress: {

              T_ArtAddress * address = (T_ArtAddress*)udp_buffer;

              if (address->LongName[0] != 0) {
                memcpy(config.longName, address->LongName, 64);
              }
              if (address->ShortName[0] != 0) {
                memcpy(config.shortName, address->ShortName, 18);
              }
              if (address->NetSwitch != 0x7F) {               // Use value 0x7f for no change.
                if ((address->NetSwitch & 0x80) == 0x80) { // This value is ignored unless bit 7 is high. i.e. to program a  value 0x07, send the value as 0x87.
                  config.net = address->NetSwitch & 0x7F;
                }
              }
              if (address->SubSwitch != 0x7F) {               // Use value 0x7f for no change.
                if ((address->SubSwitch & 0x80) == 0x80) { // This value is ignored unless bit 7 is high. i.e. to program a  value 0x07, send the value as 0x87.
                  config.subnet = address->SubSwitch & 0x7F;
                }
              }
              for (int i = 0; i < 4; i++) {
                if (address->SwIn[i] != 0x7F) {
                  if ((address->SwIn[i] & 0x80) == 0x80) {
                    config.portAddrIn[i] = address->SwIn[i] & 0x7F;
                  }
                }
                if (address->SwOut[i] != 0x7F) {
                  if ((address->SwOut[i] & 0x80) == 0x80) {
                    config.portAddrOut[i] = address->SwOut[i] & 0x7F;
                  }
                }
              }

              if (address->Command == 0x04) {
                locateMode = true;
              } else {
                locateMode = false;
              }
              node = ArtNodeExtended(config, sizeof(udp_buffer), udp_buffer);
              saveConfig();
              loadConfig();
              node.createPollReply();
              artnetSend(udp_buffer, sizeof(ArtPollReply));
              //node.createExtendedPollReply();
              //artnetSend(udp_buffer, node.sizeOfExtendedPollReply());
              break;
            }

          // Unhandled packet
          default: {
              break;
            }
        }

        // answer routine for Art-Net Extended
      } else if (memcmp(header->ID, "Art-Ext", 8) == 0) {
        // Read the rest of the packet
        udp.read(udp_buffer + sizeof(ArtHeader), udp.available());
        // Package Op-Code determines type of packet
        switch (header->OpCode) {
          // ArtNet Frame Extension
          case OpPoll | 0x0001: {
              node.createExtendedPollReply();
              artnetSend(udp_buffer, node.sizeOfExtendedPollReply());
              break;
            }
        }
      }else if(memcmp(header->ID, "MadrixN", 8) == 0){
        LEDS.show();

        #ifdef blackOnOpSyncTimeOut
          lastSync = millis();
        #endif

        // calculate framerate
        currentMillis = millis();
        if(currentMillis > previousMillis){
          fps = 1 / ((currentMillis - previousMillis) * 0.001);
        } else {
          fps = 0;
        }
        previousMillis = currentMillis;

        // calculate average universes Updated
        avgUniUpdated = numUniUpdated * 0.16 + avgUniUpdated * 0.84;
        numUniUpdated = 0;
      }
    }
  }

  // read temperature value
  tempVal = analogRead(38) * 0.01 + tempVal * 0.99;

  #ifdef blackOnOpSyncTimeOut
    currentMillis = millis();
    if (currentMillis - lastSync > OpSyncTimeOut) {
      for (int i = 0; i < num_led_per_output * 8; i++) {
        LEDS.setPixel(i, 0);
      }
      LEDS.show();
    }
  #endif

  #ifdef blackOnOpPollTimeOut
    currentMillis = millis();
    if (currentMillis - lastPoll > OpPollTimeOut) {
      for (int i = 0; i < num_led_per_output * 8; i++) {
        LEDS.setPixel(i, 0);
      }
      LEDS.show();
    }
  #endif
}

Thanks a lot!
 
I know know anything about "blackled". Maybe you could give a link, or more info, and describe specifically what you're really doing?

This code won't even compile for Teensy 3.2, because of this:

Code:
#if F_BUS < 60000000
#error "Teensy needs to run at 120MHz to read all packets in time"
#endif

It also has at least 3 includes which are not among the libs that come with Teensyduino. At the very least, you need to tell us exactly which ones you're using.

W5100 chips are always slow. No matter what you do, speed will be limited without a W5200 or W5500.

We pretty regularly get "does not work" questions regarding ethernet which turn out to be wiring errors. Are you sure the board is connected properly? The normal path is this adaptor which is known to work properly, but it only works for W5200 and W5500. If you've done something else, have you at least tested first with the Ethernet lib examples, like WebClient?

If those don't work, then the first thing you need to do is get the hardware wired up properly. Again, if you want help here, you need to actually show us what you're really doing. For hardware wiring problems, that involves posting photos and telling us *exactly* which hardware you are really using. We can usually help if you give good info. But if we have to guess which ethernet board you're really using and can't see your wiring, odds of finding the problem are pretty much zero.
 
I know know anything about "blackled". Maybe you could give a link, or more info, and describe specifically what you're really doing?

Blackled is a library that operates 11 artnet universes with ww5100. That's what I'm trying to do.

This code won't even compile for Teensy 3.2, because of this:

Code:
#if F_BUS < 60000000
#error "Teensy needs to run at 120MHz to read all packets in time"
#endif





It also has at least 3 includes which are not among the libs that come with Teensyduino. At the very least, you need to tell us exactly which ones you're using.

W5100 chips are always slow. No matter what you do, speed will be limited without a W5200 or W5500.

We pretty regularly get "does not work" questions regarding ethernet which turn out to be wiring errors. Are you sure the board is connected properly? The normal path is this adaptor which is known to work properly, but it only works for W5200 and W5500. If you've done something else, have you at least tested first with the Ethernet lib examples, like WebClient?

If those don't work, then the first thing you need to do is get the hardware wired up properly. Again, if you want help here, you need to actually show us what you're really doing. For hardware wiring problems, that involves posting photos and telling us *exactly* which hardware you are really using. We can usually help if you give good info. But if we have to guess which ethernet board you're really using and can't see your wiring, odds of finding the problem are pretty much zero.

Yes compile if you follow these instructions:https://github.com/vertigo-dk/BlackLED
The system is well wired because I have used it with 2 different libraries.



Thank you very much for showing your interest. It is a pleasure. Thank you very much. @PaulStoffregen
 
I have researched this method and ended up with using this instead. Its a combination of several codes but uses SACN e1.31 instead of artnet. Will work with jinx and pretty sure Madrix supports it too. I am able to run 32 universes (5440 Pixels)

One major issue I see that you mentioned W5100??? If so your not getting to get very much because of the very slow performance. You must use the w5200/w5500 for this to work correctly.

Also You must remove the teensy ethernet library and load the one socket library for this to work.

https://www.dropbox.com/s/xe76h0g1qq3gwtb/MEGAPIXEL_CONTROLLER_FW V1.0.zip?dl=0

The dropbox link includes the code and one socket library.

for those interested in what the code is doing is here

Code:
// E1.31 Receiver and pixel controller by Andrew Huxtable (andrew@hux.net.au)
// Modified and adapted to teensy 3.2 by Chris Rees (crees@bearrivernet.net)
// This code may be freely distributed and used as you see fit for non-profit
// purposes and as long as the original author is credited and it remains open
// source
//
// Please configure your Lighting product to use Unicast to the IP the device is given from your DHCP server
// Multicast is not currently not tested with this code but should work with some modification.


// You will need the One Socket Library (Modified from Chris Rees)  and FastLed Libraries from:
// [url]https://github.com/FastLED/FastLED/releases[/url]
//



#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#define USE_OCTOWS2811
#include<OctoWS2811.h>
#include<FastLED.h>


//*********************************************************************************


// enter desired universe and subnet  (sACN first universe is 1)
#define DMX_SUBNET 0
#define DMX_UNIVERSE 1 //**Start** universe


// Set a different MAC address for each...
byte mac[] = { 0x74, 0x69, 0x69, 0x2D, 0x30, 0x15 };


// Uncomment if you want to use static IP
//*******************************************************
// ethernet interface ip address
IPAddress ip(192, 168, 2, 21);  //IP address of ethernet shield
//*******************************************************


EthernetUDP Udp;


// By sacrificing some of the Ethernet receive buffer, we can allocate more to the LED array
// but this is **technically** slower because 2 packets must be processed for all 240 pixels.


/// DONT CHANGE unless you know the consequences...
 #define ETHERNET_BUFFER 636 //540
 #define CHANNEL_COUNT 16320 //because it divides by 3 nicely
 #define NUM_LEDS 5440 // can not go higher than this - Runs out of SRAM
 #define NUM_LEDS_PER_STRIP 680
 #define NUM_STRIPS 8
 #define UNIVERSE_COUNT 32
 #define LEDS_PER_UNIVERSE 170






//********************************************************************************


// Define the array of leds
CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];

// Pin layouts on the teensy 3:
// OctoWS2811: 2,14,7,8,6,20,21,5


unsigned char packetBuffer[ETHERNET_BUFFER];
int c = 0;
float fps = 0;
unsigned long currentMillis = 0;
unsigned long previousMillis = 0;

void setup() {

    pinMode(9, OUTPUT);
    digitalWrite(9, LOW);   // reset the WIZ820io
    delay(10);
    digitalWrite(9, HIGH);   // reset the WIZ820io
  //pinMode(10, OUTPUT); // For SD Card Stuff
  //digitalWrite(10, HIGH);  // de-select WIZ820io
  //pinMode(4, OUTPUT); //SD Card Stuff
  //digitalWrite(4, HIGH);   // de-select the SD Card
    Serial.begin(115200);
    delay(10);

  
  // Using different LEDs or colour order? Change here...
  // ********************************************************
  LEDS.addLeds<OCTOWS2811>(leds, NUM_LEDS_PER_STRIP);
  LEDS.setBrightness(100);
  // ********************************************************

//pins 3,4,22 are to the RGB Status LED
 
  // ********************************************************  
  Ethernet.begin(mac,ip);

  Udp.begin(5568);

//DEFINE AND Turn Framing LED OFF
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);
//DEFINE AND TURN STATUS LED ON  
  pinMode(3, OUTPUT);

  digitalWrite(3, LOW);
  delay(9000);
  //Turn Status LED OFF
  digitalWrite(3, HIGH);
  // ******************************************************** 
    Serial.print("server is at ");
    Serial.println(Ethernet.localIP());

  //Once the Ethernet is initialised, run a test on the LEDs
  //initTest();
}







void sacnDMXReceived(unsigned char* pbuff, int count, int unicount) {
  if (count > CHANNEL_COUNT) count = CHANNEL_COUNT;
  byte b = pbuff[113]; //DMX Subnet
  if ( b == DMX_SUBNET) {
    b = pbuff[114];  //DMX Universe

   //turn framing LED OFF
   digitalWrite(4, HIGH);
    
    Serial.println(b );
    if ( b >= DMX_UNIVERSE && b <= DMX_UNIVERSE + UNIVERSE_COUNT ) {
    




    
      if ( pbuff[125] == 0 ) {  //start code must be 0
      int ledNumber = (b - DMX_UNIVERSE) * LEDS_PER_UNIVERSE;
       // sACN packets come in seperate RGB but we have to set each led's RGB value together
       // this 'reads ahead' for all 3 colours before moving to the next led.
       //Serial.println("*");
       for (int i = 126;i < 126+count;i = i + 3){
          byte charValueR = pbuff[i];
          byte charValueG = pbuff[i+1];
          byte charValueB = pbuff[i+2];
          leds[ledNumber] = CRGB(charValueR,charValueG,charValueB);
          //Serial.println(ledNumber);
          ledNumber++;
        }




        
        //Serial.println(unicount);
        if (unicount == UNIVERSE_COUNT){
        //Turn Framing LED ON
        digitalWrite(4, LOW);
        LEDS.show();
        }

 
      }
          

      
    }
  }

}


int checkACNHeaders(unsigned char* messagein, int messagelength) {
  //Do some VERY basic checks to see if it's an E1.31 packet.
  //Bytes 4 to 12 of an E1.31 Packet contain "ACN-E1.17"
  //Only checking for the A and the 7 in the right places as well as 0x10 as the header.
  //Technically this is outside of spec and could cause problems but its enough checks for us
  //to determine if the packet should be tossed or used.
  //This improves the speed of packet processing as well as reducing the memory overhead.
  //On an Isolated network this should never be a problem....
  if ( messagein[1] == 0x10 && messagein[4] == 0x41 && messagein[12] == 0x37) {   
      int addresscount = (byte) messagein[123] * 256 + (byte) messagein[124]; // number of values plus start code
      return addresscount -1; //Return how many values are in the packet.
    }
  return 0;
}


void initTest() //runs at board boot to make sure pixels are working
{
  LEDS.showColor(CRGB(255, 0, 0)); //turn all pixels on red
   delay(1000);
   LEDS.showColor(CRGB(0, 255, 0)); //turn all pixels on green
   delay(1000);
   LEDS.showColor(CRGB(0, 0, 255)); //turn all pixels on blue
   delay(1000);
   LEDS.showColor(CRGB(0, 0, 0)); //turn all pixels off
}

void loop() {
   //Process packets
   int packetSize = Udp.parsePacket(); //Read UDP packet count
   if (c >= UNIVERSE_COUNT){
   
   c = 0;
   }
   if(packetSize){
    //Serial.println(packetSize);
    Udp.read(packetBuffer,ETHERNET_BUFFER); //read UDP packet
    
    
    int count = checkACNHeaders(packetBuffer, packetSize);
    if (count) {
      
     //Serial.print("packet size first ");
     //Serial.println(packetSize);

     c = c + 1;

     // calculate framerate
   // currentMillis = millis();
   // if(currentMillis > previousMillis){
     // fps = 1 / ((currentMillis - previousMillis) * 0.001);
   // } else {
    //  fps = 0;
   // }
   // previousMillis = currentMillis;
 
     //if (fps > 10 && fps < 500)// don't show numbers below or over given ammount
     //Serial.println(fps); // show FPS (needs fixing)
    
     sacnDMXReceived(packetBuffer, count, c); //process data function
     
     
    
    }  


  }


}
 
Last edited:
Some more info on my project. I created a controller host board called the MegaPixel Controller. We have the revision 1 boards tested. I redesigned the host controller board and getting it sent in for fab now. I will be working on a revision 2 for the receiver boards soon. The last picture shows the Rev1 board that I have been using and testing with. The first picture is me placing components to make sure placement has proper spacing for teensy and W5200/w5500 module.

IMG_3935.jpg

IMG_3937.jpg

Check my youtube videos including a large 1600 Matrix being used with this code. Jinx, vixen, and xlights were used. I also have used FPP (falcon Pi Player) with the MegaPixel Controller.

https://www.youtube.com/user/chriswendi/videos?
 
Last edited:
Congratulations. It really is a good job.
I use w5100 because I only need 3 universes.
I have tried other codes and blackled I like it more because it supports rgbw with other pixels.
Have you tried blackled? when I charge it to the teensy it does not work. I do not even receive 1 universe.
Thanks friend!
 
I'm making a mural for Christmas at home that contains 3 universes. In total I will put 10 murals with 10 teensy. Is it difficult to adapt your code for rgbw pixels? for example for the pixel sk6812. Thank you for your interest and congratulations again for your project. 👍🏻👍🏻
 
Chris, are your selling you MegaPixel Controller boards? Even via Tindie?

I haven’t decided where to sell yet. I have a site for it that I need to wrap up that I can park tutorials, instruction, and store links and or simple cart. Do you allow stuff to be sold on your site by consignment? . Email me @ chris.wendi@gmail.... if more appropriate to discuss via email..
Thanks Paul!
 
Last edited:
PJRC doesn't do consignment sales. But if you're selling it on your site or somewhere like Tindie, I'd love to give it a shout-out. Hopefully that'll help?
 
I noticed that there is a library out there that supports the RGBW. Instead of using fastLED/octows2811 library you can replace it with the RGBW version. Don’t quote me but did I see a working octosk281x Here in the forum somewhere? If so that may be the one to use so it can utilize the efficient dma method to shift out the 8 pins.
 
PJRC doesn't do consignment sales. But if you're selling it on your site or somewhere like Tindie, I'd love to give it a shout-out. Hopefully that'll help?

Absolutely. I have looked at tindie, but also contemplating doing a hosted cart or even amazon prime.
 
Status
Not open for further replies.
Back
Top