pybricks-projects icon indicating copy to clipboard operation
pybricks-projects copied to clipboard

Decoding hub broadcast signals on the computer

Open pbochynski opened this issue 3 years ago • 5 comments

Added example of how to decode hub broadcast data with bleak library. Resolves the first part of this issue: https://github.com/pybricks/support/issues/800 It requires a patch for the experimental firmware that sends the proper message length.

pbochynski avatar Nov 29 '22 15:11 pbochynski

Thank you!

I think we will be able to look at this after we release V3.2, so it may be a while before it gets merged.

laurensvalk avatar Nov 29 '22 15:11 laurensvalk

One thing to consider here is that Bleak is doing active scanning. So this should probably come with a warning that if you leave the script running a long time, it can drain the batteries of any other BLE devices you have in the neighborhood. It is possible to do passive scanning with Bleak to avoid this on Windows and Linux (Linux requires new enough BlueZ, kernel and manual configuration).

dlech avatar Nov 29 '22 15:11 dlech

The broadcasting feature is now part of the release and has undergone a few small changes since this PR was made.

If you'd like to update the sample program or the PR, feel free to let us know.

laurensvalk avatar Nov 24 '23 20:11 laurensvalk

@laurensvalk If you still see the value in this PR, I can adapt the PR to the new release.

pbochynski avatar Dec 06 '23 09:12 pbochynski

Sure, that would be awesome!

If you have any other MicroPython boards (pico, pyboard, etc), another nice project would be to let those broadcast/scan just like the LEGO hubs. This could make it easy to integrate LEGO with other IoT stuff.

laurensvalk avatar Dec 06 '23 09:12 laurensvalk