Skip to content

Examples catalogue

All examples live in examples/mechatronics/. Run any of them with embeddyn mechatronics run <file> (add --mock to replace real simulators with built-in models) or open them in the Lab.

Projects

Project Domains and backends Needs Shown in
dc-motor.yaml firmware, electrical, mechanical: all mock — Tutorial 1, 10
dc-motor-ngspice.yaml mock firmware · ngspice 20 kHz H-bridge · mock mechanics libngspice Tutorial 2
dc-motor-mosfet.yaml mock firmware · ngspice MOSFET H-bridge with dead time and device losses · mock mechanics libngspice ngspice adapter
dc-motor-renode.yaml Renode STM32 speed controller · mock electrical/mechanical Renode
dc-motor-full.yaml Renode firmware · ngspice H-bridge · mock mechanics Renode, libngspice Tutorial 2
servo-drivetrain.yaml PI · DCMotorRL · GearedDrivetrain with backlash · ThermalRC — Tutorials 7, 8
mujoco-arm.yaml function generator · PI · DCMotorRL · MuJoCo arm mujoco Tutorial 3
rc-servo-lab.yaml function generator · pulse generator · RCServo · slider; Lab layout — Tutorial 11
rc-servo-l476.yaml Renode STM32L476 · RCServo · replayed operator; UART console Renode Tutorial 4
rc-servo-l476-can.yaml as above with CAN status/command frames Renode ≥ 1.17 Renode adapter
rc-servo-l476-canbus.yaml Renode STM32L476 on a shared CAN bus model with a restbus node; 15 m cable Renode ≥ 1.17 Renode CAN
mujoco-arm-firmware.yaml Renode STM32L476 · H-bridge · DCMotorRL · ThermalRC · MuJoCo; encoder, SPI AS5047P, I²C AS6221 Renode ≥ 1.17, mujoco Tutorial 5
ir-curtain-channel.yaml strobe (firmware) · obstacle · IrBeamPath · ngspice IR LED driver, phototransistor and comparator libngspice Lab breadboard view
multiboard-canopen-ble.yaml 4 CANopen boards on a CAN bus model · BLE gateway · Wi-Fi bridge and access point — Multi-board buses and analyzer
rf-lab.yaml NFC reader + NTAG213 · EM4100 · UHF Gen2 inventory · LoRaWAN node + gateway · BLE beacon, sensor, phone · WPA2 AP, station, deauther cryptography for LoRaWAN decryption RF lab
cable-lab.yaml CANopen on 130 m of twisted pair (past the 500 kbit/s limit) · I2C TMP102 over 2 m of shielded cable — Distance, cables and I2C
wired-lab.yaml GPS → MCU over UART (NMEA) · PLC ↔ drive on RS-485 (Modbus RTU) · MCU ↔ LIS3DH on SPI · TMP102 on I2C · PLC ↔ remote I/O on Ethernet (ARP, TCP, Modbus/TCP, UDP); timed fault bursts on every bus — Wired lab
two-wheel-drive.yaml 2 × PI · 2 × DCMotorRL · FMU wheel · GearedDrivetrain wheel; multi-rate built FMU Tutorial 6

Light-curtain bench

File Command Shows
light-curtain/spect-curtain.yaml curtain-run (approach; --scenario static/rod/orbit) SPECT curtain heads on the patient phantom
light-curtain/led-sweep.yaml curtain-sweep LED half angle × intensity × algorithm on the rod test
light-curtain/alignment-sweep.yaml curtain-sweep LED half angle × mounting error
worlds/spect_light_curtain.wbt webots the same bench in 3-D, generated by curtain-webots

See Light-curtain bench and Webots.

Analysis specs

Spec Command Project
tuning/servo-pi.yaml tune servo-drivetrain
tuning/pi-mock.yaml tune dc-motor (mock)
tuning/two-wheel.yaml tune two-wheel-drive
tuning/arm-firmware.yaml tune (Nelder–Mead) mujoco-arm-firmware
tuning/arm-firmware-cmaes.yaml tune (CMA-ES, 4 workers) mujoco-arm-firmware
tuning/dead-time.yaml tune (4 workers) dc-motor-mosfet
tolerance/servo.yaml tolerance servo-drivetrain
estimation/dc-motor.yaml estimate dc-motor + bench/dc-motor-step-test.csv

Supporting files

Directory Contents
firmware/ C sources and Makefiles for the STM32L476 examples (rc-servo-l476, arm-joint-l476, motor-speed-control)
renode/ .resc scripts and .repl platform descriptions (incl. the SPI/I²C sensor platform)
bindings/ Renode, ngspice and Webots binding files
circuits/ SPICE netlists (motor-hbridge.cir, motor-hbridge-mosfet.cir)
mujoco/ MJCF models (arm-joint.xml)
fmus/ the rotational-load FMU (FMI 2 and 3) and its build script
golden/ golden waveforms for verification
rc-servo/ operator command profile (replay CSV)
controllers/, worlds/ Webots controller bridge and worlds
experiments/, hil/, digital-twin/ platform features: sweeps, HIL safety policies, twin evidence