PCB Project

Miniata

Summary

Mini BLDC Servo compatible with SimpleFOC

Created
25th Jun, 2026
Updated
26th Nov, 2026
License
CERN-OHL-S-2.0
Source
GitHub OSHWLab

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 (275/13275 / 13).
  • Host Communication: Configurable interface on PB6 / PB7 supporting I2C / I3C target mode (production, address 0x30) 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.

PCB Annotated

Hardware Specifications

Core Specifications

SpecificationValueNotes
MicrocontrollerSTM32H503KBU6Arm Cortex-M33 @ 250 MHz, 128 KB Flash, 32 KB SRAM
Motor DriverTI DRV8311HRRWR3x PWM Hardware Mode, 5 A peak, integrated CSAs
Supply Voltage5.0 V nominal4.5 V to 5.5 V operating range
Motor Type1104 4300KV BLDC12N14P configuration (7 pole pairs)
Position Sensors2 × MagnTek MT6701QT14-bit (16,384 cpr) absolute magnetic encoders
Gear Reduction21.1538461 : 1 (275 / 13)Kinematic sign: θout=−θmot21.1538+offset\theta_{\text{out}} = -\frac{\theta_{\text{mot}}}{21.1538} + \text{offset}
Host BusI2C / I3C / USART1Shared pins PB6 / PB7
Programming & DebugSWD & Katapult BootloaderSWDIO (PA13), SWCLK (PA14), SWO (PB3)
Feedback IndicatorsRed & Blue LEDsPC14 (Red), PB8 (Blue)

Implementation Notes

  • DRV8311H Straps: The hardware variant DRV8311HRRWR is configured in 3x PWM Mode (MODE pin floating / Hi-Z). In 3x PWM Mode, INH_x drives the phase outputs, and INL_x operates as active-high bridge enable (EN_x). GAIN configures current-sense gain, and SLEW sets output slew rate.
  • nFAULT Line 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 ≤1 A\le 1\text{ A} total (stationary voltage_limit ≤0.4 V–0.5 V\le 0.4\text{ V}\text{--}0.5\text{ V}). Sustained motion above 20 rad/s is not feasible under USB power.
    • External 5V Battery: Stationary voltage_limit ≤0.8 V–1.0 V\le 0.8\text{ V}\text{--}1.0\text{ V} (≈1.6 A–2.0 A\approx 1.6\text{ A}\text{--}2.0\text{ A}, safely below driver overcurrent protection). As rotor velocity increases, voltage rises toward 5.0 V as back-EMF opposes supply voltage: Vceiling≈1.0+∣ωrotor∣/450V_{\text{ceiling}} \approx 1.0 + |\omega_{\text{rotor}}| / 450.
  • Current-Sense Outputs: CSA outputs on PA4, PA5, and PA6 are 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 (CLK on PA12, SDO on PA15). When chip-select is de-asserted, the MT6701 acts as an I2C slave on the same pins. Clocking SSI at ≥8 MHz\ge 8\text{ MHz} 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)

SignalMCU PinPeripheralDescription
INH_APB5TIM1_CH3 (AF1)Phase A PWM High Input
INL_APB1GPIO OutputPhase A Half-Bridge Enable (EN_A, active HIGH)
INH_BPA9TIM1_CH2 (AF1)Phase B PWM High Input
INL_BPB0GPIO OutputPhase B Half-Bridge Enable (EN_B, active HIGH)
INH_CPA8TIM1_CH1 (AF1)Phase C PWM High Input
INL_CPA7GPIO OutputPhase C Half-Bridge Enable (EN_C, active HIGH)
SLEEPPB15GPIO OutputGlobal Driver Sleep (nSLEEP, HIGH = active)

2. Dual Magnetic Encoders (Shared SSI Bus)

SignalMCU PinBus / FunctionRole
CLKPA12SPI2_SCKShared SSI clock (8 MHz, SPI Mode 1)
SDOPA15SPI2_MISOShared serial data line
SS1PA11GPIO OutputChip select for Motor Shaft Encoder
SS2PC15GPIO OutputChip select for Servo Output Shaft Encoder

3. Current & Voltage Telemetry

SignalMCU PinADC ChannelRole
CS_APA4ADC1_INP18Phase A low-side CSA output
CS_BPA5ADC1_INP19Phase B low-side CSA output
CS_CPA6ADC1_INP3Phase C low-side CSA output
COMMONPA0ADC1_INP0Phase virtual neutral point comparator
PH_APA1ADC1_INP1Phase A voltage divider sense
PH_BPA2ADC1_INP14Phase B voltage divider sense
PH_CPA3ADC1_INP15Phase C voltage divider sense

4. Host Bus, Debug & Status

SignalMCU PinAlternate FunctionsFunction
SCL / TXPB6I2C1_SCL / I3C1_SCL / USART1_TXHost clock or Telemetry TX
SDA / RXPB7I2C1_SDA / I3C1_SDA / USART1_RXHost data or Telemetry RX
SWDIOPA13SWDIOSWD Debug Data
SWCLKPA14SWCLKSWD Debug Clock
SWOPB3TRACESWOOptional Trace Output
LED_RPC14GPIO OutputRed Status Indicator (Active High)
LED_BPB8GPIO OutputBlue Status Indicator (Active High)

Mechanical Assembly

Encoder & Magnet Assembly

Sensor Magnet

Miniata uses custom 3D-printable mechanical housings and fixtures located in mechanical/.

Kinematic Mapping

  • Gear Reduction Ratio: 21.1538461 : 1 (27513:1\frac{275}{13} : 1)
  • Kinematic Sign: θout=−θmot21.1538461+offset\theta_{\text{out}} = -\frac{\theta_{\text{mot}}}{21.1538461} + \text{offset}

Firmware & Control System

The canonical firmware for Miniata is hosted and maintained upstream in the BareFOC repository:

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):

  1. Development Mode (UART):
    • Host connects via 3.3V USB-to-UART adapter to PB6 (USART1_TX) and PB7 (USART1_RX) at 250,000 baud.
    • Command:
      python3 katapult/scripts/flashtool.py -d /dev/ttyUSB0 -b 250000 -f firmware.bin
      
  2. Production Mode (I2C / I3C):
    • Host connects via I2C master bus to PB6 (SCL) and PB7 (SDA) at address 0x30.
    • Command:
      python3 katapult/scripts/flashtool.py --ch341 -a 0x30 -f firmware.bin
      
  3. In-Application Soft-Reset:
    • Firmware disarms drivers, writes the signature 0x5984E3FA6CA1589BULL to 0x20007FF8, and triggers NVIC_SystemReset(). On reboot, Katapult detects the signature and remains in bootloader mode.

EasyEDA Spark

Spark PCB Boards

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