Addressabel RGB LED - Colour & Strobe Sequence Challenge!

Summary

Currently I have some lines of Arduino IDE code adopted and modified from another forum that provides for the control of a string of Addressable RGB pixels using the Adafruit Neopixels library. The code currently addresses the pixels either in sequence or all pixels as one at the same time and allows for the RGB colours, number of flashes per sequence and timing delays to be set to give a flashing (strobe) effect, depending upon the pixel values assigned in the Strobe(n) functions and respective operating statements.

I require up to 3 different strobe cycles to be set within each duty cycle for each pixel which should be completely independent of any other pixel although more than one pixel may share the same colour and strobe sequence.

The existing Arduino IDE code is to be developed to provide for each and every pixel to be triggered independently of any other pixel but, and this is where I just dont have sufficient knowledge, that each pixel should be running at the same time as every other pixel, although not in sync as each pixel’s duty cyle may be different.

An additional requirement is for a Pixel Test at start up and or triggerd by a reset button.

Current Platform & Hardware

Development Platform

• Arduino Mega2560 R3 – Yun could be used if more appropriate
• PL9823 Addressable (WS2811) RGB LEDs - x 100 LEDs

The code is to be developed to allow each RGB Pixel (addressable via the WS2811) to be addressed individually to provide: -

  1. Up to 3 different colours (any colour) to be set per pixel
  2. 1 duty cycle may have up to 3 strobe sequences to be set per pixel
  3. Each pixel will strobe according to the duty cycle that is set for that pixel with a synchronous initial start after the Pixel Test, thereafter each pixel will continue its duty cycle independently and at the same time as every other pixel – As each duty cycle will be different, the pixels will not be strobing at the same frequency. The duty cycles for each different pixel do not need to be synced.
  4. A start up Pixel Test that will initially set every pixel to white (255,255,255) for a duration of 5 seconds and then 3 flashes over 5 second period. The Pixel Test may also be initiated by a remote Reset Button.
    Note - For 1 & 2 above see the Strobe0, Strobe1, Strobe2 & Strobe3 functions in the existing code which is how the colour and time delays are currently set.
    Not every Strobe or Duty Cycle of the intended 255 Pixels will be unique - some Pixels may share the same colour/colour combinations and strobe sequence/s. If there are say 50 different duty cycles, these might be configured in an array and then called from a loop function for each Pixel?
    Example
    Set Pixel 0
    • set colour Yellow (RGB 255, 255, 0)
    • flash 3 times
    • duration of flash - 500ms
    • set colour Black (RGB 0, 0, 0)
    • duration between flashes - 900ms
    • pause before repeating the cycle – 3000ms

Set Pixel 1
• set colour white (RGB 255, 255, 255)
• flash 5 times
• duration of flash - 200ms
• set colour Black (RGB 0, 0, 0)
• duration between flashes - 900ms
• pause before repeating the cycle – 5000ms
Set Pixel 2
• set colour white (RGB 255, 255, 255)
• flash 10 times
• duration of flash - 200ms
• set colour Black (RGB 0, 0, 0)
• duration between flashes - 500ms
• pause before next cycle – 3000ms
• set colour blue (RGB 0, 0, 255)
• flash 2 times
• duration of flash - 200ms
• set colour Black (RGB 0, 0, 0)
• duration between flashes - 500ms
• pause before repeating the cycle – 10000ms
Set Pixel 3
• set colour red (RGB 255, 0, 0)
• flash 2 times
• duration of flash - 200ms
• set colour Black (RGB 0, 0, 0)
• duration between flashes - 500ms
• pause before next cycle – 3000ms
• set colour blue (RGB 0, 0, 255)
• flash 2 times
• duration of flash - 200ms
• set colour Black (RGB 0, 0, 0)
• duration between flashes - 500ms
• pause before next cycle – 3000ms
• set colour red (RGB 255, 0, 0)
• flash 1 time
• duration of flash - 200ms
• set colour Black (RGB 0, 0, 0)
• duration between flashes - 500ms
• pause before repeating the cycle – 3000ms
Set Pixel 4
• set colour Yellow (RGB 255, 255, 0)
• flash 3 times
• duration of flash - 500ms
• set colour Black (RGB 0, 0, 0)
• duration between flashes - 900ms
• pause before repeating the cycle – 3000ms

Notes:
The group of 5 pixels referred to above is just an example of the different timings and colour combinations per pixel and is not intended to infer a specific group of pixels – There may be some pixels that share the same timing and colour combinations but they are not grouped and each pixel is completely independent of any other as far as timing and colours are concerned, therefore, there is no sync required between any one pixel and any other pixel. Each pixel continues its duty cycle completely independently of any other pixel.
The sequencing between one pixel and the next is of no importance as the cycle will be different between each pixel and, they will not therefore be in synch from the start. Indeed each pixel should behave completely independently of any other.
There should be a Pixel Test at initial start that sets every pixel to white (255,255,255) at the same time for say 5 seconds then flashes 3 times before starting the main strobe routine. The same Pixel Test should also be triggered by an external push button (momentary) switch connected between a suitable I/O pin and GND.

I am aware this is a complicated project and would be grateful of any help that is forthcoming. I would be very happy to consider a reasonable financial incentive!

The existing code which is the extent of my current capabiulities is attached.

NeoPixel_Strobe_WS2811_07.ino (2.52 KB)

1) You should NOT be using the delay function. This stops the computer doing anything else. 2) You should be writing your code as a state machine. See my http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html Or Robin2's several things at once http://forum.arduino.cc/index.php?topic=223286.0

3) The pixel buffer needs to be sent out to all the LEDs when ever one or more LED needs updating. So the technique is to change the strips buffer and then ship it all out to the strip. So your only manipulation must be to that strips buffer.