Motor Controller for a Robot Arm

Created 2 project docs

Firmware Starter — STM32G431CBT6

View Document

MCU: STM32G431CBT6 Framework: STM32 HAL

Board Bring-Up Plan — Closed-Loop DC Motor Controller

View Document

Equipment: current-limited bench supply, DMM, oscilloscope, ST-LINK/SWD debugger, USB-UART adapter, encoder simulator or known encoder, dumm...
Implemented and verified the schematic for the closed-loop brushed DC motor controller.
What was completed:
  • Added a robust 12 V nominal motor-controller architecture: MC33926 H-bridge, STM32G431 MCU, INA240 current sense, LMR33630 3.3 V buck, LM74700 reverse protection, encoder conditioning, connectors, LEDs, and protection.
  • Wired power, motor drive, current sensing, encoder A/B/Z, SWD, UART control, reset/BOOT0, and fault/status paths.
  • Ran schematic/ERC checks; there are no open ERROR/WARNING/UNCERTAIN checks in the reviewed schematic categories.
Project files created/updated:
Open items:
  • Layout is not started yet; high-current motor paths, shunt Kelvin routing, buck layout, and thermal copper will be critical.
  • Firmware starter is a HAL bring-up baseline; final PID/current-limit tuning still needs motor characterization.
Suggested next steps:
  1. Set PCB constraints: board size, stackup, current-aware trace widths, and clearance rules.
  2. Place components with power path and thermal priorities.
  3. Route the PCB, then run DRC/PI checks.
  4. Add test points for 3V3, VM_PROT, HBRIDGE_EN, current sense, and encoder signals.
Set constraints and layout
Set PCB constraints
Place components
Route the PCB
Add test points
Review BOM risks

Refine this doc
Ask about this doc
Project Specification
Project Overview
Status: Draft schematic capture in progress.
A robust closed-loop brushed DC motor controller for small robotics, driving one bidirectional motor up to 2 A continuous with encoder feedback, MCU control, current monitoring, debug access, status indication, and practical input/output protection.
Intended Use
  • Small mobile robot / actuator controller prototype or production-intent module.
  • External DC motor supply, nominal 12 V, with support for common robotics supply variation.
  • Closed-loop speed and position control implemented in MCU firmware.
What the Device Should Do
  • Drive one brushed DC motor forward/reverse with PWM.
  • Read quadrature encoder A/B and optional index channel.
  • Measure motor current for telemetry and firmware overcurrent protection.
  • Report motor-driver and power-good faults to the MCU.
  • Provide SWD programming/debug, UART/control header, and status LEDs.
Main Features
  • Integrated H-bridge: NXP MC33926PNB, 5 V to 28 V motor supply class, 5 A peak-capable, PWM-compatible, current limit, short-circuit and thermal latch-off protection.
  • MCU: STM32G431CBT6, 170 MHz Cortex-M4F control-oriented MCU with encoder-capable timers, PWM timers, ADC, USART, FDCAN-capable pins, and SWD.
  • Current measurement: INA240A1D PWM-rejection current-sense amplifier across an inline 10 mΩ motor shunt, biased at midscale for bidirectional current.
  • Encoder conditioning: SN74LVC3G17 triple Schmitt buffer, 3.3 V powered with 5.5 V tolerant inputs; per-channel pull-up/filter/series protection and ESD array.
  • Power: 12 V nominal input with fuse/PTC, TVS, ideal-diode reverse-polarity MOSFET stage, and 3.3 V synchronous buck.
System Architecture

Diagram


12 V DC Input Input Fuse/PTC Input TVS LM74700 + N-MOS Reverse Protection Protected Motor Supply MC33926 H-Bridge Inline 10 mOhm Shunt Motor Connector INA240 Current Sense MCU ADC LMR33630 3.3 V Buck 3.3 V Logic STM32G431 Encoder Connector GPIO ESD RC + Pull-ups SN74LVC3G17 Schmitt Buffer Status LEDs SWD Header UART/Control Header
Hardware Subsystems
  • Power input/protection: 2-pin 5 mm terminal block, 3 A+ protection path, SMBJ33CA input TVS, LM74700 ideal-diode controller and 60 V low-RDS(on) N-MOSFET.
  • Logic rail: LMR33630-Q1 buck configured for 3.3 V using datasheet 400 kHz component values.
  • Motor drive: MC33926 with datasheet charge-pump capacitor, bulk VPWR capacitance, status/fault pull-up, slew-rate control, disable control, and motor-output TVS.
  • Current sensing: INA240A1, 10 mΩ shunt, 3.3 V midscale reference, ADC output filter, Kelvin-routed shunt requirement for layout.
  • Encoder input: 6-pin encoder connector carrying 3.3 V, GND, A, B, index, and optional shield/aux; Schmitt buffering protects MCU timing from cable noise.
  • MCU/debug/control: STM32G431 SWD, reset, BOOT0 pull-down, UART/control header, status LEDs.
Interfaces and Connections
  • J1: DC power input, nominal 12 V, expected operating design range 6 V to 24 V within motor-driver/regulator limits.
  • J2: Motor output, bidirectional H-bridge output, 2 A continuous target.
  • J3: Encoder input: 3.3 V, GND, ENC_A, ENC_B, ENC_Z, AUX/SHIELD.
  • J4: SWD programming/debug: 3.3 V reference, SWDIO, SWCLK, NRST, GND, optional SWO.
  • J5: Control UART/GPIO: 3.3 V, GND, UART_TX, UART_RX.
Power and Runtime Expectations
  • External powered; no battery charger or runtime target on this board.
  • Motor current dominates input current. Logic rail load is expected under 250 mA peak.
  • Buck regulator selected instead of LDO to avoid thermal dissipation from 12 V input.
Power Tree and Power Budget

Table


RailLoadTypicalPeak / Design
VMOTOR protectedBrushed DC motorapplication-dependent2 A continuous, driver handles higher transient/current-limit region
VMOTOR protected3.3 V buck reflected input~40 mA at 12 V~100 mA at 12 V for logic peak margin
3.3 VSTM32G43130-100 mA150 mA budget
3.3 VINA240 + logic buffer + LEDs + pull-ups10-30 mA80 mA budget
3.3 V totalLogic rail~150 mA250 mA design budget
Input protection path target: at least 2 A continuous motor current plus logic overhead; fuse/PTC selected near 3 A hold/nominal class and input/motor terminal blocks rated 15 A.
Manufacturing and Assembly Expectations
  • SMD production-ready design with through-hole terminal/header connectors where mechanically useful.
  • Layout must use heavy copper pours/traces for VMOTOR, H-bridge, shunt, and motor output.
  • Thermal pad / exposed pad soldering and copper area are required for the MC33926 and power parts.
  • Kelvin routing required for INA240 shunt inputs.
Firmware-Relevant Hardware Requirements
  • Configure PWM outputs to MC33926 IN1/IN2 or disable-PWM strategy.
  • Use encoder-capable timer channels for quadrature A/B.
  • ADC samples INA240 current output and optional MC33926 FB output.
  • Monitor motor-driver SF fault and buck PG.
  • Fault handling must disable bridge on overcurrent, SF assertion, undervoltage/power-good loss, or firmware watchdog failure.
Physical Design Expectations
  • Keep motor/power loop compact.
  • Keep encoder/control connectors away from H-bridge switching nodes and motor terminals.
  • Place input TVS/fuse/reverse protection near the power connector.
  • Place current shunt inline with motor output and route INA240 Kelvin traces symmetrically.
Important Design Decisions
  • 12 V nominal supply selected as a common robotics voltage; selected ICs support wider operating ranges.
  • Integrated H-bridge chosen over discrete H-bridge for safer fault handling and faster schematic completion.
  • INA240 added for accurate bidirectional PWM current sensing; MC33926 FB kept as an auxiliary coarse current/fault-observability signal.
  • Schmitt-buffered encoder input chosen for cable/noise robustness and 5 V tolerant conditioning.
Assumptions
  • Encoder outputs are open-drain/open-collector or push-pull logic compatible with 3.3 V pull-ups / 5.5 V tolerant buffer inputs.
  • Motor continuous current is 2 A; stall current can exceed this but is handled as a transient by driver current limiting and firmware shutdown.
  • The control host can use 3.3 V UART-level signals.
Change Notes
  • Initial specification created from the user’s request and datasheet-backed component selection.
  • Project Overview

  • Intended Use

  • What the Device Should Do

  • Main Features

  • System Architecture

  • Hardware Subsystems

  • Interfaces and Connections

  • Power and Runtime Expectations

  • Power Tree and Power Budget

  • Manufacturing and Assembly Expectations

  • Firmware-Relevant Hardware Requirements

  • Physical Design Expectations

  • Important Design Decisions

  • Assumptions

  • Change Notes

Closed-Loop DC Motor Controller

Closed-Loop DC Motor Controller thumbnail
Robotics-ready closed-loop brushed DC motor controller with bidirectional 2 A H-bridge drive, quadrature encoder feedback, current sensing, protection, MCU control, debug access, and status indicators.

Properties

Properties describe core aspects of the project.

Pricing & Availability

Distributor

Qty 1

Arrow

$13.69–$22.87

Digi-Key

$18.16

HQonline

$3.75

LCSC

$17.95–$18.00

Mouser

$28.86

TME

$8.93

Verical

$11.17–$25.75

Controls