Buggy boot up when spoofing sensor board

I have a project that incorporates an arduino alongside the Pixelblaze (pico). It does 2 things, it enables/disables the PB via the enable pad on the bottom, and it also interfaces between a rotary encoder and the PB. It does so by “spoofing” a sensor board, every time the encoder value changes or the button is pressed, the arduino sends a serial frame that the PB interprets as sensor readings.

I also have a large, singular “pattern” that runs, containing 5 or so actual led patterns that can be cycled through via the encoder button.

So the problem: Often (not always, but usually) upon enabling the PB, it will not respect any serial frames from the arduino until I connect to wifi, go into the UI, and open the master pattern in the editor. As soon as I click “edit”, the LEDs light up and everything works fine until the next power cycle. Most of the time when powering on the PB the LEDs stay dark, and playing with the encoder has no effect. Since the brightness is directly tied to analogInput[0], this would seem consistent with a default on condition of all sensor values being 0 and the PB ignoring all serial frames from the arduino until the editor is enabled.

Very confusing. Suggestions welcome.

You’ll need to send sensor board frames somewhat frequently, including on boot. The pb will wait for a bit for sb frames to come in before loading the pattern.

1 Like

Oh so should I just be constantly sending a frame on every loop regardless if anything has changed?

I would send it 10-40 times a second. It should not be too fast either. The framing also likes to see some small idle time between packets.

Gotcha. So if I understand, does the PB wait to see if it’s getting sensor frames on boot up to decide if there’s a sensor board attached and if it doesn’t see any then it won’t bother checking after that?

It does keep checking but sometimes there’s some initialization that happens during a pattern load that breaks if the SB isn’t present and won’t get reinitialized until another pattern loads. If a pattern crashes during initialization then it won’t run.

Well I haven’t gotten around to changing the code, BUT I did try this - as soon as I turned on the PB I started spinning the encoder knob (and so sending a bunch of sensor data frames), and behold! I get lights. I’m going to say that was the problem.

Thanks!

3 Likes

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