[RELEASE] Pixelblaze addressable LED Controller Driver v1.00

Glad to hear it's working for you!

Disconnect/reconnect are artifacts of my development process -- i.e., I caused a lot of crashes in the early going! In this version though, reconnect is useful if you reset your pixelblaze, since the current one doesn't automatically reconnect. The next version will have it, even though the pixelblazes have been very stable, and I have rarely needed to reconnect.

getPatterns is exposed to the user because there's no great way to automatically determine when somebody has edited or changed the pixelblaze's pattern list. I'll probably add automatic polling of some sort, but for now, if you add/delete/edit a pattern, you have to call getPatterns before the Hubitat will know about it.

setVariables can be used to set user defined variables in Pixelblaze patterns. Check the pixelblaze expression documentation for how to export variables in patterns so you can do this. You can use it to change the color, animation speed, etc. in response to a rule.

Presents wrapped, food prepared, house quiet... I finally have a moment to get this cleaned up and posted. I've updated the Pixelblaze driver to v1.00. See the first post in this thread for details and the pointer to the repository.

Merry Christmas & Happy Holidays all!

I have just put a new experimental alpha version of the pixelblaze driver in the repository in case anyone wants to play with it. This version allows you individual control of multiple segments per LED strip via child drivers and a special pixelblaze pattern.

To use it,

  1. Download and install HubitatPixelblazeDriverX.groovy and PixelblazeSegmentChild.groovy to your hub. When setting up the handler for your pixelblaze, select the "Pixelblaze Alpha X" driver.
  2. Download the pixelblaze pattern "Multisegment V1.epe" from the repository, and import it into your pixelblaze. This pattern must be selected and running on your pixelblaze for the whole segmentation trick to work.
  3. Set up the IP and options for the new pixelblaze device and make sure you can turn it on and off from your hub. Once you're connected, click the "Get Variables" button, and then the "Reset Children" button. This will read the current segmentation setup from the pixelblaze and create appropriate new child devices. I'll make it simpler and more bulletproof over the next few versions.
  4. Huzzah! Now you should be able to go to the individual child devices and use them like RGB lights -- on/off, set color, etc. You can still turn the whole strip on and off from the main pixelblaze driver. Note that if you switch away from the Multisegment pattern on the pixelblaze, the child devices will stop working. No worries -- they'll work again when you switch back.

Notes:
This is a very new thing -- possibly wobbly in places. If you have problems, questions or feature requests, just ask me!

The strip is initially divided into 4 equal segments. At this point, changing the number of segments requires editing the pixelblaze pattern. If you feel comfortable doing this, change the pattern to your liking, then "Reset Children" on the hub driver. The driver can adapt to any number of segments.

From the child driver, you can dynamically change the size of a segment using the "Set Size" command. Segments are filled from 0 up -- increasing the size of a lower numbered zone shrinks everything past it. In this version, I do very little parameter validation, so be a bit careful. (Maybe make a note of how many pixels the zone had initially, so you can reset it.)

Per zone special effects are not yet implemented, but are coming soon! :slight_smile:

1 Like

I've never noticed this before. Am I understanding correctly that yiu can adress change different segments independantly ?

This looks neat.

Looking closer this may be way too complicated for me.

It does indeed support dividing a strip into segments that are treated by the hub as essentially independent devices. As for complexity, I'd say... basic soldering skills, a little knowledge of electronics, plus familiarity with javascript or any similar language. It's not turnkey, but it's really not bad.

The pixelblaze's great strength is that it's user programmable, without any tools other than a web browser. It's fantastic for experimentation and prototyping. If you're looking for LED strip software that runs on similar hardware, but might be simpler to configure and integrate with a home control system, check out ESPHome and the Tasmota firmware.

1 Like

@zranger1

Just wanted to post and say thanks for this. I have been using LEDs (RGBs) forever with zigbee controllers mated either to the hub or via Philips Hue. I always wanted to mess with pixel LEDs but didn't know where to start nor did I have a really good project to use it for.

I am building some cabinetry and other stuff for video game system in a media room and found the perfect project for individually addressable LEDs but in terms of controller and integration I was lost until I found this thread.

I needed something that would integrate with Hubitat and was about to go the arduino route until I found this thread and the Pixelblaze and that you built a driver. IMMEDIATELY sold me.

Got my strip, PB and your code up and running in less than 20 minutes. It does EXACTLY what I'm looking for. The segmentation was absolutely key to what I wanted to do. The fact that you have effects per segmentation is also amazing. Really, you took ALL the hard work from me having to learn this (haha thanks).

My next big thing is going to be to add a few of my own patterns to the multisegment epe so I can do some custom stuff - need to brush up on my js a bit. If I have some questions - could I ping you. Never really did patterns like this before.

Seriously though - thank you. This was DEAD simple from my end and now I can spend more time tinkering rather than just trying to make it work.

Amazing work and thanks!!!

You're most welcome! I'm really glad you can use it! I'd be glad to answer questions and help with the scripting language any time.

The one issue you may run into (that I'll fix in the next update -- still a couple of weeks away) is that if the Pixelblaze loses power it is possible to lose your segment settings. The workaround is, once you've got the segments set up the way you like, to just take note of what the sizes are and code them into the script's initialize() function. This is a great way to get started playing with this pattern too.

At around line 207, there's a loop that goes through and initializes all the segments to their default values. Once you know what you want, just delete or comment out this loop and
set the segments up yourself with the appropriate SetSegxxx() calls; Then save the pattern, and your segments will be safe from power outages.

Excellent! I will purchase pixelblaze and some SK6812 RGBW from BTF lighting and see how I go.

I think my question has been answered above but I have shelves that I will be putting strips into. I only want to use one channel on the PB (yet to arrive), so I can have segments per shelf on one PB channel and then control them individually via child devices :grinning:

Another question, I am planning to run multipule pixelblaze's connected together via Pixelblaze Firestorm. Does this app talk to firestorm or individual PB's? Any issues you can foresee from multipule PB's? ie triggering patterns directly on PB's rather than firestorm timing may be off? I see there is a Firestorm API.

I am moving from miLights (non addressable strips) using plugin:


Just wanted to flag for anyone wishing to use a rf remote control for strips, you can use the milight remote and this plugin (and esp device). It has the ability to forward remote presses to HE via MQTT for use in other apps/rule machine, so I would imagine we could easily use it for pixelblaze segments on/off etc.
Currently I control my strip lights and blinds etc from 1 remote!

Samburner3, yes, you can use the available Multisegment pattern to set up multiple segments on a single LED strip, connected to a single Pixelblaze. Each segment will have its own child device.

For multiple Pixelblazes, just set up a Hubitat device for each, optionally with child devices for segments. The driver talks directly to the Pixelblaze over websockets. It doesn't interact with Firestorm (which does the same thing) at all. They should coexist happily.

2 Likes

Hi, I'm super new to the smart home field & microcontroller things. Pixelblaze sounds perfect for my needs, to connect with Hubitat & complete control over lighting pattern heavy-lifting-free. I have a few questions:

  1. Can Pixelblaze run 2 strips in sync & optionally with different pattern?
  2. Can I use one Pixelblaze to run 2 strips at the same time to achieve 1) or I'd need 2 Pixelblazes for 2 strips?
  3. I found there is an 8 Channel Output Expander. Is it for extending one Pixelblaze to capable of running 7-8 more strips/channels or it is actually for something else?

Thanks!

Hi!

Here's the quick overview. For more specific answers about setup and wiring, head on over to the Pixelblaze forum.

One Pixelblaze runs a single pattern at a time, and drives one LED strip. The LED strip can be very long -- a couple of thousand pixels or more. Most LED strips can be easily cut and resoldered, so you can say, divide a strip in two, and wire the two pieces on opposite sides of a room far apart if you need to.

Or, if you use the output expander, you can cut a very long strip into several shorter pieces for ease of wiring. The Pixelblaze still sees all the pieces as a single continuous strip.

Although a Pixelblaze only runs one pattern at a time, the pattern can be programmed to do different things on different regions of the strip, making it look like you're running two or more patterns. (That's what my Multisegment pattern does. )

If you really want to run multiple strips doing completely independent things, you'll need multiple Pixelblazes. Since Pixelblaze got its start in the Maker/LED Art world, it's easy to
sync multiple Pixelblazes using the available Firestorm app. (Firestorm requires a separate computer)

Other things: When the brightness is up, LED strips eat quite a lot of power. Check the specs of the LEDs you plan to buy and be sure to get an appropriately large power supply. Very long strips may require slightly more complex power wiring to avoid voltage drop, which causes inconsistent color along the strip.

Also, data bandwidth becomes an issue as your strips get longer. WS2812 family LEDs run at a constant 800Khz, which sounds fast, but isn't really. With WS2812s, your maximum frame
rate will decrease pretty quickly after 500 or so LEDs. If you're building something larger, I'd recommend using APA 102 family strips. They're brighter, and can be driven much faster - well into the Mhz range.

Brilliant idea! Now I see the picture how the multisegment function could be utilized. Thank you so much!

I got it. So this is where the expander come to play i.e. to divide the signal sequence into smaller segments, right?

Would anyone be willing to point me at exact hardware needed to set this up?

  1. A compatible digital RGB strip & a power supply
  2. Pixelblaze (the strip controller)
  3. HE (obviously)

Up near the top of this thread, there's a lot of information about hardware. My first time out, this is what I used:

Strip:
https://www.amazon.com/BTF-LIGHTING-Individually-Addressable-Flexible-Non-Waterproof/dp/B079ZW1265

Power Supply:
https://www.amazon.com/LETOUR-Supply-Converter-Adapter-Lighting/dp/B01HJA3OUG

Plus Hubitat and Pixelblaze of course. Note that this is all 5v equipment. There's 12v stuff
out there too, but for this purpose, 5v is easier to use. The 30A power supply is overkill for a single strip - you could go w/10 or 15A - and it's also not a thing you want hanging out where there's the slightest possibility that a child might get to the easily exposed contacts. If safety is more of a concern than super high output, you could get a wall-wart 5v power supply. Amazon has tons of 'em.

PPTOR, the expander is one of those things... if you need it, you'll know why. Most people don't. I've got one that I mostly use for experimentation. From my perspective, the principal benefit is that it lets you work with mixed LED types as a single strand.

FWIW, Ben @ Pixelblaze is working on a new output expander that will drive a lot more channels and pixels, but again, it's not something that most people will necessarily need.

Just received my PixelBlaze and set ip up with the segmentation. One thing I was not expecting is that let's say I'm using the segmentation pattern and child drivers, all is well and everything. Then if I go to the main driver, use other patterns for the whole strip and then come back to the segmentation pattern, I won't get back what was on at the time I left the pattern (might be something we can't control), segmentation is all screwed up, and I even often have some pattern from a child device running. I have to go back in each device to set them back to what I want again.

This is just my first time playing with it for about 1/2 hour or so and did not make rules yet, I know that with a rule I could set back pattern in the main driver then set the child drivers to no pattern and off via a virtual switch or something.

So basically, is this a normal behavior and if so, is there anything that could be done via the driver to set the way the segmentation pattern behaves when selected (let's say all off with no pattern).

Will keep playing with it to test what it can do more.

PS, thanks for this integration, this is something I really like since our new house will have pixel lights on the outside all around and with this, we will be able to use them as regular outside lights when not on a holiday by segmenting them as eave lights!

Hi!
Glad to hear you've got this set up and are having fun with it!

You're right -- at this point, segmentation settings aren't saved when you switch away from the multisegment pattern. All the work is done on the Pixelblaze, and it doesn't save local variables when you switch..

So when you come back, you're back to the initial settings. I'm working on fixing this by storing more state in the HE driver, but for now, here's a good workaround:

To make sure your settings persist, just add them to the multisegment pattern. Once you've got the segments set up the way you like, take note of their sizes and use the pattern editor in the Pixelblaze web UI to write them into multisegment's initialize() function.

In the pattern code at around line 207, there's a loop that goes through and initializes all the segments to their (somewhat random) default values.

// start with all zones on, equal in size, and set to random colors.
//
// IMPORTANT NOTE:
// To customize your starting segment sizes and colors, you can 
// move the setup function calls (like SetSegSize and SetSegHSB)
// from this loop and call them with the setup you want.
   var i;
   for (i = 0; i < __n_segments; i++) {    // comment this loop section out!
      SetSegState(i,true);     
      SetSegEffect(i,0)
      SetSegHSB(i,random(1),1,0.60)
      SetSegSpeed(i,1);
      SetSegSize(i,floor(pixelCount / __n_segments));
   }
//  add custom calls to segment setup functions here!
// for example, to make segment #0 50 pixels long, and bright blue,
//  you would  write:
// SetSegState(0,true)   // on
// SetSegSize(0,50) ;    // 50 pixels long
// SetSegHSB(0.6667,1,1);     // blue (hue 0.6667, sat 1, bri 1)
// SetSegEffect(0,0);    // no effect
// SetSegSpeed(0,1);     // default speed

} 

Once you know what you want, delete or comment everything in the for(i=0...) loop and
set your segments up yourself with SetSegxxx() calls. Then save the pattern, and your segment setup will be safe from pattern changes, disconnects, other users & power outages.

The SetSegxxx() calls work as follows: (where is the number of the segment you're changing, starting at 0)

      SetSegState(n,true);     // set initial on/off state - true = on, false = off
      SetSegEffect(n,0)          // set initial effect number
      SetSegHSB(n,random(1),1,0.60)  // set HSB color, (range for each component 0..1)
      SetSegSpeed(n,1);        // set starting animation speed (range 0..1)
      SetSegSize(i,floor(pixelCount / __n_segments));

Hope this helps. The abililty to dive in and change whatever you need to is IMO, the best feature of the Pixelblaze vs other LED controllers. If you get stuck, ask and I'll do my best to get you going again!

1 Like

Thanks for the info @zranger1, I'll check it out later tonight or tomorrow.

Please help!

I've purchased....and greatly enjoyed....a Pixelblast V2 based on your advice (thank you very much!), but am having issues connecting it to my Hubitat. I've installed the two Device Codes (Pixelblaze controller and Segment), and am running multisegment.epe, but I cannot make a connection. Could you please assist?

Thanks in advance!

[Edit]

Oops....nvrmnd....after clicking Get Variables a few more times and then Initialize, it finally connected. Weird.

[Edit] Nope, lost connection again. :frowning:

Now, is there a way to get this to work with Webcore?

[Edit]

Yep, works with Webcore :smiley: