mechanicsdsl-embedded
Deploy MechanicsDSL simulations to Arduino, Raspberry Pi, and ARM edge devices.
Overview
mechanicsdsl-embedded provides deployment infrastructure and examples for running MechanicsDSL-generated simulations on embedded and edge platforms. Write your physical system once in DSL notation; generate optimized, dependency-free C++ or no_std Rust ready to flash or deploy.
All examples originate from MechanicsDSL DSL specifications — the originating spec is included as a comment in every generated source file.
Examples
Arduino
| Example | System | Rate | Hardware |
|---|---|---|---|
arduino_pendulum/ |
Simple pendulum + MPU6050 IMU | 250 Hz | Arduino Uno |
arduino_double_pendulum/ |
Double pendulum (chaotic) | 200 Hz | Arduino Mega 2560 |
Raspberry Pi
| Example | System | Rate | Features |
|---|---|---|---|
raspberry_pi_pendulum/ |
Simple pendulum | 250 Hz | pigpio, POSIX RT scheduling, NEON, GPIO energy alert |
raspberry_pi_double_pendulum/ |
Double pendulum | 200 Hz | pigpio, POSIX RT scheduling, GPIO energy alert |
Repository Structure
mechanicsdsl-embedded/
├── examples/
│ ├── arduino_pendulum/ .ino + README
│ ├── arduino_double_pendulum/ .ino + README
│ ├── raspberry_pi_pendulum/ .cpp + README
│ └── raspberry_pi_double_pendulum/ .cpp + README
├── cmake/
│ └── arm-toolchain.cmake ARM cross-compilation toolchain
├── docker/
│ ├── Dockerfile ARM cross-compilation environment
│ └── docker-compose.yml
├── scripts/
│ ├── cross_compile_arm.sh One-command ARM build via Docker
│ └── monitor_serial.py Real-time serial CSV plotter
├── docs/
│ ├── getting_started.md
│ └── hardware_guide.md Wiring, platform support, performance notes
└── tests/
└── test_eom.py Physics correctness via SciPy reference
Quick Start
Arduino
- Open
examples/arduino_pendulum/pendulum_realtime.inoin Arduino IDE - Select board and port → Upload
- Open Serial Monitor at 115200 baud
Raspberry Pi
sudo apt-get install pigpio libpigpio-dev cmake g++
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo ./pendulum_rpi
ARM Cross-Compilation (from x86 host)
./scripts/cross_compile_arm.sh
scp build_arm/pendulum_rpi pi@<ip>:~/
ssh pi@<ip> "sudo ~/pendulum_rpi"
Real-Time Serial Monitor
pip install pyserial matplotlib numpy
python scripts/monitor_serial.py --port /dev/ttyUSB0
Testing (no hardware required)
pip install pytest numpy scipy
pytest tests/ -v
Physics correctness is validated against SciPy reference integrations — period accuracy, energy conservation, equilibrium stability.
Code Generation
All examples can be regenerated from DSL specifications:
pip install mechanicsdsl-core[embedded]
mechanicsdsl generate pendulum.msl --target arduino
mechanicsdsl generate pendulum.msl --target raspberry_pi
Contributing
See CONTRIBUTING.md. Hardware validation on new platforms especially welcome.
License
MIT License — see LICENSE.
Metadata
Release files for mechanicsdsl-embedded 0.1.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 | |
|---|---|---|---|
| mechanicsdsl_embedded-0.1.0.tar.gz | 19.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mechanicsdsl_embedded-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.3 kB
Release files / mechanicsdsl_embedded-0.1.0.tar.gz
| Download URL | mechanicsdsl_embedded-0.1.0.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4a7c55f55db8bc3228fc0112397d295b9a58d39c940319af85b36351cf815f6
|
|
BLAKE2b-256 checksum How to use checksums |
de0b6ff0a1099344e19255e745d9b4e65b4eba80853cba7f42b594205fb40e74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.
Transparency logRelease files / mechanicsdsl_embedded-0.1.0-py3-none-any.whl
| Download URL | mechanicsdsl_embedded-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bf044044b727d41e7546921ee2226409baa5f4760ea7721dde7daa723f20d2f
|
|
BLAKE2b-256 checksum How to use checksums |
ec9961c79c316f210ac190c027c28742f4f06042fa584eed16ff65db5e4fa464
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.
Transparency log