Dimming led's V2

Hello all!

I’m having trouble coding a limiter for the led’s i’m using,
I use the PixelblazeV2 with button
I have found no way to actually code limiter to my led’s
To be specific 50% of all led’s need to be at 80% brightness

I hope someone can help me, thank you in advance!

Hey @Dev1L! Welcome to the forum.

I typically limit my global power or current by using some combination of the global brightness slider in the top left of the Picelblaze UI, or by setting the brightness limit in the Settings page of the UI.

If that doesn’t work for your needs, I’m reading your post as, “I need a specified half of my LEDs to not exceed 80% of their max current”.

Can you say a little more about exactly what you’re trying to do? Are you looking for 80% of max perceptual brightness? Or limiting to 80% of max power? Something else?

What it comes to:
50% of all my leds can not exceed 80% brightness
This has to be done in code so others who tinker with settings for this can easily access it in the code and not with multiple settings and sliders.
Hope this is what you meant @jeff

There is also something else, I need to limit the output of power so will be 50% of all leds that are on but never higher than 80% brightness.
So the total limitation is 40% of all power can be used to power the leds.
I hope this clears it a bit more.
@jeff

So, sadly there is no direct way to do that, I believe. At this time, but I believe Ben could add something to help here.

If you limit the settings in power to 80%, then 100% of the LEDs can reach 80%, with the brightness control turned up to maximum.

Since PB doesn’t have an accessible array/etc, you don’t get a chance to see the overall pixels before it’s actually render by the render loop, if you use hsv() or rgb(). You could build your own version of these, or, like the pseudo-buffer approach we’ve used in a bunch of patterns, shove the data into an array, process it to adjust for power consumption, and then push the (now limited power-wise) buffer data out to actually be rendered.

If there was a “post render” function, that had the ready to go data, [so we’ve looped thru the render loop, but before the data is sent to the LEDs], you could do your power management there. Since there isn’t, you essentially need to do it during the render loop, which doesn’t give you the total picture, just one pixel at a time. You could do a running total, and “choke back” on the power once the running total is too high, or if the current pixel’s too bright relative to what the average is, etc.

You can also hide the settings, if this is a user issue and you want to limit it from casual users. But that is limited to overall percentage of brightness, not by power consumption.

WLED has this feature, you can set a power threshold in milliamps, and it’ll keep the overall levels below that. PB doesn’t have this option. That might be worth @wizard considering adding, since it’s a very useful limiter. “I only have a 8a power supply on this, don’t let my pixels exceed 7.5 amps”. It’s difficult to do this with PB now, and someone loading a bright downloaded or altered pattern could easily cause hardware issues pushing past power limits.

I have another question, it is unrelated to the previous question.
The led strip i use is a ws2813 144leds/meter.
The colours do not corrospond with the preview in the browser. For example the standard KITT scene shows red in the preview but blue on my strip.

This has been fixed it was the colourpatern***

That’s the RGB order and you can and should change it in the settings.

1 Like

@Dev1L ,
I still don’t quite understand. Do you have certain LEDs that shouldn’t go over 80% power, but others can go to 100%, but also you don’t want more than 50% of them on at any given time? This is not something a UI could support, but is doable in code.

However if you never want any LEDs to go above 80% power, that can be done with the max brightness % setting. If you plan to give this to someone to switch patterns, but don’t want them changing settings/code, put it into Simple UI Mode. Load the page with ?setup in the URL and check the Simple UI Mode checkbox. Now when the interface loads without ?setup in the url it hides all the dangerous stuff.

For the 50% on thing, that would be part of pattern. How do you want it to look?

@wizard, As I understood it:

Power consumption shouldn’t exceed 50% of LEDs at 80% brightness. (So that’s neither 80% brightness of all LEDS (the setting of 80%) nor 40% brightness of all LEDS (the setting of 40%)

It’s not an unreasonable desire. Let’s just say it’s 60ma per LED at white 100% and you put it on a power supply of 6 Amps. If you have 100 LEDs, you could run it at full brightness and probably be fine. But let’s say you have 300 LEDs… Your only choice with PB is to try limiting the max brightness to under 33%. With WLED, you can explicitly say “limit power consumption to 6000ma” and it’ll allow you to run a handful of LEDs at full 100% brightness if the others are dark (and thus consuming far less power)
, And if you tried to run all 300 LEDs at full white, it would auto reduce them all to 33% to maintain that 6000ma ceiling.

As I said, I’m unsure, from the end-user perspective, if we could do that easily, without basically building an entire buffer system. How hard would it be in the backend?

I’m pretty sure I saw some discussion on this topic previously but I can’t find it.

I was thinking that with the right capacitors in the right place, it would suffice to attenuate the current frame based on the total power of the previous frame.

1 Like

Same thing, just dynamic vs static power limiting, that wouldn’t do something to 50% of the white LEDs.


OK so maybe put other way: dynamic power adjustment so that power doesn’t exceed 40% of the total possible strip power, but could grow to 80% of individual LED power?

So if you ran 100% white on the strip, it would drop to 40%, but if you had a single LED full white it would be 80%?

Correct, it’s looking at the total usage, not per led.

Actually let me correct that:

If you had a high Amp setting, it would let you go to 100%, unless something else was using the power. The ability to also limit individual LEDs to a Max is a different thing.

I have regular ws2813 led strips, this is for quite a huge project involving a couple thousand leds.
And if ALL leds are turned on the only 50% of these leds should go up to 80% brightness and the rest will need to be lower than that.
The simple UI mode would come in useful when the time comes.

I hope this clears it all up a bit?

I also hope you could help me out with the code since personally I am very new javascript and coding in general.

I do plan on restarting the tutorial series this fall (which is rapidly coming up), which will focus on some basics and build up from simple concepts.