
Leg Control
julien-martinez2/Reginleif
Custom robot based on the Reginleif from 86: Eighty-Six from Asato Asato

Custom robot based on the Reginleif from 86: Eighty-Six from Asato Asato
Main Control is an open-source printed circuit board by julien-martinez2, from the julien-martinez2/Reginleif repository on GitHub, published under the MIT licence. It is a 4-layer board of 65.1 × 32.6 mm with 62 parts on 91 nets, routed with 466 tracks and 113 vias.
It is built around the THVD1406DRL, AP63203WU and AP63205WU, with the BNO086, TPS259824ONRGET and EG1215AA among its other parts. Its parts include 25 capacitors, 11 resistors, 11 ICs, 8 connectors and 2 inductors. It belongs with the STM32 boards of this library.
A custom-engineered, distributed quadruped combat walker inspired by the XM2 Reginleif and M1A4 Juggernaut from the acclaimed light novel & anime series 86 - Eighty Six.
The goal of this project is to take the agility, distinctive gait mechanics, and rugged aesthetic of the XM2 Reginleif from 86 - Eighty Six and bring it into physical reality.
Building a multi-jointed legged walker from scratch serves as an end-to-end engineering challenge across multiple disciplines:
Open Source Philosophy: Advanced quadruped robotics often relies on expensive off-the-shelf smart actuators or proprietary platforms. By documenting every schematic, trade-off, calculation, and line of code, this repository aims to serve as a practical, open reference for robotics students, engineers, and hobbyists building their own legged systems.
The robot employs a hierarchical distributed architecture, offloading high-frequency motor control to dedicated microcontrollers while centralizing planning, telemetry, and stabilization:
┌────────────────────────────────────────┐
│ High-Level Intelligence │
│ Raspberry Pi (Vision, Autonomy) │
└──────────────────┬─────────────────────┘
│ SPI / UART
▼
┌────────────────────────────────────────┐
│ Central Master MCU ("Sun Board") │
│ • IMU Body Stabilization (BNO086) │
│ • Power Distribution & Battery Monitor│
│ • Master Gait Coordinator │
└──────────────────┬─────────────────────┘
│
┌──────────────────────────────┼──────────────────────────────┐
│ RS-485 Differential Bus │ (Master-Slave Protocol) │
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Planet Board 1 │ │ Planet Board 2 │ │ Planet Boards 3-4│
│ (STM32G031) │ │ (STM32G031) │ │ (STM32G031) │
│ 4x N20 Motors │ │ 4x N20 Motors │ │ 4x N20 Motors │
└──────────────────┘ └──────────────────┘ └──────────────────┘
│ SPI Bus │ (Master-Slave Protocol) │
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ [ 3S LiPo Battery (11.1V - 12.6V) ]
│
▼
[ TPS259827 15A eFuse ]
(UVLO Cutoff at 10.83V)
│
┌───────────────────────────┼───────────────────────────┐
│ VM (12V) Motor Power │ │
▼ ▼ ▼
┌───────────────────┐ ┌───────────────────┐ ┌──────────────────────┐
│ AP63205 (5V Buck) │ │ AP63203 (3.3V) │ │ TPS22919 Load SW │
│ -> Raspberry Pi │ │ -> Sun Board MCU │ │ -> Planet Board VDD │
└───────────────────┘ └───────────────────┘ └─────────┬────────────┘
│
┌───────────────────────────────────────┘
│ 5-Pin JST-PA Harness (12V, 3.3V, GND, RS485_A/B)
▼
┌─────────────────────────────────────────────────────────────────┐
│ MODULAR PLANET BOARD (x4) │
│ │
│ [ THVD1406 RS-485 ] <── UART DMA ──> [ STM32G031 MCU ] │
│ │ │
│ ┌───────────────────────────────┴────────┐ │
│ ▼ (SPI1 Bus) ▼ (SPI2) │Miniature worm gearboxes provide high stall torque and self-locking capabilities, but introduce mechanical backlash. To solve this, a dual-encoder feedback architecture is implemented:
| Sensor Type | Part & Interface | Resolution | Placement | Role in Control Loop |
|---|---|---|---|---|
| Incremental Magnetic Encoder | 2-Phase Hall (EXTI) | 2x Quadrature (~2107 counts/rev on motor shaft) | Motor Tail Shaft | High-frequency velocity estimation and instantaneous PID rate control. |
| Absolute Magnetic Encoder | MA730GQ-Z (SPI1) | 14-bit (16,384 counts/rev) | Output Joint Shaft (with Diametric Ring Magnets) | Absolute angle calibration (10 Hz) to eliminate gearbox play, backlash, and drift. |
The Cortex-M0+ interrupt controller is prioritized to guarantee that critical hardware signals and high-speed encoder transitions are never delayed by slower math computations:
Priority 0 (Highest) ──► SysTick & EXTI Lines (PA0, PB1, PB3, PC14, PA2 nFAULT)
│
Priority 1 ──► USART1 Communication & DMA Channels
│
Priority 2 ──► TIM2 (DRV8908 SPI Updates) & TIM3 (MagAlpha SPI Reads)
│
Priority 3 (Lowest) ──► TIM1 (Software Inverse Kinematics & PID Loops)nFAULT pin on PA2 triggers an immediate shutdown sequence on overcurrent or thermal warnings.| Timer | Execution Frequency | Period | Task Description |
|---|---|---|---|
| EXTI Lines | Asynchronous | < 1 µs | Hardware edge-triggered incremental encoder decoding (Motors 1–4). |
| TIM3 | 10 Hz | 100 ms | SPI1 sequential polling of the 4 joint-level MA730 absolute encoders. |
| TIM2 | 50 Hz | 20 ms | SPI2 multi-channel register write updating DRV8908 motor PWM/directions. |
| TIM1 | 20 Hz - 50 Hz | 20 - 50 ms | Inverse kinematics trajectory solving, PID position/velocity loop execution. |
Communication between the central master board and the leg modules uses DMA combined with hardware IDLE line detection (HAL_UARTEx_ReceiveToIdle_DMA):
// Non-blocking packet reception
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size) {
if (huart->Instance == USART1) {
// Validate header and packet checksum
if (Size >= 11 && rx_buffer[0] == 0xAA && rx_buffer[1] == 0x55) {
ParseMasterCommand(rx_buffer, Size);
}
// Immediately re-arm DMA reception for the next packet
HAL_UARTEx_ReceiveToIdle_DMA(&huart1, rx_buffer, RX_BUFFER_SIZE);
}
}All schematics, BOMs, mechanical studies, and test records are available in the repository:
magalpha.cpp)drv8908.cpp)Designed and engineered with passion by Julien Martinez (@julien-martinez2).
If you are working on custom quadruped walkers, legged robotics, or distributed motor controllers, feel free to open an issue, start a discussion, or contribute!
This project is distributed under the MIT License. See LICENSE for more details.
| Qty | Value | Footprint | References |
|---|---|---|---|
| 10 | 0.1uF | Capacitor_SMD:C_0603_1608Metric | C1, C2, C3, C7, C8, C9, C10, C12, C16, C25 |
| 5 | 1uF | Capacitor_SMD:C_0402_1005Metric | C20, C21, C22, C23, C24 |
| 5 | TPS22919DCKR | TPS22919DCKR:SOT65P210X110-6N | U7, U8, U9, U10, U11 |
| 4 | 22uF | Capacitor_SMD:C_0805_2012Metric | C13, C14, C17, C18 |
| 4 | MountingHole | MountingHole:MountingHole_2.2mm_M2 | H1, H2, H3, H4 |
| 3 | 10kR | Resistor_SMD:R_0603_1608Metric | R6, R8, R9 |
| 2 | 100kR | Resistor_SMD:R_0402_1005Metric | R3, R10 |
| 2 | 100uF | Capacitor_Tantalum_SMD:CP_EIA-7343-43_Kemet-X | C4, C5 |
| 2 | 10uF | Capacitor_SMD:C_0603_1608Metric | C11, C15 |
| 2 | WE-MAPI_4030 | WE-MAPI_4030:WE-MAPI_4030 | L1, L2 |
| 1 | 100R | Resistor_SMD:R_0402_1005Metric | R4 |
| 1 | 113kR | Resistor_SMD:R_0402_1005Metric | R2 |
| 1 | 120R | Resistor_SMD:R_0402_1005Metric | R7 |
| 1 | 1MR | Resistor_SMD:R_0402_1005Metric | R1 |
| 1 | 20uF | Resistor_SMD:R_0805_2012Metric | C19 |
| 1 | 33kR | Resistor_SMD:R_0402_1005Metric | R11 |
| 1 | 6.8nF | Capacitor_SMD:C_0402_1005Metric | C6 |
| 1 | 806R | Resistor_SMD:R_0402_1005Metric | R5 |
| 1 | AP63203WU | Package_TO_SOT_SMD:TSOT-23-6 | U5 |
| 1 | AP63205WU | Package_TO_SOT_SMD:TSOT-23-6 | U6 |
| 1 | Alim Connector | Connector_Wire:SolderWire-0.75sqmm_1x02_P4.8mm_D1.25mm_OD2.3mm_Relief | J8 |
| 1 | BNO086 | BNO086:IC_BNO086 | U4 |
| 1 | Conn_02x20_Odd_Even | Connector_PinHeader_2.54mm:PinHeader_2x20_P2.54mm_Vertical_SMD | J7 |
| 1 | EG1215AA | EG1215AA:SW_EG1215AA | S1 |
| 1 | Gun_Anchors | SM05B_PASS:SM05B_PASS | J6 |
| 1 | LegFL | SM05B_PASS:SM05B_PASS | J3 |
| 1 | LegFR | SM05B_PASS:SM05B_PASS | J4 |
| 1 | LegRL | SM05B_PASS:SM05B_PASS | J2 |
| 1 | LegRR | SM05B_PASS:SM05B_PASS | J5 |
| 1 | STM32G031G8Ux | Package_DFN_QFN:QFN-28_4x4mm_P0.5mm | U1 |
| 1 | SWD Pin Header | M20-7910442R:HARWIN_M20-7910442R | J1 |
| 1 | THVD1406DR | Package_SO:SOIC-8_3.9x4.9mm_P1.27mm | U3 |
| 1 | TPS259824ONRGET | TPS259824ONRGET:IC_TPS259824ONRGET | U2 |

julien-martinez2/Reginleif
Custom robot based on the Reginleif from 86: Eighty-Six from Asato Asato

julien-martinez2/Reginleif
Custom robot based on the Reginleif from 86: Eighty-Six from Asato Asato


Jin-Neuron/Turtle-Pico
The development board making electronics work easier and more widely

htumanyan/navien
Navien water heater wire protocol for communication with NaviLink and other attached devices


mhered/KiCAD_udemy_course
My notes on the course "PCB design with KiCAD - updated for KiCAD 9" by Dr Peter Dalmaris in Udemy

Ayan-nova/Design-of-a-Raspberry-PICO-Iot-Device-on-4-Layer-PCB-Design-With-Sensor-And-More
Design a Raspberry Pi Pico W-based Industrial IoT Gateway and Edge Controller using Kicad software.

JonasE99/HCP-Bridge
🚧 WIP – not yet manufactured or tested. KiCad PCB (one per door) connecting Hörmann series 4 garage door operators (ProMatic/SupraMatic, BUS/RJ12) to Loxone via ESP32-S3 and Wi-Fi.

Itachi-infinito/Raspberry-Pico-IoT-4-Layer-PCB
Raspberry Pi Pico IoT device on 4-layer PCB with sensors, KiCad schematics, PCB layout and 3D visualization.
It measures 65.1 × 32.6 mm and has 4 copper layers, 1.6 mm thick.
62 parts, built around the THVD1406DRL, AP63203WU, AP63205WU and BNO086. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the julien-martinez2/Reginleif repository on GitHub, at the commit this page was made from: the board is 2.1-Sun Board/V1/Main_Control.kicad_pcb and its schematic 2.1-Sun Board/V1/Main_Control.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).