WS2811 Strobes with Arduino

Sorry, very true.

I was only commenting on the addition of the DMX input. Justin definitely deserves credit for the actual strobing and coding, and also for giving alec the idea for DMX.

Cheers,
Rowan
 
I made one also from an Arduino. The board on the left is my DMX sender/receiver for bench testing DMX. The board in the center is the DMX receiver/DMX channel selector/Mode Jumper. The right is the Arduino to be swapped out with a Boarduino.


tc2811strobe.jpg



I used a DIP switch/shift register to set the DMX start address and a jumper to set it to either AUTO mode (self-running) or single channel DMX control of the speed and a MAX485 for the DMX receiver.


Here is my crappy written code:



#include "FastSPI_LED2.h"
// We are using both DMXSerial libraries for DMX receiving
// and SoftPWM to add more PWM outputs
#include <Conceptinetics.h>




// Default Strobe data
// How many strobes in the string?
#define STROBES 5
// How old are you?
#define AGE 27 // 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!!!!!
// Relay pin (You'll attach 1 end of the relay to this pin and the other to GND)


#define TOTAL 10 // How many strobes on at any one time?
// How many milliseconds do you want the strobes to be on for?
int SPEED=10; // I personally wouldn't use any value less than 10 or more than 100


CRGB leds[STROBES]; // Init LED struct


// Init strobe info
int strobe;
int trigger;
int data[TOTAL];


// Init DMX data
int DMX_SLAVE_CHANNELS = 1;
#define RXEN_PIN 0
// Configure a DMX slave controller
DMX_Slave dmx_slave( DMX_SLAVE_CHANNELS, RXEN_PIN);




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




void read_jumper(){
#define PIN_STROBE 7 // Set to enable STROBE mode w/DMX 3ch control
#define PIN_AUTO 8 // Set to enable AUTO mode


// Init Jumpers to LOW to start with
pinMode(PIN_STROBE, OUTPUT);
digitalWrite(PIN_STROBE, LOW);
pinMode(PIN_AUTO, OUTPUT);
digitalWrite(PIN_AUTO, LOW);


pinMode(PIN_STROBE, INPUT);
pinMode(PIN_AUTO, INPUT);


if(digitalRead(PIN_STROBE) == HIGH){
MODE = 2;
} else if (digitalRead(PIN_AUTO) == HIGH) {
MODE = 1;
} else {
MODE = 0;
}

} // End read_jumper






void read_dip(){
// From http://wardyprojects.blogspot.com/2011/05/74hc165-piso-shift-register-arduino.html
//The terminology used here (PL, CP, Q7 and so on) are taken DIRECTLY from the 74HC165's datasheet.
#define PIN_PL (13) //pin 13 on arduino goes to pin 1 of 74HC165
#define PIN_CP (12) //pin 12 on arduino goes to pin 2 of 74HC165
#define PIN_Q7 (11) //pin 11 on arduino goes to pin 9 of 74HC165
//Hardwire pin 15 of both 74HC165 chips to ground to enable them all the time.




//For peace of mind I also hardwired pin 10 of the upstream chip to
//GND to force zeroes to be shifted in instead of allowing it to float.
//Given that the arduino is "downstream".


pinMode(PIN_PL, OUTPUT);
pinMode(PIN_CP, OUTPUT);
pinMode(PIN_Q7, INPUT);


digitalWrite(PIN_PL, HIGH);
digitalWrite(PIN_CP, LOW);


int i;
int j;
int value;
byte dip;


//read the switches 10 times to prove
//that the system is stable
for(i = 0 ; i < 11 ; i++)
{
//load logic bits from the DIP switches
digitalWrite(PIN_PL, LOW); //LOAD BITS
//reset "load" line, this freezes the internal buffer on both chips
digitalWrite(PIN_PL, HIGH);


for(j = 0 ; j < 8 ; j++){
value = digitalRead(PIN_Q7);
//read next "switch"
digitalWrite(PIN_CP, HIGH);
digitalWrite(PIN_CP, LOW);


// Fill the values as 'bits'
dip = (dip << 1) | value;
}


// Slight delay to let things settle down
delay(200);
}
// NOT the switch since it comes in as
// 11111110 instead of 00000001 (for value 1)
dip = ~dip;


// If the idiot didn't set a start address, assume 1
if(dip == 0) dip=1;


START_DMX_ADDR = dip;
} // End read_dip()






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;
int m;


channelValue = dmx_slave.getChannelValue(1);

if(channelValue > 5){
m = map(channelValue, 0, 256, 100, 5);
SPEED = m;
Strobe();
}
} // End Strobe_DMX








void setup()
{
read_jumper();
read_dip();


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




if(MODE == 2){
// DMX_Slave dmx_slave( DMX_SLAVE_CHANNELS, RXEN_PIN);
dmx_slave.enable();
dmx_slave.setStartAddress(START_DMX_ADDR);




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




}


} // End setup()






void loop()
{

switch(MODE){
case 1: // Auto mode
Strobe();
break;

case 2: // Strobe mode
Strobe_DMX();
break;

default:
break;


} // end switch(MODE)
for(int count = 0; count < TOTAL; count = count + 1) {
strobe = data[count];
leds[strobe] = CRGB::Black;
FastLED.show();
}
} // End loop()
 
I am looking to do pixel controlled strobes this year and I actually have an Arduino Uno sitting here collecting dust. It looks like this post lost its attachments.. If Justin is around, is there anyway you could re-post your code and picture attachments! Thanks!
 
Some awsome work here guys. :D
How is the brightness of the 2811 lights when being used as a strobe and how much better does it look compared to just sequencing a strobe/twinkle effect at the dmx refresh rate from a sequencer using a standard pixel controller and pixels

Im hoping someone may have a video of this as I have had reports that the 2811 strobes are not as bright as one would expect and that the LED is being under driven. But i dont have any 2811 strobes to confirm this, so Im hoping someone with real hardware in front of them can give some input on these.
 
Yeah I want to add strobes to my show. If you saw Larsen's house in the Great Christmas Light Fight I thought the strobes made the show. I believe in the show he said they were LED strobes so I was curious what he was using because they looked great. I've heard LED doesn't look as good as a normal xenon strobe but if it looks as good as his house I'd be happy.
 
Ive used the ACL strobes which seem to be effective enough, but i wouldnt want any less brighter than that and that was using a 3/4 watt LED

I think the Ray Wu strobes may use the same LED, but the brightness would depend on how much they are driving the LEDs
 
Is the image that is referenced in line 10 below available still some where? I just finished getting the sketch uploaded and next step for me will be connecting the strobes up to see how these things work. Let me know if it's kicking around at all. much appreciated!
ryan
justinj said:
It took me a little longer to get around to posting this all but here we go, V1 of the Arduino Strobe code!
This should work on any 5v Arduino (Arduino Due will most likely not work). I have personally tested it on an Arduino Dueminolove/Uno and Mega 2560.
If you've never used an Arduino before, if you follow this guide you should be up and running in no time.
1. First we need to program the Arduino. If you don't already have it get the Arduino IDE from here http://arduino.googlecode.com/files/arduino-1.0.5-windows.zip and extract it to a folder somewhere convenient for you.
2. Connect your Arduino via USB and if Windows prompts you for drivers (Instead of getting them automatically for you) point them to the folder you extracted in step 1 and then the drivers subfolder.
3. After drivers have installed download the V1 zip attached to this post and extract it to [Folder you extracted to in step 1]\libraries.
4. Open up arduino.exe from the main folder in step 1.
5. Go to File > Examples > WS2811_Strobes > Standalone
6. If you like you can edit the values in the top section.
7. Go to Tools > Board and select the Arduino you have, then go to Tools > Serial port and select the serial port it has been assigned.
8. Go to File > Upload and it will upload the sketch to your Arduino.
9. Unplug the Arduino from your PC
10. Wire your Arduino and Strobes as per the below diagram. To trigger the strobes you need to trigger the relay you've connected to RELAY_PIN from your controller. Triggering the relay will short the RELAY_PIN and the strobes will remain flashing so long as that pin remains shorted to GND.

Note: You can just put a wire between GND and RELAY_PIN for testing.
Apparently Banggood doesn't have stock of the Arduino Mega. This should also work and is the cheapest option I could find: http://www.ebay.com.au/itm/Uno-R3-A...19?pt=LH_DefaultDomain_15&hash=item27d6ccf813
Hope this helps a few of you and if you have suggestions let me know.
Edit: V1.1 supports MEGA MULTIBALL erm I mean MultiStrings (Up to 9 separate strings and relay inputs) as requested. Follow the tutorial but obviously you'll have a lot more pins occupied on the Arduino. You'll also need to choose File > Examples > WS2811 Strobes > Multistring
 
This is what i ordered... http://scottled.en.alibaba.com/product/1283051061-219704681/12mm_0_75W_WS2811_WHITE_strobe_pixel_string_DC5V_input_50pcs_a_string_IP68_rated.html?edm_src=sys&edm_type=fdbk&edm_grp=0&edm_cta=read_msg&edm_time=realtime&edm_ver=e


I have 25 lights, so need to change the code below I assume to 25 from 50. Maybe also need to increase the speed? Will have to play around a bit. Any thoughts about the settings I may want to tweak because I'm using RGB and 25 nodes in total?



// 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>




// Default Strobe data
// How many strobes in the string?
#define STROBES 50
// How old are you?
#define AGE 27 // 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!!!!!


#define TOTAL 10 // How many strobes on at any one time?
// How many milliseconds do you want the strobes to be on for?
int SPEED=10; // I personally wouldn't use any value less than 10 or more than 100
 
Does anybody have any video of what these strobes look like.

I gather they flash on and off really fast like the light at the disco when we were kids that makes you look like your dancing in slow motion. Does each light get powered randomly or is there a pattern to when each one is fired up.
 
Back
Top