WS2811 Strobes with Arduino

Question guys. Is there a way to daisy chain the dmx modules so I can run multiples of these? I would like to add this to an existing dmx universe on my e131 bridge if possible. I'm thinking I can probably wire two rj-45 keystones to act as in/out? Thanks!
 
in the dmx code, before you program the arduino's there is a section that says (start channel) thats the dmx start channel so you can have it anyware in th dmx line.
the answer to making a Y connector (in/out) is no problems, so long an the wire going to the arduino is less than 20cm.
hope that helps
 
Awesome. Thanks for your response! I will be referring to your wiring diagram once all my arduino stuff from china arrives.
 
Hey smartelec

Was wondering if you encountered the ws2811 pixels stuttering on the arduino minis when setting the pixel count to over 20? Strobes work great otherwise. Seems like longer the strand the more the strobes seem to glitch more. Not enough memory maybe? Thanks!
 
Update--

Getting solid performance now using two 20ct strings on D3 and D4. My UCS1903 pixels are 20ct strings anyway so this should work great. Now I gotta figure out how to make everything look neat in an enclosure. Thanks for everyone's contributions on this.
 
another question for you smartelec. how does the speed rate work? Is there something I have to do on channel 2? Thanks!
 
I've been having some weird issues with the DMX version of this. I'm just going to use my Renard48LSD to control these things this year. Thanks again for everyone's contributions and help.
 
Update. This code will work with an Arduino Uno and a WS5100 ethernet shield. Tested successfully with LSP and xLights. It can also be easily modified to work with multiple strings (I'm planning on using 8). I can't take any credit for this code. Strobe code is by the original poster, and the E1.31 code is from a contributing member at DIYC. Enjoy!

#include <SPI.h> // needed for Arduino versions later than 0018
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <FastLED.h>

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

#define SACN_PORT 5568
#define SACN_BUFFER_MAX 640

//the initial ip and MAC address will get changed by beginMulti
//the multicast ip address should correspond to the desired universe/subnet

byte mac[] = {0x90, 0xA2, 0xDA, 0x0F, 0x2A, 0xBC}; //MAC address of ethernet shield
IPAddress ip(192, 168, 1, 120); //IP address of ethernet shield
IPAddress mip(239, 255, 0, 1); //default multicast IP for E1.31

// buffers for receiving and sending data
unsigned char packetBuffer[SACN_BUFFER_MAX]; //buffer to hold incoming packet,

// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;

// How many strobes in the string?
#define STROBES 20
// How many milliseconds do you want the strobes to be on for?
#define SPEED 30 // I personally wouldn't use any value less than 10 or more than 100
// How many strobes on at any one time?
#define TOTAL 7
// How old are you?
#define AGE 23 // Changes strobe pattern just in case you want a different pattern for whatever reason so feel free to lie about your age
// Data pin (Blue wire from strobes)
#define DATA_PIN 6 // !!!!!DO NOT USE PINS 0 or 1!!!!!


CRGB leds[STROBES];


int strobe;
int trigger;
int data[TOTAL];


//setup initializes Ethernet, opens the UDP port and initializes pixels
void setup()
{
Ethernet.begin(mac,ip);
Udp.begin(SACN_PORT);
Serial.begin(9600);

FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, STROBES);
randomSeed(AGE);

} //end setup

void sacnDMXReceived(unsigned char* pbuff, int count)
{
if ( pbuff[113] == DMX_SUBNET )
{
if ( pbuff[114] == DMX_UNIVERSE )
{
int addressOffset = 125; //first 125 bytes of packet are header information
if ( pbuff[addressOffset] == 0 ) //start code must be 0
{
//place code here to use E1.31 channel values pbuff[126] - pbuff[638]
if(pbuff[126] > 127) //using channel 1 to control stobes
{
runStrobes();
}
else
{
leds[strobe] = CRGB::Black; //set strobes to black (off)
FastLED.show();
}
}
}
}
}



//checks to see if packet is E1.31 data
int checkACNHeaders(unsigned char* messagein, int messagelength)
{
if ( messagein[1] == 0x10 )
{ //header
String test = String((char*)&messagein[4]);
if ( test.equals("ASC-E1.17") )
{
int rootsizeflags = messagein[16] * 256 + messagein[17];
if ( (0x7000 + messagelength-16) == rootsizeflags )
{
int framingsizeflags = messagein[38] * 256 + messagein[39];
if ( (0x7000 + messagelength-38) == framingsizeflags )
{
int dmpsizeflags = messagein[115] * 256 + messagein[116];
if ( (0x7000 + messagelength-115) == dmpsizeflags )
{
int addresscount = messagein[123] * 256 + messagein[124]; // number of addresses plus start code
if ( (messagelength-125) == addresscount )
{
return addresscount;
}
}
}
}
}
}
return 0;
}


void loop()
{
int packetSize = Udp.parsePacket(); //store UPD packet


if(packetSize)
{
Udp.read(packetBuffer,SACN_BUFFER_MAX); //read UDP packet

int count = checkACNHeaders(packetBuffer, packetSize);
if (count)
{
sacnDMXReceived(packetBuffer, count); //process data function
}
}

}

void runStrobes()
{
if (trigger == LOW)
{
for(int count = 0; count < TOTAL; count = count + 1)
{
strobe = random(STROBES);
data[count] = strobe;
leds[strobe] = CRGB::White;
FastLED.show();
}
delay(SPEED);
}
for(int count = 0; count < TOTAL; count = count + 1)
{
strobe = data[count];
leds[strobe] = CRGB::Black;
FastLED.show();
}

}
 
I'm having a challenge with this breakout board connected to an Arduino Pro mini.


https://www.sparkfun.com/products/10124


On the board I can see DMX data on the little RTS light, but nothing is happening on the Arduino. Maybe I have the breakout board wired to the arduino the wrong way. For now I have GND to GND, TX-0 on the board to RXI on the arduino and power to power. I don't have RX-0 or RTS connected at all to the Arudino. The only thing in xlights when I run a test (background only across all dmx channels) it looks like the channel value is always coming back as a 1. What am I doing wrong? otherwise in fact the strobe functionality is working nicely...just I want to be able to control the speed by the DMX value (and also having a value of say < 5 turn off the lights).






Code:
// WS2811 strobe code credited to 
// justinj of AusChristmasLighting.com
// Use the FastSPI library for WS2811 control
#include "FastSPI_LED2.h"
// Use the Conceptinetics library for easy DMX reception
#include <Conceptinetics.h>


#define STROBES 14
#define AGE 23 // Changes strobe pattern just in case you want a different pattern for whatever reason so feel free to lie about your age ;)
#define DATA_PIN 6  // !!!!!DO NOT USE PINS 0 or 1!!!!!
#define TOTAL 7 // How many strobes on at any one time?
int SPEED=30;   // How many milliseconds do you want the strobes to be on for?


CRGB leds[STROBES]; // Init LED struct


int strobe;
int trigger;
int data[TOTAL];


// Init DMX data
int DMX_SLAVE_CHANNELS = 1;
//#define RXEN_PIN 3
DMX_Slave dmx_slave( DMX_SLAVE_CHANNELS);


int MODE=2; // Set mode for operation, 0=NONE, 1=AUTO, 2=STROBE






void Strobe(){
    for(int count = 0; count < TOTAL; count = count + 1) {
      strobe = random(STROBES);
      data[count] = strobe;
      leds[strobe] = CRGB::White;  
      FastLED.show();
    }
    delay(SPEED);


  for(int count = 0; count < TOTAL; count = count + 1) {
    strobe = data[count];
    leds[strobe] = CRGB::Black;  
    FastLED.show();
  }
}






void Strobe_DMX(){
  int channelValue=0;
  channelValue = dmx_slave.getChannelValue(1);
  
  if(channelValue = 1 ){
    
    SPEED = 20;
    Strobe();
  }  
} // End Strobe_DMX








void setup() 
{
  


  // Init 2811 string
  FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, STROBES);
  randomSeed(AGE);




    DMX_Slave dmx_slave( DMX_SLAVE_CHANNELS);
    dmx_slave.enable();
    dmx_slave.setStartAddress(1);




  for(int count = 0; count < TOTAL; count = count + 1) {
    strobe = data[count];
    leds[strobe] = CRGB::Black;  
    FastLED.show();
  }






} // End setup()




void loop()
{


    Strobe_DMX();
    for(int count = 0; count < TOTAL; count = count + 1) {
    strobe = data[count];
    leds[strobe] = CRGB::Black;  
    FastLED.show();
  }} // End loop()
 
Back
Top