Timing between different Pixelblazes -- time() vs delta

Hey everyone!

I’m trying to get a fleet of Pixelblazes to run patterns that distribute across each strip – each Pixelblaze powers a wicket in a croquet set and I’ve mapped each one to the right points in 3D space. I have previously been running 1D patterns on each wicket and they stayed in sync well enough for the 30 seconds I’d run them before switching. The other night I couldn’t get them all to stay in sync, and I made a couple test patterns to try to figure out what was going on:

The first:

export function beforeRender(delta) {
  t1 = time(.015)
}

export function render(index) {
  s = 1
  v = 1
  hsv(t1 > 0.5 ? 0.5 : 0, s, v)
}

The second:

var elapsed = 0;
export function beforeRender(delta) {
  elapsed = (elapsed + delta) % 1000
}

export function render(index) {
  s = 1
  v = 1
  hsv(elapsed > 500 ? 0 : .5, s, v)
}

There’s a video of these two patterns here

Notice that the patterns aren’t in sync at all. The first pattern is for the first half of the video, and if you look you can even notice that the timing is all over the place – while the pattern is supposed to be half cyan, half red, the actual time ratio shifts. The second pattern starts around halfway through, and you can see that the timing is way more consistent between Pixelblazes but they aren’t all quite in sync with each other.

Any advice for this? My next attempt is going to be to just stream pixel values straight from the same Raspberry Pi I have Firestorm running on in order to keep everyone in sync, but I’m confused why this is a problem. As an example, this video shows all the LEDs running their own 1D patterns lining up nearly perfectly, so I’m confused what’s happening.

Is that with with Firestorm or some other timesync source (Apr '23 edit: such as a sync group leader) running on the same network as the Pixelblazes? This is necessary to sync values used in time() calls. It looks like that part is missing.

The deltaMs in beforeRender isn’t synchronized, it’s just a delta of elapsed time since that last animation frame for that PB. Since other stuff could be going on, this will vary from frame to frame, but should add up to keep with real time. It should be fairly accurate, and has good resolution - 16 bits for every millisecond, or about 15ns.

I think what you are seeing in the latter half of the video is that they were started a handful of milliseconds apart. If you started that pattern on a bunch at exactly the same time, they’d mostly stay in sync, but would drift slightly due to variations in local clock if left running for a while.

Firestorm is running. Do I have to do anything to have it send off timesync?

The problem seems to have gone away strangely yesterday. I have a hypothesis that I had a local Firestorm on my dev machine and the Firestorm on the Raspberry Pi from the installation running at the same time and conflicting. I’m gonna get some logging set up on my Raspberry Pi just in case so I have something to show you if this happens again.

1 Like

That could do it! I haven’t added the smarts to Firestorm to detect other instances, and multiple timesync replies could confuse PB.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.