2.4 KiB
test message
For using the: RGB-Matrix-P3-64x32 by Wavshare with driver chips: FM6047 In order to set up the pi in such a way that the RGB LED matrixes can operate at their rated brightness a init script from the screen manuafacturer needs to be ran. A guide on how to is on the following webpage: https://www.waveshare.com/wiki/RGB--Matrix-P3-64x32-Reginit
The used guide for setting up the rpi as an AP: https://learn.sparkfun.com/tutorials/setting-up-a-raspberry-pi-3-as-an-access-point/all
RGB Matrix Display with MQTT Control (roy-test.py)
This script uses the RGBMatrix library to control an RGB matrix display. It also connects to an MQTT broker to receive messages and toggle the display color. Requirements
Python 3.x
rgbmatrix library
paho.mqtt.client library
PIL library
Installation
Clone or download the script.
Install the required libraries by running the following command:
pip install rgbmatrix paho-mqtt Pillow
Usage
Connect your RGB matrix display to your device.
Update the configuration options in the script to match your display specifications (rows, columns, chain length, etc.).
Modify the MQTT broker address in the client.connect line to match your MQTT broker's address.
Run the script using the following command:
python rgb_matrix_mqtt.py
Description
This script sets up an RGB matrix display using the RGBMatrix library. It also creates an offscreen canvas that can be written to and then displayed on the matrix asynchronously.
The script connects to an MQTT broker using the paho.mqtt.client library. It subscribes to the "test" topic and listens for incoming messages. When a message is received, it toggles the display color between white, red, and an image loaded from a file.
The image is loaded using the PIL library and resized to fit the matrix display. The pure_pil_alpha_to_color_v2 function converts an RGBA image to RGB format by applying an alpha composite with a specified color.
To use this script, you need to provide the appropriate configuration for your RGB matrix display, including the number of rows, columns, chain length, and hardware mapping. You also need to specify the MQTT broker's address to connect to. License
python numpy and scipy can directly be install on an rpi zero (without increasing swap memory or building) by getting the packages using apt-get:
sudo apt-get install python3-matplotlib python3-numpy python3-scipy python3-opencv python3-pandas python3-dev