A comprehensive LED grid control system with a Python client, Elixir/Phoenix server, and ESP32 controller implementations.
This project is organized into three main components:
- legrid/ - Elixir/Phoenix server that generates patterns and distributes frames
- py_controller/ - Python client that receives frames and controls LED hardware
- esp32/ - ESP32 implementation using AtomVM (Erlang for embedded)
The server generates patterns and sends frame batches to connected controllers:
cd legrid
mix deps.get
mix phx.serverThe server will start on http://localhost:4000 by default.
The Python controller connects to the server, receives frames, and drives the LED hardware:
cd py_controller
python main.pyFor development without physical hardware, the controller uses a mock implementation that logs LED updates.
For ESP32-based controllers, an AtomVM (Erlang) implementation is provided in the esp32/ directory.
The system implements an efficient batch frame transmission protocol:
- Frames are collected in batches for improved network efficiency
- Controllers acknowledge batches to ensure reliable delivery
- Dynamic batch sizing based on pattern characteristics
- Priority frames for pattern changes
- Automatic reconnection and recovery
- Statistics reporting and monitoring
- Connection status dashboard
- Support for multiple concurrent controllers
The server supports various pattern generators:
- Game of Life
- Sine waves
- Conway patterns
- Custom animations
- And more...
Docker configuration is provided for containerized deployment:
docker-compose upFor development, the Python controller automatically uses a mock hardware implementation when physical LEDs aren't available.
The server includes a development dashboard at http://localhost:4000/dashboard for real-time monitoring.
MIT