title: Simple Arduino Controlled LED Serial Driver authors:
- joe_starr
/// caption
Arduino Mega from amperka/hardware-drawings [@amperka_hardware_drawings_2016]
///
Note to Reader
What Am I?
This repository contains an Arduino sketch which uses the FastLED library to control a collection (strip) of NEOPIXEL LED. The repository also contains a Python serial driver for commanding the Arduino. The python side is primarily designed around controlling the LED array based on feedback from a Polhemus Fastrak.
Simple installation by pip. You should probably be using uv projects: uv add SLASD
About the Documentation
The following document describes the "rules" and expectation for development. The "API Reference" page contains the technical context descriptions found in the source files. The "Use Cases" page contains a collection of use cases and a use case diagram for the tool. The "Decisions" page contains a collection of architectural decision records [@Kopp2018] giving context on why this tool is the way it is.
Issues
If you discover an issue with this repository or have a question, please feel free to open an issue. I've included templates for the following issues:
- 🖋️ Spelling and Grammar: Found some language that is incorrect?
- 🤷 Clarity: Found a section that just makes no sense?
- ❓ Question: Do you have a general question?
- 🐞 Bug: Found an error in the code?
- 🚀 Enhancement: Have a suggestion for improving the toolchain?
:fontawesome-solid-paper-plane: Open Issue!{ .md-button }
📃 Cite Me
⚖️ License
Planning and Administration
Tasks
Tasks are tracked as GitHub issues.
Version Control
The toolchain shall be kept under Git versioning. Development shall take place on branches with
main on GitHub as a source of truth. GitHub pull requests shall serve as the arbiter for inclusion
on main with the following quality gates:
- Running and passing the unit test suite.
- Running and passing linting and style enforcers.
- Successful generation of documentation.
Release Tagging
The project shall be tagged when a new feature or bug fix is merged into main. The tag shall follow semantic versioning for labels.
vMAJOR.MINOR.PATCH
Project Structure
Files and directories shall be lower case, where capital is not required by a tool, and contain no
' '.
📁 .
├── 📁 .github
│ ├── 📁 ISSUE_TEMPLATE
│ ├── 📁 PULL_REQUEST_TEMPLATE
│ ├── 📁 workflows
│ └── 📝 pull_request_template.md
├── 📁 .vscode
│ └── ⚙️ launch.json
├── 📁 docs
│ ├── 📁 contentt
│ │ ├── 📁 madr
│ │ ├── 📁 units
│ │ └── 📁 usecase
│ ├── 📁 infra
│ └── 📖 README.md
├── 📁 arduino_src
│ └── 🇨 arduino_src.ino
├── 📁 slasd
│ └── 🐍 __init__.py
├── ⚙️ .editorconfig
├── 🙈 .gitignore
├── 🛠️ .pre-commit-config.yaml
├── ⚙️ .rumdl.toml
├── ❄️ flake.lock
├── ❄️ flake.nix
├── 🛠️ Justfile
├── 📜 LICENSE
├── 📄 mkdocs.yml
├── 🐍 pyproject.toml
└── 🔒 uv.lock
Directories of Interest
- docs: This directory contains the high level documentation for the tool.
- arduino_src: This directory contains the source code of the Arduino side of the tool.
- slasd: This directory contains the source code of the python side of the tool.
- .github: This directory contains the GitHub infrastructure.
- .vscode: This directory contains the debugger configuration.
Define a Unit
A unit shall be a Python module.
Quality
The tool and its units shall fail-safe, that is the tool and its units can fail, but the failure must be detectable. A segfault is okay, an off by one error that computes the wrong value is not.
Unit Testing
No unit testing in the project only integration testing. See [ADR00002][./content/madr/00002_testing.md].
Integration Testing
The plugin shall have manual integration testing.
Requirements
Use Cases
Requirements are described as a collection of use cases and actors. There are two collections of the artifacts one for the client and one for the server. These are in turn collected into the following use case diagrams:
Client
flowchart LR
aS["👤 Server"]
SS(["Set State"])
RC(["Receive Command"])
aS --> RC
RC -. include .->SS
Server
flowchart LR
aU["👤 User"]
SC(["Send Command"])
aU --> SC
Architectural Decisions
Architectural decisions MADR [@Kopp2018] serve as the primary documentation for architectural decisions.
The following is the order of operations for the proposal of a MADR:
-
Create a branch for a proposal with the name:
proposal-{{short title}} -
Create a pull request with this template.
-
In the branch create a Markdown file based on the MADR Template. Name the Markdown file:
{{issue# padded to five digits}}-{{title}} -
When a decision is made change the status to:
- "accepted" and pull the branch into main branch
- "rejected" and pull the branch into main branch
Nonfunctional Requirements
Colors
Diagrams included in documentation for features (use case and unit descriptions) are expected to use the COLORS color palette.
Technologies
Languages and Frameworks
- git
- Python
- mermaid.js
- prek
- tombi
- rumdl
- ruff
- uv
- MADR[@Kopp2018]
Documentation of Implementation
Code Style Guide
Python code shall be formatted with ruff using the included style settings. Markdown files shall be formatted with ruff using the included style settings. TOML files shall be formatted with tombi using the included style settings.
Design and Documentation
System
Block Diagram
flowchart LR
device["BaseLedAnimator"]
cwr@{ shape: processes, label: "{{Collection}}<br>Device specific animators" }
commands@{ shape: processes, label: "{{Collection}}<br>Available Commands" }
device --> cwr
device --> commands
Class Diagram
classDiagram
class LedAnimationDevice {
+ init( COMport, baud, timeout, ledCount)
+ connect()
+ compNSndState( **kwargs)
- sendState( data)
- computeState( **kwargs)
}
class FastrakAnimationDevice {
- computeState( **kwargs)
}
class FastrakParams {
+ FastrakPostion posData
+ int angleToLight
+ int colorR
+ int colorG
+ int colorB
}
class SetLedCount{
+ init(count)
}
class CmdShow{
+ init()
}
class setLedOff{
+ init()
}
class SetLedState {
+ init(idx, color)
}
class GetCrc{
+ init()
}
class SerialCommand {
<<interface>>
- str commandId
- bytearray payload
+ send(ser)
}
class SerialCommandWithResponse {
<<interface>>
- sendResp(ser)
- sendRespLine(ser)
+ parsedResp()
}
SetLedState ..|> SerialCommand
CmdShow ..|> SerialCommand
setLedOff ..|> SerialCommand
SetLedCount ..|> SerialCommand
GetCrc ..|> SerialCommandWithResponse
SerialCommand ..|> SerialCommandWithResponse
FastrakAnimationDevice --|> LedAnimationDevice
FastrakParams --* FastrakAnimationDevice
SetLedState --* LedAnimationDevice
SetLedState --* LedAnimationDevice
CmdShow --* LedAnimationDevice
setLedOff --* LedAnimationDevice
SetLedCount --* LedAnimationDevice
GetCrc --* LedAnimationDevice
Unit Designs
Unit designs (and test description) for the client and server units (public members and methods) is found under their respective documentation sections.
Metadata
Release files for SLASD 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| slasd-2.0.0.tar.gz | 637.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| slasd-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 649.8 kB
Release files / slasd-2.0.0.tar.gz
| Download URL | slasd-2.0.0.tar.gz |
|---|---|
| Size | 637.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0aa5d8008b1511d8843091a6f2466585f19d12dfd96f27803f8fe5ac19ace272
|
|
BLAKE2b-256 checksum How to use checksums |
8ecfa02ebee962b458094d3fc212e4b910d934533f2897dac9c232657010dad9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / slasd-2.0.0-py3-none-any.whl
| Download URL | slasd-2.0.0-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bab21ae6ff377c571d30654ab520738129bc8c7e44b2ce39819e118c7117650c
|
|
BLAKE2b-256 checksum How to use checksums |
7c07d66952d4e290b109062e89feae100522aca18360fb2f406c6207cac1e963
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|