Auto-Detect # LEDs

Govee M1 controller / strip combo can automatically detect the number of LEDs connected. It requires a reboot of the controller afterwards.
What is Govee doing that WLED cannot do? Is it because of the RGBIC+ they are using, or something else?

I’d have to see the wiring to be sure.
One thing about all the “standard” protocols, they’re uni-directional outgoing only.
There is no opportunity for feedback of any kind, that’s part of the reason that flickering is such a common annoyance. If the controller sends inappropriate data, no one knows until a human looks at it and says “yuck”.

One trick you could do (fairly easily) is to take the Dout of the last LED and feed it back into a secondary GPIO. You just keep send increasing #'s of LED light commands until to see something appear at the input GPIO. That would tell you the length of the string.

But all that would take some particular wiring layouts.

Maybe they are monitoring power draw?

That would be my assumption too.

@huggy-d1 is there a brief flash of lights at start?

If you measure the draw of the whole string, that would take some pretty good precision on the measurement.
A 1% error over 300 LEDs means you’re out by 3.
Might not be the end of the world, but getting 1% accuracy is not the easiest thing to achieve.

Wait a minute - what if you watched for increase draw of 1 LED and just kept lighting a single pixel further out in the strip. You could do that fast enough that you might not even see the flicker.

The electronics issue would be cutting the current measurement in or out for long strips. Normally you use a series circuit with a resistor creating a small voltage drop you can sense. But if you have to allow for full draw of 300 LEDs say 15A, you need a really small resistor < .01ohm. That makes measuring the draw of 1 LED at .055A very difficult.

Might be doable with a MOSFET (or even a relay) to bypass a larger series resistor in “normal” mode.

So it should be possible.

That all said, is it worth the effort?
Maybe there are effects or scenarios where it would be useful to know in the code what your maximum string length is, but how many and how often are they used?

I could see in the 2d-3d matrix scenarios that this is useful info, but asking someone to configure their setup by entering config numbers is waaaay easier and more reliable as well.
It’s not like those numbers are going to change hourly.

What do we actually gain in the real world by sensing the string length versus asking someone to enter it?

I know there are some controllers that have sense and use current as the defining factor. I think Genius Controllers do that.

Like cars with 30 cup holders. Do you really need it or do people go dude I got 30 cup holders. :grin:

I repeat your question , what is Magic Home controller is doing that wled and my esp32 can not do ? it can somehow detect the number of leds even with ws2812b strips but not an open source to poke around in it ,

Have you got one of the controllers you reference?

I don’t see anywhere that it claims to detect the # of LED’s (not saying it doesn’t, there’s just no info).
There are some possible ways that could work (as noted above).

Short answer - what does this “feature” actually get you?
Does anybody really care?

No, sorry I don’t have one. I was watching an xlights tutorial the other day and Keith Westley mentioned it in the video.

  • Per port current monitoring (RTCM: Real time current Monitoring)
  • Per port pixel counting
  • Automatic fault detection can find burnt out pixels, before you can
  • Repair mode highlights where you need to splice to remove failed pixels

I personally would not trust it to count my pixels. Entering the # yourself takes any guess work out of things being right. But hey people buy things for strange reasons… Like colored pcb’s lol.

We had some magic home controllers and they had a lot of other features like ability to use phone camera with its app to make a quick ambient TV lighting ( no Hyperion on anything ) and apps mic for music so really advanced stuff but not sure if they are sill working as to date I can dig for that if you really care . The one we still have close and working as of now is this below one , which is also as the OP mentioned are RGBIC which might be a clue but the site does not also say anything about auto sensing

Now to the hard question "Does anybody really care? " , as of now two or three guys and I am curious in anything i find interesting even though I might never use it . In this case having a software /hw save you few clicks could be good for me but in reality think of a setups of leds that is already installed in a hidden location in the ceiling so not direct , do you think it is better to be forced to take out the leds to count them ? . But yeah other then that there are bigger fish to fry so all good

There’s another way to count the LED’s without removing.

Use the standard 1/2’ing technique -
Define a 1024 LED strip in WLED
Create preset with segment to only light 1024th LED.
Create preset with segment to only light 512th LED.
Create preset with segment to only light 256th LED.
Create preset with segment to only light 128th LED.
Create preset with segment to only light 64th LED.

Start at the longest and display successive presets until you see an LED.
Then work back up with longer segments till you lock the length down.
If you always use 1/2 the distance between the highest LED you can see and the next higher measurement, you’ll get the minimum tries to get it right on.
In reality, once you’re close (within 20) you’ll probably guess the number faster.

I’ve done this multiple times to map the actual pixel numbers of strings draped across a room for lighting effects. Often you want to know the number for the corners, peaks, etc and this is a pretty fast way of inding it. Works better than just total length too.

Good trick to do kinda process of elimination to setup more leds and then reduce the count . We did also ask mr google about auto detect number of leds for learning and turns out that it is being discussed in Arduino circles as there are other controllers that are doing that but I think its mostly for RGBIC or ws2811 but did not find a solid info other then what the guys think its related to power draw . I will try to look for other controller we had but we might have also used ws2811 and not ws2812b

A bit late, but just want to point out some of their other products, e.g. their modular light bars / glides can do this too. Very curious to how this works too.

If they feature “per port current monitoring”, it’s easy to figure out what the last LED number is. You can just do the binary search (as suggested by @divsys ) in code. Just need to try log(n) leds for a strip of a max length of N to find the exact length.