mrozycki/rustmas

Implement Local Light Client for Raspberry Pi communication over pins

Closed this issue · 2 comments

For more time-sensitive applications, we might want to connect the lights to the Raspberry Pi running the backend directly with a cable, rather than through WiFi and Pico. In order to achieve that, we need:

  1. An implementation of LightClient that will communicate with the lights over local Raspberry Pi pins
  2. An option to run the webapi and animator with that new light client implementation

There doesn't seem to be a solution in Rust to reliably control a string of LEDs from a Raspberry Pi 4, due to its variable clock frequency. We might spend more time trying to implement our own solution later (or maybe one will show up), but for now it seems like the best way for local control is to use python's neopixel library.

For that reason we decided that for now we will use a simple python script to fetch frames from a websocket endpoint in webapi, and forward them to the LEDs through neopixel.

In the end we resolved it with a TTY client, sending data over USB through an emulated serial port to an Raspberry Pi Pico running https://github.com/krzmaz/pico-usb-neopixel-driver. See #148