Skip to main content

Embedded deployment tools and examples for MechanicsDSL — Arduino, Raspberry Pi, and ARM

Project description

MechanicsDSL Logo

mechanicsdsl-embedded

Deploy MechanicsDSL simulations to Arduino, Raspberry Pi, and ARM edge devices.

Active Targets MIT License Core Package


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

  1. Open examples/arduino_pendulum/pendulum_realtime.ino in Arduino IDE
  2. Select board and port → Upload
  3. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mechanicsdsl_embedded-0.1.0.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mechanicsdsl_embedded-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file mechanicsdsl_embedded-0.1.0.tar.gz.

File metadata

  • Download URL: mechanicsdsl_embedded-0.1.0.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mechanicsdsl_embedded-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c4a7c55f55db8bc3228fc0112397d295b9a58d39c940319af85b36351cf815f6
MD5 16dbe97b6ffebe5321d91d870fe75a82
BLAKE2b-256 de0b6ff0a1099344e19255e745d9b4e65b4eba80853cba7f42b594205fb40e74

See more details on using hashes here.

Provenance

The following attestation bundles were made for mechanicsdsl_embedded-0.1.0.tar.gz:

Publisher: publish-pypi.yml on MechanicsDSL/mechanicsdsl-embedded

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mechanicsdsl_embedded-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mechanicsdsl_embedded-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bf044044b727d41e7546921ee2226409baa5f4760ea7721dde7daa723f20d2f
MD5 854649e1ceb7affbe0a2e8b4da15e102
BLAKE2b-256 ec9961c79c316f210ac190c027c28742f4f06042fa584eed16ff65db5e4fa464

See more details on using hashes here.

Provenance

The following attestation bundles were made for mechanicsdsl_embedded-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on MechanicsDSL/mechanicsdsl-embedded

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page