Skip to the content
4 layers92.1 × 62.8 mmMotor controller, the printed circuit board in 3D

CAN-connected closed-loop DC motor controller node — KiCad hardware (STM32F103, DRV8874, SN65HVD230) with an AS5600 encoder sub-PCB

Size
92.1 × 62.8 mm
Copper layers
4
Thickness
1.6 mm
Parts
55
Nets
61
Pads
212
Tracks, vias
392, 82
Pours
23
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
11 Sep 2026
Updated
11 Sep 2026

Overview

Motor controller is an open-source printed circuit board by mohamed-belal-10, from the mohamed-belal-10/can-motor-controller-node repository on GitHub, published under the MIT licence. It is a 4-layer board of 92.1 × 62.8 mm with 55 parts on 61 nets, routed with 392 tracks and 82 vias.

It is built around the SN65HVD230D, LM2596S-5.0 and AMS1117-3.3, with the SS34, SMDRI127-680MT and TAXM8M4RLBDDT2T among its other parts. Its parts include 18 capacitors, 9 resistors, 7 connectors, 5 ICs and 5 diodes. It belongs with the robots and motor control and interfaces and adapters boards and the STM32 boards of this library.

Main components

7

README

README.md

CAN-Connected Closed-Loop DC Motor Controller Node

A single PCB "smart joint" for robot arms, rovers, or any multi-actuator robotic system: it bolts onto a DC gearmotor, closes a cascaded current → speed → position control loop locally on an STM32, and takes setpoints over a shared CAN bus instead of running dedicated wires back to a central controller. Multiple nodes share one twisted-pair CAN bus, each addressed independently.

A portfolio project by Mohamed Belal ("Belo") — Mechatronics Engineering, GUC.


Why this project

  • First board with a real power stage. Current in the amps range, not the milliamps of a typical digital-signal board — Kelvin sensing considerations, thermal copper, and return-path separation under switching noise.
  • Introduces CAN bus as a communication protocol, end to end: transceiver hardware, bxCAN peripheral configuration, bit-timing, and a companion USB-CAN adapter to test it from a laptop.
  • Introduces cascaded multi-loop control (current → speed → position), the conceptual step up from a single-loop PID.
  • Built from and cross-checked against two open reference designs: CVRA's motor-control-board (KiCad, CC-BY) and Cormack's STM32L433 motor driver.

System overview

text
                    ┌──────────────┐      ┌──────────────┐
   12V IN  ────────▶│ LM2596S-5V   │─5V──▶│ AMS1117-3.3  │────▶ 3.3V rail
   (motor            │ buck (switch)│      │ LDO (linear) │      │
    supply)          └──────────────┘      └──────────────┘      │
        │                                                          │
        │ (direct, unregulated)                                    │
        ▼                                                          ▼
   ┌──────────┐    PWM x2      ┌──────────┐   IPROPI    ┌─────────────┐
   │ DRV8874  │◀───────────────│ STM32F103│◀────────────│ (internal to │
   │ H-bridge │                │  C8T6    │             │  DRV8874)    │
   └────┬─────┘                └────┬─────┘             └─────────────┘
        │ motor terminals            │  I²C
        ▼                            ▼
   ┌──────────┐                ┌──────────┐        ┌──────────────┐
   │ DC MOTOR │────coupled────▶│  AS5600  │        │ SN65HVD230   │◀──▶ CAN H/L
   │          │  (shaft end)   │ (angle)  │        │ (transceiver)│    to bus
   └──────────┘                └──────────┘        └──────────────┘

Two boards are designed here:

BoardRoleLocation
motor_controllerMain node — MCU, power stage, H-bridge, CAN interfacehardware/motor_controller/
AS5600_Encoder_NodeSmall sub-PCB carrying the bare AS5600 angle sensor, linked to the main board over a 4-pin JST-SH cablehardware/AS5600_Encoder_Node/

The AS5600 lives on its own tiny PCB — not a generic breakout module — specifically so the main board's own calculated I²C pull-up resistors are the only pull-ups on the bus (most off-the-shelf breakout modules bundle their own, which would silently change the bus's effective pull-up value).


Gallery

Main board — motor_controller

PCB layout (KiCad, top copper + silkscreen)

motor_controller PCB layout

3D render

motor_controller 3D render

Sub-board — AS5600_Encoder_Node

PCB layout

AS5600_Encoder_Node PCB layout

3D render

AS5600_Encoder_Node 3D render

Repository structure

text
.
├── README.md
├── LICENSE
├── docs/                                       Design documentation
│   ├── CAN_Motor_Controller_Node_Spec.md           Full BOM, design decisions, CAN protocol, pin map
│   └── CAN_Motor_Controller_Node_PCB_Layout_Guidelines.md   Placement, routing, plane strategy, DRC targets
└── hardware/
    ├── motor_controller/                       Main CAN motor controller node
    │   ├── motor_controller.kicad_pro/.kicad_sch/.kicad_pcb/.kicad_prl
    │   ├── PCB_design.png                          PCB layout screenshot
    │   ├── hardware_design.png                     3D render
    │   └── manufacturing/
    │       ├── gerbers/                            Gerber + drill files
    │       └── motor_controller-gerbers.zip         Fab-ready zip (JLCPCB format)
    └── AS5600_Encoder_Node/                    AS5600 magnetic encoder sub-PCB
        ├── AS5600_Encoder_Node.kicad_pro/.kicad_sch/.kicad_pcb/.kicad_prl
        ├── PCB_design.png                          PCB layout screenshot
        ├── hardware_design.png                     3D render
        └── manufacturing/
            ├── gerbers/
            └── AS5600_Encoder_Node-gerbers.zip

All KiCad projects are KiCad 8+ format.


Main board — motor_controller

Core components

SubsystemPartNotes
MCUSTM32F103C8T6 (LQFP-48)72 MHz, bxCAN, runs all 3 PID loops + CAN stack
Clock8 MHz HSE crystal, C_L = 20 pFRequired for reliable 500 kbps CAN bit timing (HSI is too loose)
Motor driverDRV8874 (HTSSOP-16, PowerPAD)Integrated current sense (IPROPI) and cycle-by-cycle current chopping — no external shunt/amplifier needed
Power stageLM2596S-5V (buck) → AMS1117-3.3 (LDO)Two-stage: switching for efficiency, then linear to give the current-sense ADC a clean reference
CAN transceiverSN65HVD230 (SOIC-8)3.3V-only, high-speed mode, NUP2105L TVS array for bus ESD protection
EncoderAS5600 (on its own sub-PCB)12-bit absolute angle over I²C — see below
ActuatorJGA25-370, 12V, 133 RPM, 20 kg·cmBrushed DC gearmotor, 1:78 gearbox

Electrical specs

  • Motor supply: 12 V nominal (6–18 V DRV8874 range)
  • Current limit: 2.0 A hardware trip (I_TRIP, VREF divider-set), cycle-by-cycle chopping
  • PWM switching frequency: 20 kHz (H-bridge), 150 kHz (buck)
  • Stackup: 4-layer — L1 signal, L2 solid GND, L3 split power (VM/3.3V), L4 signal
  • CAN bus: 500 kbps, standard 11-bit IDs, JST-XH 3-pos daisy-chain connectors (IN/OUT), jumper-selectable 120 Ω termination

CAN protocol

FrameDirectionIDPayload
Commandhost → node0x100 + node_idfloat32 setpoint, uint8 mode (0=position, 1=speed, 2=current)
Telemetrynode → host0x200 + node_idfloat32 position, uint16 current (mA), uint8 fault flags

node_id is assigned in firmware at flash time — no address jumpers on the board.

Design status

  • ✅ All five schematic sheets complete (Power Stage, MCU Core, Motor Drive, CAN Bus, Sensing), ERC clean.
  • ✅ Every component value and part number closed, across four audit passes (full history in docs/CAN_Motor_Controller_Node_Spec.md).
  • ✅ Layout complete; gerbers generated (see manufacturing/).
  • ⚠️ Flagged, unresolved: DRV8874 power-up sequencing (VCC vs. VM order) not verified against the datasheet.
  • ⚠️ Open before re-ordering: cross-check the main board's AS5600 link connector pin order against the sub-PCB's J1/J7 connector — both footprints were placed independently.
  • 🚚 Externally sourced, not yet in hand: DRV8874 (not stocked locally — ordered internationally), diametrically-magnetized magnet (must confirm magnetization type with seller before buying).

Sub-board — AS5600_Encoder_Node

A minimal breakout for the bare AS5600 magnetic rotary position sensor (SOP-8), designed specifically to avoid the double-pull-up problem that off-the-shelf AS5600 modules introduce.

ItemDetail
SensorAS5600 (SOP-8), 12-bit absolute angle over I²C
Power wiringVDD5V and VDD3V3 tied together, fed from the main board's 3.3V rail (required for correct 3.3V single-supply operation per datasheet)
Decoupling100 nF + 10 µF in parallel across the tied VDD node → GND (matches datasheet Fig. 13, 3.3V-mode)
Direction select3-pad solder jumper (DIR: GND = CW-increasing, VDD = CCW-increasing) — bridged at assembly time once motor orientation is known
Link to main boardJST-SH, 1.0 mm pitch, 4-position — carries +3V3, SCL, SDA, GND
MountingGlued flat to the motor's rear shaft-stub end face, read through a 1.0–1.5 mm air gap by a 6 mm diametric NdFeB magnet
Encoder resolution4096 counts/rev at the motor shaft → 319,488 counts/rev at the JGA25-370's output shaft (through its 1:78 gearbox)

The AS5600 mounting bracket (clamp-style, sized to the motor's 25 mm body OD) is specified mechanically in docs/CAN_Motor_Controller_Node_Spec.md but deliberately not finalized until the physical sub-PCB and motor are in hand to confirm dimensions.


Documentation

DocumentCovers
docs/CAN_Motor_Controller_Node_Spec.mdFull BOM with sourcing/pricing notes, design-decision rationale, CAN protocol definition, STM32 pin assignment tracker, CAN-adapter companion tool, AS5600 mounting bracket spec
docs/CAN_Motor_Controller_Node_PCB_Layout_Guidelines.mdTrace sizing, via strategy, floorplan, placement rules, ground/power plane strategy, CAN routing, thermal, DRC targets, pre-routing checklist

Build sequence

  1. Schematic capture (CAN node + power stage + DRV8874 + AS5600) — done
  2. ERC clean — done
  3. Layout — done
  4. DRC clean, JLCPCB stackup check, order
  5. Bring-up: power rails → CAN enumeration → AS5600 sanity read → close current loop → speed loop → position loop
  6. Bring up the companion CAN-USB adapter and drive the node from a laptop with real command/telemetry frames

Full detail on each step, including the CAN-USB adapter's own BOM, wiring, and firmware plan, is in docs/CAN_Motor_Controller_Node_Spec.md.


Fabrication

Both boards are designed for JLCPCB (4-layer main board, 2-layer sub-PCB). Ready-to-upload gerber/drill packages are checked in under each board's manufacturing/ folder. Re-export from KiCad's Plot dialog after any layout change rather than editing the checked-in gerbers by hand.

Reference designs

  • CVRA motor-control-board — KiCad, CC-BY, near-identical spec; source for the CAN daisy-chain connector and termination-jumper approach.
  • Cormack's STM32L433 motor driver — single-board layout reasoning, undervoltage-lockout-as-safety-feature technique.

License

MIT — see LICENSE.

This repository contains PCB hardware design files (KiCad schematics, layouts, and manufacturing outputs) alongside documentation. The MIT License is applied for simplicity and consistency with the author's other portfolio repositories; no warranty is made or implied about the fitness of any hardware design herein for use with live mains, high-current, or safety-critical applications. Build and operate at your own risk.

Parts

55
QtyValueFootprintReferences
8100nFCapacitor_SMD:C_0603_1608MetricC7, C8, C9, C10, C12, C13, C16, C18
4TestPointTestPoint:TestPoint_Pad_D1.5mmTP1, TP2, TP3, TP4
210kResistor_SMD:R_0603_1608MetricR1, R3
220pFCapacitor_SMD:C_0603_1608MetricC5, C6
2220uFCapacitor_THT:CP_Radial_D8.0mm_P3.50mmC2, C15
24.7kResistor_SMD:R_0603_1608MetricR8, R9
2MountingHoleMountingHole:MountingHole_3.2mm_M3_Pad_ViaH1, H2
2SS34Diode_SMD:D_SMAD1, D2
10.1uFCapacitor_SMD:C_0603_1608MetricC14
110uFCapacitor_THT:CP_Radial_D8.0mm_P3.50mmC3
1120Resistor_SMD:R_0603_1608MetricR7
11kResistor_SMD:R_0603_1608MetricR2
12.2KResistor_SMD:R_0603_1608MetricR_IPROPI1
120kResistor_SMD:R_0603_1608MetricR6
122nFCapacitor_SMD:C_0603_1608MetricC17
122uFCapacitor_THT:CP_Radial_D8.0mm_P3.50mmC4
13.3kResistor_SMD:R_0603_1608MetricR4
14.7uFCapacitor_SMD:C_0603_1608MetricC11
1470uFCapacitor_THT:CP_Radial_D8.0mm_P3.50mmC1
15.1kResistor_SMD:R_0603_1608MetricR5
168uHexternal_footprint:IND-SMD_L12.3-W12.3_SMDRI127L1
18MHz3225-SMDexternal_footprint:CRYSTAL-SMD_4P-L3.2-W2.5-BLY1
1AMS1117-3.3Package_TO_SOT_SMD:SOT-223-3_TabPin2U2
1BridgeConnector_JST:JST_XH_S3B-XH-A_1x03_P2.50mm_HorizontalJ2
1DRV8874PWPRexternal_footprint:HTSSOP-16_L5.0-W4.4-P0.65-LS6.4-BL-EPU4
1D_TVSDiode_SMD:D_SMAD5
1ENConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ4
1ExternalConnector_JST:JST_XH_S3B-XH-A_1x03_P2.50mm_HorizontalJ5
1FerriteBeadInductor_SMD:L_0805_2012MetricFB1
1J_MotorTerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ8
1LEDLED_SMD:LED_0805_2012MetricD3
1LM2596S-5Package_TO_SOT_SMD:TO-263-5_TabPin3U1
1NUP2105LPackage_TO_SOT_SMD:SOT-23D4
1SN65HVD230Package_SO:SOIC-8_3.9x4.9mm_P1.27mmU5
1ST-link_connectorConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_HorizontalJ3
1STM32F103C8TxPackage_QFP:LQFP-48_7x7mm_P0.5mmU3
1SW_PushButton_Switch_SMD:SW_SPST_PTS645Sx43SMTR92SW1
1Screw_Terminal_01x02TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ1
1Sub_PCBConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_HorizontalJ6

More from mohamed-belal-10/can-motor-controller-node

1
  • 2 layers28 × 31 mmAS5600 Encoder Node, the printed circuit board in 3D

    AS5600 Encoder Node

    mohamed-belal-10/can-motor-controller-node

    CAN-connected closed-loop DC motor controller node — KiCad hardware (STM32F103, DRV8874, SN65HVD230) with an AS5600 encoder sub-PCB

    9 partsMIT

Similar boards

  • 2 layers95 × 82 mmOrc, the printed circuit board in 3D

    Orc

    aramder/orc

    Open replacement controller board for surplus Motorola PMUN1046A relay boxes: ESP32-C3, CANopen control, 10 x 15 A channels. Independent project, not affiliated with Motorola Solutions.

    85 parts
  • 2 layers150 × 130 mmSTM32-Automotive BCM Development Board, the printed circuit board in 3D

    STM32-Automotive BCM Development Board

    Akinlatauto19/STM32-Automotive-BCM-Development-Board

    Automotive Body Control Module (BCM) development board designed around an STM32 microcontroller, featuring relay-based automotive outputs, power management, protection circuitry, and a custom KiCad PCB.

    89 partsCERN-OHL-S-2.0
  • 2 layers139.9 × 85.8 mmPas hw, the printed circuit board in 3D

    Pas hw

    NGOQUOC98/ESP32_MODBUS_PCB_MASTER

    This project was in development phase - we will remove this remark after release

    198 parts1
  • 4 layers70 × 157.5 mmController Tv Lift, the printed circuit board in 3D

    Controller Tv Lift

    vyrubaev/TV-Lift-Controller

    TVLift Controller is an intelligent controller for TV lift and lower mechanisms, based on the ESP32 microcontroller.

    103 parts
  • 4 layers159 × 130 mmRC11, the printed circuit board in 3D

    RC11

    AgOpenGPS-Official/Rate_Control

    106 parts20GPL-3.0
  • 2 layers172.7 × 91.4 mmNanoSprayLinear, the printed circuit board in 3D

    NanoSprayLinear

    lansalot/AOG_Dev

    Like AgOpenGPS but not. This version is constantly under development.

    90 partsGPL-3.0
  • 2 layers100 × 80 mmMeganecan gw, the printed circuit board in 3D

    Meganecan gw

    Barbedx/MeganeCAN

    ESP32-based CAN-bus companion for Renault Megane 2 infotainment displays.

    68 parts3

Questions

How big is the Motor controller PCB?

It measures 92.1 × 62.8 mm and has 4 copper layers, 1.6 mm thick.

What parts does the Motor controller use?

55 parts, built around the SN65HVD230D, LM2596S-5.0, AMS1117-3.3 and SS34. 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.

Where can I download the Motor controller KiCad files?

From the mohamed-belal-10/can-motor-controller-node repository on GitHub, at the commit this page was made from: the board is hardware/motor_controller/motor_controller.kicad_pcb and its schematic hardware/AS5600_Encoder_Node/AS5600_Encoder_Node.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Motor controller design in my own project?

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