This repository contains the firmware, dashboard, Arduino test sketches, and simulation code for an eddy-current braking system built around an Arduino Due.
The project combines embedded motor control with a desktop dashboard and a Python simulation workflow for modeling braking behavior.
eddy_braking/
embedded_eddy_braking/ Rust firmware for the Arduino Due and egui dashboard
arduino_l298n_pwm_test/ Small Arduino sketch for L298N PWM and PI-loop checks
aide/ Supporting Arduino/C++ controller experiments
emagsim/ Python magnetic braking simulation workspace
eddy_braking/embedded_eddy_braking contains the primary embedded system:
- Rust
no_stdfirmware for the Arduino Due - AS5048A magnetic encoder SPI reader
- H-bridge motor drive through PWM
- Feedforward and PI speed-control modes
- UART command and telemetry protocol
- Native egui dashboard for live tuning and plotting
See eddy_braking/embedded_eddy_braking/README.md for hardware notes, build commands, flash commands, and the serial protocol.
eddy_braking/arduino_l298n_pwm_test contains a minimal Arduino sketch for
checking L298N wiring and motor response before using the full Rust firmware.
See eddy_braking/arduino_l298n_pwm_test/README.md for wiring and usage notes.
emagsim is a Python 3.12 simulation workspace for magnetic eddy-current
braking. It uses NGSolve/Netgen and includes a Marimo notebook for interactive
exploration.
Useful entrypoints:
cd emagsim
nix run .
nix develop -c python scripts/build_lockstep_demo.pyThe main workflows are built around Nix flakes:
- Use
nix buildandnix runfor firmware, dashboard, and simulation commands. - Use the Arduino IDE only for the standalone Arduino test sketch.
- Hardware flashing expects an Arduino Due connected over the Programming Port.
Firmware and dashboard:
cd eddy_braking/embedded_eddy_braking
nix build .#firmware-elf
nix build .#dashboard
nix run .#flash
nix run .#dashboardSimulation:
cd emagsim
nix run .- Generated build outputs, virtual environments, dashboard exports, and notebook export artifacts are intentionally ignored.
- Lockfiles are committed so the Nix, Rust, and Python environments stay reproducible.