PCB Project
Miniata
Summary
Mini BLDC Servo compatible with SimpleFOC
- Created
- 25th Jun, 2026
- Updated
- 26th Nov, 2026
- License
- CERN-OHL-S-2.0
Description
Miniata - BLDC Servo Actuator with Dual Absolute Encoders



Miniata is an open-source brushless DC (BLDC) servo actuator designed for robotic joints, pan-tilt mechanisms, and miniature actuators.
Built around an STM32H503KBU6 (Arm Cortex-M33, up to 250 MHz) and a Texas Instruments DRV8311H 3-phase gate driver, Miniata implements Field-Oriented Control (FOC) using a motor-shaft magnetic encoder for commutation and an output-shaft magnetic encoder for direct load position tracking, compensating for gearbox backlash.



Key Features
- Microcontroller: STM32H503KBU6 (Arm Cortex-M33 @ 250 MHz, 128 KB Flash, 32 KB SRAM, UFQFPN-32).
- Integrated Power Stage: TI DRV8311HRRWR 3-phase motor driver with integrated MOSFETs, 5 A peak current capability, and internal current-sense amplifiers (CSAs).
- Dual 14-Bit Magnetic Encoders: Two MagnTek MT6701QT sensors interfaced over a shared SPI2 SSI bus (8 MHz).
- Encoder 1 (Motor Shaft): Electrical angle measurement for FOC commutation and velocity estimation.
- Encoder 2 (Output Shaft): Absolute position measurement at the output horn, decoupling backlash and gear wear from output tracking.
- Gearbox Kinematics: Compound reduction gearbox with a ratio of 21.1538461 : 1 ().
- Host Communication: Configurable interface on
PB6/PB7supporting I2C / I3C target mode (production, address0x30) or USART1 (development / telemetry, 250,000 baud). - Bootloader: Katapult bootloader supporting in-application software reset and bus-based firmware updates.
- Telemetry Subsystem:
- 3-phase low-side current sense amplifier outputs for FOC torque control.
- Phase BEMF resistor divider network with virtual neutral reference for sensorless state detection.
- Form Factor: Circular PCB (28 mm diameter) designed for integration inside a 3D-printed servo housing.

Hardware Specifications
Core Specifications
| Specification | Value | Notes |
|---|---|---|
| Microcontroller | STM32H503KBU6 | Arm Cortex-M33 @ 250 MHz, 128 KB Flash, 32 KB SRAM |
| Motor Driver | TI DRV8311HRRWR | 3x PWM Hardware Mode, 5 A peak, integrated CSAs |
| Supply Voltage | 5.0 V nominal | 4.5 V to 5.5 V operating range |
| Motor Type | 1104 4300KV BLDC | 12N14P configuration (7 pole pairs) |
| Position Sensors | 2 × MagnTek MT6701QT | 14-bit (16,384 cpr) absolute magnetic encoders |
| Gear Reduction | 21.1538461 : 1 (275 / 13) | Kinematic sign: |
| Host Bus | I2C / I3C / USART1 | Shared pins PB6 / PB7 |
| Programming & Debug | SWD & Katapult Bootloader | SWDIO (PA13), SWCLK (PA14), SWO (PB3) |
| Feedback Indicators | Red & Blue LEDs | PC14 (Red), PB8 (Blue) |
Implementation Notes
- DRV8311H Straps: The hardware variant DRV8311HRRWR is configured in 3x PWM Mode (
MODEpin floating / Hi-Z). In 3x PWM Mode,INH_xdrives the phase outputs, andINL_xoperates as active-high bridge enable (EN_x).GAINconfigures current-sense gain, andSLEWsets output slew rate. nFAULTLine Omission: The driver fault line is not routed to an MCU GPIO. Driver faults must be inferred in firmware from current/position telemetry.- Power Envelopes & Limits:
- USB 5V (1 A port budget): Coil current must stay total (stationary
voltage_limit). Sustained motion above 20 rad/s is not feasible under USB power. - External 5V Battery: Stationary
voltage_limit(, safely below driver overcurrent protection). As rotor velocity increases, voltage rises toward 5.0 V as back-EMF opposes supply voltage: .
- USB 5V (1 A port budget): Coil current must stay total (stationary
- Current-Sense Outputs: CSA outputs on
PA4,PA5, andPA6are analog signals with a mid-scale bias, not raw shunt voltages. Offset and gain are calibrated in firmware. - Shared SSI Bus Timing: Dual MT6701QT encoders share SPI2 (
CLKon PA12,SDOon PA15). When chip-select is de-asserted, the MT6701 acts as an I2C slave on the same pins. Clocking SSI at prevents eavesdropping false-ACKs from corrupting data.
Hardware Architecture & Pinout
System Architecture
flowchart TD
Host["Host Controller (I2C / I3C / UART)"] -->|"PB6 / PB7"| MCU["STM32H503KBU6 (250 MHz Cortex-M33)"]
subgraph sensing_arch ["Sensing Architecture"]
EncBus["Shared SSI Bus"]
Enc1["MT6701QT 1 (Motor Shaft)"]
Enc2["MT6701QT 2 (Output Shaft)"]
CSA["Current Shunts and BEMF"]
end
subgraph actuation_stage ["Actuation and Power Stage"]
Driver["TI DRV8311H Gate Driver"]
Motor["1104 4300KV BLDC Motor"]
OutputShaft["Servo Output Horn"]
end
MCU -->|"SPI2 SCK / MISO"| EncBus
EncBus -->|"CS1 (PA11)"| Enc1
EncBus -->|"CS2 (PC15)"| Enc2
CSA -->|"ADC1"| MCU
MCU -->|"TIM1 3x PWM + Enables"| Driver
MCU -->|"PB15 (nSLEEP)"| Driver
Driver -->|"3-Phase PWM (A, B, C)"| Motor
Motor -->|"Rotor Shaft"| Enc1
Motor -->|"Gearbox 21.15:1"| OutputShaft
OutputShaft --> Enc2



Pinout and Peripheral Assignment
1. Motor Driver (DRV8311H in 3x PWM Mode)
| Signal | MCU Pin | Peripheral | Description |
|---|---|---|---|
INH_A | PB5 | TIM1_CH3 (AF1) | Phase A PWM High Input |
INL_A | PB1 | GPIO Output | Phase A Half-Bridge Enable (EN_A, active HIGH) |
INH_B | PA9 | TIM1_CH2 (AF1) | Phase B PWM High Input |
INL_B | PB0 | GPIO Output | Phase B Half-Bridge Enable (EN_B, active HIGH) |
INH_C | PA8 | TIM1_CH1 (AF1) | Phase C PWM High Input |
INL_C | PA7 | GPIO Output | Phase C Half-Bridge Enable (EN_C, active HIGH) |
SLEEP | PB15 | GPIO Output | Global Driver Sleep (nSLEEP, HIGH = active) |
2. Dual Magnetic Encoders (Shared SSI Bus)
| Signal | MCU Pin | Bus / Function | Role |
|---|---|---|---|
CLK | PA12 | SPI2_SCK | Shared SSI clock (8 MHz, SPI Mode 1) |
SDO | PA15 | SPI2_MISO | Shared serial data line |
SS1 | PA11 | GPIO Output | Chip select for Motor Shaft Encoder |
SS2 | PC15 | GPIO Output | Chip select for Servo Output Shaft Encoder |
3. Current & Voltage Telemetry
| Signal | MCU Pin | ADC Channel | Role |
|---|---|---|---|
CS_A | PA4 | ADC1_INP18 | Phase A low-side CSA output |
CS_B | PA5 | ADC1_INP19 | Phase B low-side CSA output |
CS_C | PA6 | ADC1_INP3 | Phase C low-side CSA output |
COMMON | PA0 | ADC1_INP0 | Phase virtual neutral point comparator |
PH_A | PA1 | ADC1_INP1 | Phase A voltage divider sense |
PH_B | PA2 | ADC1_INP14 | Phase B voltage divider sense |
PH_C | PA3 | ADC1_INP15 | Phase C voltage divider sense |
4. Host Bus, Debug & Status
| Signal | MCU Pin | Alternate Functions | Function |
|---|---|---|---|
SCL / TX | PB6 | I2C1_SCL / I3C1_SCL / USART1_TX | Host clock or Telemetry TX |
SDA / RX | PB7 | I2C1_SDA / I3C1_SDA / USART1_RX | Host data or Telemetry RX |
SWDIO | PA13 | SWDIO | SWD Debug Data |
SWCLK | PA14 | SWCLK | SWD Debug Clock |
SWO | PB3 | TRACESWO | Optional Trace Output |
LED_R | PC14 | GPIO Output | Red Status Indicator (Active High) |
LED_B | PB8 | GPIO Output | Blue Status Indicator (Active High) |
Mechanical Assembly




Encoder & Magnet Assembly

Miniata uses custom 3D-printable mechanical housings and fixtures located in mechanical/.
Kinematic Mapping
- Gear Reduction Ratio:
21.1538461 : 1() - Kinematic Sign:
Firmware & Control System
The canonical firmware for Miniata is hosted and maintained upstream in the BareFOC repository:
- Canonical Upstream Firmware:
bareFOC/examples/miniata_stm32h5 - Local Firmware Pointer: firmware-barefoc/
- Legacy SimpleFOC C++ Reference: firmware-simplefoc/
The Miniata repository is focused strictly on mechanical CAD models, PCB designs, schematics, fabrication files, and factory test scripts.
Cascaded Control Pipeline
flowchart TD
Cmd["Target Position (Host)"] --> PosPID["Outer Loop: Output Position PID"]
subgraph cascade ["Forward Control Pipeline"]
direction TB
PosPID -->|"theta_vel*"| VelLoop["Velocity and Accel Limiter"]
VelLoop -->|"i_q* (Torque)"| FOCLoop["SimpleFOC Commutation Loop"]
FOCLoop -->|"3x PWM"| Driver["TI DRV8311H Gate Driver"]
Driver -->|"Phase Drive"| Motor["1104 BLDC Motor"]
Motor -->|"21.15:1 Ratio"| Gearbox["Gearbox and Output Horn"]
end
subgraph feedback ["Dual Encoders"]
direction TB
Enc1["MT6701QT 1 (Motor Shaft)"]
Enc2["MT6701QT 2 (Output Shaft)"]
end
Motor -.-> Enc1
Gearbox -.-> Enc2
Enc1 -->|"theta_elec"| FOCLoop
Enc1 -->|"omega_mot"| VelLoop
Enc2 -->|"theta_out (True Pos)"| PosPID
- Inner Loop (FOC Commutation): Consumes angle feedback from the motor shaft encoder (Encoder 1) at high bandwidth (up to 20 kHz) to commutate the BLDC motor with field-oriented vector control.
- Intermediate Velocity Loop: Regulates rotor velocity based on Encoder 1 derivative.
- Outer Position Loop: Closes the loop using the output horn encoder (Encoder 2), ensuring precise positioning regardless of gearbox backlash or deflection.
Bootloader & Upload Guide
The board does not have a physical reset button. Firmware uploads and updates are performed through the Katapult bootloader (residing in Sector 0, 8 KB):
- Development Mode (UART):
- Host connects via 3.3V USB-to-UART adapter to
PB6(USART1_TX) andPB7(USART1_RX) at 250,000 baud. - Command:
python3 katapult/scripts/flashtool.py -d /dev/ttyUSB0 -b 250000 -f firmware.bin
- Host connects via 3.3V USB-to-UART adapter to
- Production Mode (I2C / I3C):
- Host connects via I2C master bus to
PB6(SCL) andPB7(SDA) at address0x30. - Command:
python3 katapult/scripts/flashtool.py --ch341 -a 0x30 -f firmware.bin
- Host connects via I2C master bus to
- In-Application Soft-Reset:
- Firmware disarms drivers, writes the signature
0x5984E3FA6CA1589BULLto0x20007FF8, and triggersNVIC_SystemReset(). On reboot, Katapult detects the signature and remains in bootloader mode.
- Firmware disarms drivers, writes the signature


This project's PCB and PCBA service was sponsored by the OSHWLab Spark campaign. Project was completed in November 2026.