Timeline for Is it possible to infer the length of a neopixel string using 1-wire protocol?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 24, 2016 at 21:40 | comment | added | Nick Gammon♦ | Or maybe send in increments of 100 until you overshoot, then do a binary search on that last amount. | |
Feb 24, 2016 at 21:39 | comment | added | Nick Gammon♦ | Looks like I finally arrived at the same conclusion you did, Chris. However the binary search idea may have a speed penalty. What number would you start with? Too small and you miss a long string, too large and it would take a long time to send all those pixels. Still this guy drove 1000+ pixels at 30 FPS, so maybe it is a pretty reasonable idea at that. Maybe start with 1000 pixels and work your way down. :) | |
Feb 24, 2016 at 6:23 | comment | added | Chris Stratton | I guess a simpler method than truly receiving the data could be to configure a pin change interrupt on the tail-of-chain return, and then send frames with increasing numbers of data words in each into the head end until you finally see something make it out that tail end, or do so in a pattern more like a binary search. | |
Feb 24, 2016 at 6:19 | comment | added | Chris Stratton | Yes, if you have access to both ends of the chain and don't know how many elements you have, you can measure it that way. It may get a little tricky in practice as the transition edges you get will probably be delayed from those you sent, at the least by electrical delay and probably by many register clock-to-out delays as well, and for a long enough chain could make receiving them in software a little challenging. For some of these signalling schemes (would have to look again to see if this one) you can persuade a sufficiently flexible UART peripheral to help, for others you cannot. | |
Feb 24, 2016 at 5:45 | comment | added | Dave G | So that more or less answers my understanding in that each neopixel peels off the data it knows about (the "head" of the data set) and then passes the rest. But doesn't that mean I could feed the end of the last pixel back to the microcontroller and have a routine to "watch" for pulses to come back? If no pulses were received then we are either at or below the length of the chain. The first group of pulses that we receive after sending would indicate the number of pixels-1 yes? | |
Feb 24, 2016 at 4:44 | history | answered | Chris Stratton | CC BY-SA 3.0 |