Multisegment Control Pattern (& others)

I’ve just uploaded my multisegment pattern to the library - multisegment.js.

It allows you to subdivide an LED strip into multiple, independently
controllable segments. For each segment, you can control on/off state,
color and brightness, and size. You can also set per-segment effects and
control their speed.

The slider UI allows you to play with all the settings. You can also control
each segment via json from an external progam – it exports an array per segment
with all that segment’s current settings. (The array indices and values are described
in the code and in the github repository. I’ll gladly provide further help and documentation if necessary.)

It comes configured for four segments, but there is no hard limit to the number
of segments. Just edit the code to allocate arrays for additional
segments, and you can run as many as you like. (I’d guess 8 to 10 to be
a practical limit.)

Twelve effects are built in. They are:

  1. Default - render the currently selected solid color
  2. Glitter - fast random sparkles in the current color
  3. Rainbow Bounce - the default “New Pattern” effect.
  4. KITT - because KITT is essential.
  5. Breathe - brightness slowly “breathes” up and down
  6. Slow Color - slowly changes hue
  7. Snow - Occasional icy “sparkles” over current color background.
  8. Chaser Up - light moves “up” from start of strip.
  9. Chaser Down - light moves “down” from end of strip.
  10. Strobe - hideous, but you never known when a rave may occur. Be prepared.
  11. Random Wipe - random color wipe
  12. Springy Theater - theater style chaser lights that also change distance.

This is the first time I’ve let this pattern out into the wild. It’s large and somewhat complex. I’ll likely be fixing and updating frequently for a bit. I’ll try
to keep the library version current, but the most current version, along with several
other pixelblaze patterns I’m working on, will be found on my github repository at

If you find any of this useful, I’d love to hear about it. Bug reports too!

2 Likes

This is awesome! Can’t wait to try it out! Would there be a chance to change the to a specific pattern with a button? Or even change the speed of the patterns somehow?

Hi!,
For each segment, you can control the effect, color and speed with sliders in the Pixelblaze web UI. The whole multisegment thing though, is really made to be controlled from other apps via the websocket API. It is documented here:

https://www.bhencke.com/pixelblaze-advanced

So you could make a software “button” in say, Javascript or Python to switch patterns or change speed, or do pretty much whatever you need that way.

Hardware buttons are a slightly different thing. Pixelblaze supports several different types of digital and analog IO, but wiring them and using them in patterns is up to you.

For details, look at the “Input/Output Functions” section of the “Writing Patterns” documentation. Here’s a quick rundown on how to set up and use a button. Apologies if you already know this.

  • pick a GPIO pin, probably GP2 or GP4 are best (they’re actually pads on the bottom of the Pixelblaze.)
  • connect your button between your chosen pin and any GND connector on the Pixelblaze
  • in your pattern, set pinMode(pin, INPUT_PULLUP) for your chosen pin so the pin will read 0 when the button is pressed.

Now you can use digitalRead(pin) in your pattern to get the value of the button. It’ll return 0 if the button is pressed, 1 otherwise. Your pattern can use the value in any way you like. If you need still more I/O, check out the Sensor Expansion board. Really great for sound reactive patterns.

And if there’s something you want to do, but can’t figure out how to tackle, just ask in the forum. It’s a welcoming community, and there’s somebody here who’s doing just about everything, from motorcycle wheels to abstract art to high altitude rocketry.

That’s perfect, no I did not know that yet. I just ordered my board with expanded 8 port with it today. Can’t wait to get in this and try all these out. I saw a guy with a fastled with a knob that control led his chase effect which would be perfect if I could find a code that does the same thing with a button. Maybe have a delay between taps on the button to control the delay of speed in patterns ?