Talk to PB with serial?

I have an idea for a project and want to know if a PB would be a good candidate.

In this project, another microcontroller has data (just a single 32b integer) that the PB would need on a frame-by-frame basis.

Can I just be piping that number over a serial connection and still get a pretty high frame rate (ideally maybe up to 500 FPS)?

Definitely possible to support some data over serial with a few changes. I was thinking about supporting JSON input (any line that starts with ‘{’ basically, that would send it to the parser that handles incoming websocket requests. This way you could change patterns, set vars, and that sort of thing.

I think getting it in lock-step frame-by-frame or hitting 500 FPS would be pretty tricky though. What are you trying to feed it for animations that fast? Some POV stuff?

I want to have LEDs underneath an electric longboard. The pattern on the LEDs would scroll backward at the same rate the board moves forward, giving the illusion of a stationary pattern.

So I would reprogram the speed controller to send out the distance traveled over serial (unless another protocol would work better?)

The 500 FPS comes from a calculation involving the top speed of the longboard and the pixel density of the strips, and trying to maintain single pixel movement resolution. It’s not critical though, obviously.

Also, I don’t think it would have to be in lock step frame by frame, per se. There could be 0, 1, or more distance updates per frame. As long as I could get and process them fast enough to keep the illusion.

Ah. So the frequency of speed updating shouldn’t be too critical.

Without any modification you could emulate a sensor board, and put the data in one of those slots, like an analogInput[] or something. You’d only get about 40 updates/sec (perhaps up to twice that if you send faster than the SB sends), but if the speed is sent and position calculated in beforeRender using delta, there wouldn’t be much error between frames, just whatever acceleration or deceleration happened since the last frame. You could combine a few elements to get a higher resolution value if needed.

The frame is documented here:

1 Like

I just got my PB and would really love to see this feature implemented. I want to use it for my electric scooter. It has an Arduino connected to it and I’d like it to be able to change the the light patterns (turn left, turn right, brakes, etc). @Ben Any chance we could get an update with this functionality? :slight_smile: