Taken from http://github.com/richardghirst/rpi_ws281x.
Code found here: https://www.waveshare.com/wiki/PI4-FAN-PWM
python3 -m venv .
./bin/pip install rpi_ws281x
./bin/pip install gpiozero
./bin/pip install pigpio
./bin/pip3 install lgpio RPi.GPIO
./bin/pip3 install --upgrade lgpio
./bin/pip3 install requests
./bin/pip3 install matplotlib| LED Number | Location | Description |
|---|---|---|
| 0 | interior | between dami-3bplus 2 and dami-3bplus-3 |
| 1 | interior | between dami-3bplus-3 and dami-3bplus-1 |
| 2 | interior | between dami-3bplus-1 and goun-3bplus-1 |
| 3 | interior | between goun-3bplus-1 and goun-3bplus-2 |
| 4 | interior | goun-3bplus-2 |
| 5 | interior | dami-3b-1 |
| 6 | interior | between dami-3b-2 and goun-3bplus-3 |
| 7 | interior | between goun-3bplus-3 and dami-3bplus-2 |
| 8 | exterior | between dami-3bplus-1 and goun-3bplus-1 |
| 9 | exterior | goun-3bplus-1 |
| 10 | exterior | between goun-3bplus-2 and goun-3bplus-2 |
| 11 | exterior | goun-3bplus-2 |
| 12 | exterior | between goun-3bplus-2 and dami-3b-1 |
| 13 | exterior | dami-3b-1 |
| 14 | exterior | between dami-3b-1 and dami-3b-2 |
| 15 | exterior | dami-3b-2 |
| 16 | exterior | between dami-3b-2 and goun-3bplus-3 |
| 17 | exterior | between goun-3bplus-3 and dami-3bplus-2 |
| 18 | exterior | dami-3bplus-2 |
| 19 | exterior | between dami-3bplus-2 and dami-3bplus-3 |
| 20 | exterior | dami-3bplus-3 |
| 21 | exterior | between dami-3bplus-3 and dami-3bplus-1 |
| 22 | exterior | dami-3bplus-1 |
| 23 | exterior | between dami-3bplus-1 and goun-3bplus-1 |
| Board Name | LED Numbers (interior) | LED Numbers (exterior) |
|---|---|---|
| dami-3bplus-2 | 0 | 8, 18, 19 |
| dami-3bplus-3 | 0, 1 | 8, 19, 20, 21 |
| dami-3bplus-1 | 1, 2 | 8, 21, 22 |
| goun-3bplus-1 | 2, 3, 9 | 8, 9, 10, 22, 23 |
| goun-3bplus-2 | 3, 4, 10, 11 | 10, 11, 12 |
| dami-3b-1 | 5, 13 | 13, 14 |
| dami-3b-2 | 5, 6, 15 | 14, 15, 16 |
| goun-3bplus-3 | 6, 7 | 16, 17 |
| dami-3bplus-2 | 7 | 17, 18, 19 |
Create a new service file in /etc/systemd/system/ with a .service extension.
For example, you could name it light_server.service. As for the content, have a look at the light_server.service file in this repository.
Now, you need to reload the systemd manager configuration with the following command:
sudo systemctl daemon-reloadEnable the service to start at boot time:
sudo systemctl enable light_server.serviceStart the service:
sudo systemctl start light_server.serviceCheck the status of the service:
sudo systemctl status light_server.serviceThis should show that your service is active and running.
Stop the service:
sudo systemctl stop light_server.serviceCreate a new service file in /etc/systemd/system/ with a .service extension.
For example, you could name it load_client.service. As for the content, have a look at the load_client.service file in this repository.
sudoedit /etc/systemd/system/load_client.serviceNow, you need to reload the systemd manager configuration with the following command:
sudo systemctl daemon-reloadEnable the service to start at boot time:
sudo systemctl enable load_client.serviceStart the service:
sudo systemctl start load_client.serviceCheck the status of the service:
sudo systemctl status load_client.serviceThis should show that your service is active and running.
If in trouble, launch this command to get detailed logs:
sudo journalctl -u load_client -f &Stop the service:
sudo systemctl stop load_client.serviceThe shutdown server can be run as a systemd service. Here are the steps to create and enable the service:
- Create a new file in
/etc/systemd/system/namedshutdown-server.service. The content of the file should be as what you'll find in theshutdown-server.servicefile in this repository. - Reload the systemd manager configuration with
sudo systemctl daemon-reload. - Enable the service to start on boot with
sudo systemctl enable shutdown-server. - Start the service with
sudo systemctl start shutdown-server. - Install net-tools using the package manager of your system.
sudo apt-get install net-tools nmap
You can check the status of your service with sudo systemctl status shutdown-server.
Open a terminal.
Navigate to the directory where shutdown-client.py is located using the cd command.
For example:
cd /home/poddingue/rpi-ws281x-python/
Run the script with Python. If you want to send a 'reboot' command, you can run the script without any arguments. If you want to send a 'shutdown' command, you can provide any argument:
./bin/python3 examples/shutdown-client.py or
./bin/python3 examples/shutdown-client.py shutdown.
ssh-copy-id -i ~/.ssh/roundernetes.pub [email protected]
We use Ansible to automate the setup and configuration of our project. Here are the steps we've taken recently:
- We've created an inventory file (
inventory.ini) that specifies the hosts we want to manage with Ansible. Here's what it looks like:
[pis]
192.168.1.28 ansible_python_interpreter=/usr/bin/python3- We've encountered an issue where Ansible was unable to find the Python interpreter on the remote host. We resolved this by creating a symbolic link between python and python3 on the remote host:
sudo ln -s /usr/bin/python3 /usr/bin/python - We've also encountered an issue where the Python setuptools package was not installed on the remote host. We resolved this by installing setuptools using the pip package manager:
python3 -m pip install setuptools - If the pip package manager is not installed on your system, you can install it using the package manager of your operating system. On a Debian-based system like Ubuntu, you can use the apt package manager to install pip for Python 3:
sudo apt update sudo apt install python3-pip - Please note that these commands need to be run on the remote host where you are trying to execute the Ansible playbook.
This repository contains the necessary files to set up a periodic CPU stress test using systemd.
systemd/stress-cpu.service: Systemd service file.systemd/stress-cpu.timer: Systemd timer file.scripts/random-stress-cpu.sh: Script to run the stress test.
[WARNING]: Ansible is being run in a world writable directory (/mnt/c/support/users/FOSDEM/2025/rpi-ws281x-python), ignoring it as an ansible.cfg source.
It indicates that Ansible is ignoring our ansible.cfg file because it is located in a world-writable directory. This is a security feature to prevent unauthorized modifications to Ansible's configuration.
A world-writable directory is one where all users on the system have write permissions (e.g., chmod 777).
Ansible ignores ansible.cfg files in such directories to prevent potential security risks (e.g., malicious users modifying the configuration).
Move the ansible.cfg file to a directory that is not world-writable. For example:
- Create a new directory for Ansible configuration:
mkdir ~/.ansible- Move the ansible.cfg file to this directory:
mv /mnt/c/support/users/FOSDEM/2025/rpi-ws281x-python/ansible.cfg ~/.ansible/ansible.cfg- Update the roles_path in the new ansible.cfg file to point to the correct location:
[defaults]
roles_path = /mnt/c/support/users/FOSDEM/2025/rpi-ws281x-python/ansible/rolesAfter applying the above fix, run the playbook again:
ansible-playbook -i ansible/inventory/hosts ansible/playbooks/deploy-stress-test.ymlThe warning should no longer appear, and Ansible should correctly recognize the ansible.cfg file.
- Clone the repository:
git clone https://github.com/MerryKombo/rpi-ws281x-python.git cd rpi-ws281x-python