No project description provided
Project description
IS Matrix Forge
IS Matrix Forge is a Python framework for creating applications that drive 9×34 LED matrix displays. It provides high level helpers for talking to the hardware, tools for building animations, and utilities such as progress bars and a battery monitor.
Project Overview
Matrix Forge grew out of the LED Matrix Battery Monitor project. The goal is to make it easy to create rich LED matrix experiences from Python. In addition to monitoring the battery, you can design custom frames, display scrolling text, run animations, and integrate the LED matrix with your own applications.
Highlighted features include:
- Device discovery and control via
pyserial - Drawing grids and patterns with the
Gridclass - Built-in and custom animations
- Progress bars that render on the matrix
- A battery monitor example using these building blocks
Hardware Requirements
- LED Matrix display with dimensions 9x34 (compatible with the project's specifications)
- Serial connection to the computer (USB)
- The LED matrix should have the following hardware identifiers:
- VID: 0x32AC
- PID: 0x20
- Serial Number Prefix: FRAK
Software Dependencies
This project requires Python 3.12 or newer and the following dependencies:
- chime (>=0.7.0,<0.8.0) - For audio notifications
- pyserial (>=3.5,<4.0) - For serial communication with the LED matrix
- inspy-logger (>=3.2.3,<4.0.0) - For logging
- inspyre-toolbox (>=1.6.0) - Utility functions
- pillow (>=11.2.1,<12.0.0) - Image processing
- opencv-python (>=4.11.0.86,<5.0.0.0) - Image processing
- pysimplegui-4-foss (>=4.60.4.1,<5.0.0.0) - GUI components
- tk (>=0.1.0,<0.2.0) - GUI toolkit
- easy-exit-calls (>=1.0.0.dev1,<2.0.0) - Exit handling
- psutil - For battery status monitoring
Installation Instructions
Using Poetry (Recommended)
-
Clone the repository:
git clone https://github.com/Inspyre-Softworks/IS-Matrix-Forge.git cd IS-Matrix-Forge -
Install dependencies using Poetry:
poetry install -
Activate the virtual environment:
poetry shell
Using pip
-
Clone the repository:
git clone https://github.com/Inspyre-Softworks/IS-Matrix-Forge.git cd IS-Matrix-Forge -
Install the package:
pip install .
Usage Examples
Identify Connected Devices
from is_matrix_forge.led_matrix.helpers.device import DEVICES
for dev in DEVICES:
print(dev)
Display Text on the Matrix
from is_matrix_forge.led_matrix.controller.controller import LEDMatrixController
from is_matrix_forge.led_matrix.helpers.device import DEVICES
ctrl = LEDMatrixController(DEVICES[0])
ctrl.scroll_text("Hello World!", loop=False)
Controller Architecture
- Composition is implemented via multiple mixins that all use cooperative
initialization with
super(). - MRO ordering ensures safe access patterns during
__init__:DeviceBaseinitializes early so mixins can useself.device.BrightnessManagerprecedesBreatherManagerbecause the breather inspects brightness at init time.BreatherManagerprecedesIdentifyManagerbecauseIdentifyManagermay call@synchronizedmethods in__init__that rely on a breather pause context.Loggableis placed last so the cooperative chain can passlogger=safely.
- Thread safety: pass
thread_safe=Trueto enable an internalRLockused by the@synchronizeddecorator for device operations. - Logging: integrates with InspyLogger when available and falls back to a simple
logger; the controller passes
parent_log_devicethrough the cooperative chain and the fallback stub supports it.
MRO diagram (left → right, init order)
DeviceBase → KeepAliveManager → AnimationManager → DrawingManager → BrightnessManager → BreatherManager → IdentifyManager → Loggable
Progress Bars
import time
from is_matrix_forge.progress import tqdm
for _ in tqdm(range(100)):
time.sleep(0.05)
Battery Monitor Example
from is_matrix_forge.monitor import run_power_monitor
from is_matrix_forge.led_matrix.helpers.device import DEVICES
device = DEVICES[0]
run_power_monitor(device)
Troubleshooting
LED Matrix Not Detected
- Check that the LED matrix is properly connected to your computer.
- Verify that the LED matrix has the correct hardware identifiers (VID, PID, SN_PREFIX).
- Make sure you have the necessary permissions to access the serial port.
- Try running the application with administrator/root privileges.
Audio Notifications Not Working
- Ensure your system's audio is working correctly.
- Check that the WAV files for notifications exist in the expected locations.
- Verify that the chime library is properly installed.
Battery Status Not Updating
- Make sure psutil is properly installed.
- Check that your system supports battery status monitoring through psutil.
- Try increasing the battery_check_interval to reduce CPU usage.
Animation Issues
- Verify that the LED matrix is functioning correctly.
- Check that the matrix dimensions match the expected 9x34 size.
- Try clearing the matrix and restarting the application.
Contributing
Contributions are welcome! If you have ideas or improvements for Matrix Forge, feel free to open an issue or submit a pull request.
- See docs/contributing-mixins.md for guidance on authoring new controller mixins
using cooperative initialization and the
@synchronizeddecorator. A minimal reference mixin is available atis_matrix_forge/led_matrix/controller/components/example_template.py.
Quick checklist for a new controller mixin
- Create
is_matrix_forge/led_matrix/controller/components/<name>.pywithClassNameManager. - In
__init__(...), accept keyword-only args and callsuper().__init__(**kwargs). - Avoid IO-heavy work in
__init__; use@synchronizedfor device methods. - If calling synchronized methods in
__init__, ensure MRO places you afterBreatherManager. - If adding to the main controller, place after
DeviceBaseand beforeIdentifyManager; consider dependencies. - Provide docstrings, type hints, and a small usage example or test.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file is_matrix_forge-1.0.0.dev27.tar.gz.
File metadata
- Download URL: is_matrix_forge-1.0.0.dev27.tar.gz
- Upload date:
- Size: 925.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.10 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da7acc351424037e0ac0b4f0751ef8c1eaad9209080a2fa2e172b361615acc33
|
|
| MD5 |
1fcaf5adbdcf0e1c2674119ba9bad4e0
|
|
| BLAKE2b-256 |
974f7d7b1b83b256cb6e4d506464b356cb6eb1fcf5cc088c048278d82ed9059b
|
File details
Details for the file is_matrix_forge-1.0.0.dev27-py3-none-any.whl.
File metadata
- Download URL: is_matrix_forge-1.0.0.dev27-py3-none-any.whl
- Upload date:
- Size: 986.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.12.10 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3fdd5231fdf4fa4ce55318ebf23877cc6ff879ce4a01bda9faade13e8de7656
|
|
| MD5 |
31ee14481ac5b3a9440decc23945ce21
|
|
| BLAKE2b-256 |
c39bc2d95aea87cb351d793d1d78cee9b778e6d58979614f6b2e202e8971c965
|