Skip to the content
4 layers64 × 86 mmMaster circuit, the printed circuit board in 3D

FOC driver for a single BLDC motor.

Size
64 × 86 mm
Copper layers
4
Thickness
1.67 mm
Parts
238
Nets
283
Pads
1,185
Tracks, vias
3,460, 370
Pours
4
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
24 Jun 2024
Updated
5 Nov 2026

Overview

Master circuit is an open-source printed circuit board by csiz, from the csiz/hex-single-motor-mini-drive repository on GitHub, published under the MIT licence. It is a 4-layer board of 64 × 86 mm with 238 parts on 283 nets, routed with 3,460 tracks and 370 vias.

Its parts include 100 resistors, 63 capacitors, 30 ICs, 14 transistors and 13 diodes. It belongs with the robots and motor control boards of this library.

README

readme.md

Hex Mini FOC driver

Brushless motor driver for mini gear motors and servos. This driver focuses on fine force control using field oriented control (FOC). The motor can be commanded to move to track position, velocity, and/or force. The driver will maintain the current wave exactly 90 degrees out of phase to the EMF wave for maximum efficieny. Position is tracked via hall sensors, EMF feedback and I2C rotary sensors.

Electrical ranges:

  • Maximum motor voltage: 28V
  • Maximum current: 5A
  • Minimum motor voltage: 6V
  • Nominal I2C voltage: 3.3V

This project has 4 main components, for details look at the readme.md files in each directory:

  • A brushless motor simulator and motor principles explainer; under motor-sim.
  • The driver PCB schematic and manufacturing files; under circuits.
  • Custom driver firmware with Kalman filter position tracking and FOC driving logic; under driver-code.
  • Driver control and monitoring webapp; also under motor-sim, the page titled motor-monitor.md.
  • The interface spec and autogenerated serialization code under interface; because of this we must use the npm update --install-links command when updating dependencies for motor-sim. (TODO: this section needs updating to include the master circuit and master code and versioning and media and circuit libraries layout)

Screenshots

Motor monitor should look like this when connected to a motor: motor monitor screenshot

The motor sim, with GPU rendered soundwaves should look like this: motor sim screenshot

Circuit Dev Log

Lessons learnt for driver code v0.4

[ ] VREF must be independent of the reference to the amplifier; and actually well insulated. The v0.2 and v0.3 are too noisy because of this I suspect. [ ] Let's go back to USB with 5V and separate VCC power connector! Also allows us to drop the on-board buck converter and save space. Bonus for easy to control from a computer/phone with any USB cable.

Tasks for v0.3

[v] Maybe switch to a oscillation damping gate resistor of 3ohm. The AO4266E switching parameter uses Rgen = 3ohm, I think this is their recommended gate resistance. Switched to 4.7ohm, closest basic resistor.

[v] Aaaargh!!! BOOT0 pin needs a pulldown resistor on the STM32G4! [x] VREF+ should be tied to VDDA... VREF+ now has the capacitance required and drives the amplifier refrence too.

[v] Think about connectors better. We should either drop or double down on USB-C. It would be very user friendly and the power delivery allows us to pick the 9-24V we need, but might be cumbersombe to control 24 devices. The SPI bus with slim connectors let's us keep it tight and in-house. Would we want a cheap single-sided board with USB-C and also a compact double sided assembly without USB at all. ... Let's go for double sided compact without USB, with the better stm32g4 with 5 opamps (so we can also ditch the opamp). [v] USB-C footprint was correct with the cutouts. What we have now is incorrect!

[v] Need master circuit. [v] Need flexi rotation I2C sensors. [v] Via diameter was too small, should be at least 0.2/0.45

Need to implement in v0.2

Features of current version: [v] Measure power line voltage. [x] Re-pick voltage boost capacitor and resistor pair (using P FETS). [v] Re-pick gate oscillation damping resistor for the inputs to the power MOSFET. [v] Crystal oscilator and pick matching caps. [v] Power regulator. [v] USB-C connector maybe? [v] Debugging connection with the trace line. [v] 4 half bridge outputs [v] 4 voltage inputs for the 4 outputs [v] 1 voltage input for VCC [v] 2 (preferably 4) current inputs from the 4 outputs; I chose 4. [x] maybe 1 current input for total current. It would leave us with a floating ground which is iffy. [v] SPI connection to main board. Not I2C, it's too slow and consumes too much current. SPI will need a chip select pin, but allows for parallel devices. SPI has hardware CRC calculation, seems useful. [v] Spare I2C connection for the magnetic sensors. [v] Status LED.

Lessons from previous version: [x] Measure gate turn on characteristics of existing circuit... [x] Maybe switch to a oscillation damping gate resistor of 3ohm. The AO4266E switching parameter uses Rgen = 3ohm, I think this is their recommended gate resistance. [x] Definitely need to think about daisy chaining these, maybe use a signal buffer/transciever with an enable pin, and/or mosfet switch for the chip power on. I2C to master board is probably the best and easiest way. [v] Oopsies I flipped the sign of the V phase current measurement lines. [x] The boost gate should maybe be connected to the driver side of the shunt resistor. At the moment we're measuring current used to charge the high gate. [x] There's a summing option for the current measurments. Try outputing U, V, U+V, U+V+W using the 4th spare output. [v] ! Think carefully about the shunt resistor placement, there's big interference going on if we measure during high side. Timing it around ground as common mode voltage seems to fix it. Is that the only way to measure all current going through the motor coils? [v] ! Measure voltage of the motor coils! [x] There's a conflict between i2c and timer 3 channel 2. Choose a different GPIO for the red LED. I2C1 and TIM3_CH2 remapped Description When the following conditions are met: • I2C1 and TIM3 are clocked. • I/O port pin PB5 is configured as an alternate function output there is a conflict between the TIM3_CH2 signal and the I2C1 SMBA signal (even if SMBA is not used). In these cases the I/O port pin PB5 is set to 1 by default if the I/O alternate function output is selected and I2C1 is clocked. TIM3_CH2 cannot be used in output mode. Workaround To avoid this conflict, TIM3_CH2 can only be used in input mode.

[x] Double sided board. Not just yet. [x] Drop voltage regulator and rely on master board for 3.3V; filter it though. We just needed to look for better components, there are cheap and small options that work well for us. [x] Look for thinner IDC connector, and definitely SMD version for easier routing, use of space behind connector. [v] Add voltage probes for the phase connectors so we can measure voltage both during driving and open connections. We need to measure driving voltage to make sure our MOSFETS are turned on and giving us the voltage we command! [v] Use Kelvin sense resistors (or pad hack) for the current measurement to avoid the unknown solder resistance. https://www.analog.com/media/en/analog-dialogue/volume-46/number-2/articles/optimize-high-current-sensing-accuracy.pdf [v] Don't drop the hall sensors, yet! [v] The big problem with our measurements occurs when we switch from continuous 0 output from the low mosfet to mixed output with the high mosfet. Any amount of mixed output seems to add an offset to our current measurement. Might be worth putting the current sense only on the low mosfet branch. [x] Choose a different mosfet driver to lower the minimum voltage under 5V. The undervoltage protection must be there for a reason. Anyway, we chose 6V and up. [v] Make it work with steppers... Neat!

Parts

238
QtyValueFootprintReferences
3810kΩLibrary:R0603R11, R12, R14, R15, R17, R18, R21, R22, R24, R25, R26, R27, R29, R30, R102, R109 +22
281uFLibrary:C0603C1, C12, C15, C18, C20, C25, C26, C27, C28, C29, C33, C35, C40, C51, C52, C53 +12
23100nFLibrary:C0603C2, C4, C5, C13, C16, C22, C30, C31, C34, C38, C39, C42, C43, C44, C45, C60 +7
121MΩLibrary:R0402R96, R97, R98, R99, R100, R101, R103, R104, R105, R106, R107, R108
1256kΩLibrary:R0603R13, R28, R46, R59, R65, R71, R76, R85, R86, R87, R88, R89
12~Library:WDFN-5_L3.1-W3.1-P0.65-BL_1Q8, Q12, Q14, Q16, Q18, Q20, Q21, Q22, Q23, Q24, Q25, Q26
10~Library:SOT-23-3_L3.0-W1.7-P0.95-LS2.9-BRD1, D2, D4, D5, D6, D7, D8, D9, D10, D11
9~Library:SOIC-8_L4.9-W3.9-P1.27-LS6.0-BLU17, U41, U43, U44, U45, U46, U47, U48, U49
75mΩLibrary:R2512 Shunt with Kelvin connectionsR1, R2, R3, R4, R5, R6, R7
7~Library:USB-C-SMD_TYPE-C16PINUSB0, USB1, USB2, USB3, USB4, USB5, USB6
6100kΩLibrary:R0402R79, R80, R82, R83, R84, R91
620kΩLibrary:R0402R35, R55, R61, R66, R67, R70
64.7ΩLibrary:R0603R77, R81, R90, R92, R93, R94
6~Library:FPC-SMD_20P-P0.50_XUNPU_FPC-05F-20PH20FPC1, FPC2, FPC3, FPC4, FPC5, FPC6
6~Library:SOT-23-6_L2.9-W1.6-P0.95-LS2.8-BRU7, U23, U26, U28, U30, U32
3100kΩLibrary:R0603R45, R48, R56
310uFLibrary:C1206C17, C21, C32
322uFLibrary:C0805C3, C23, C24
21.5kΩLibrary:R0603R23, R39
215pFLibrary:C0402C64, C69
21nFLibrary:C0603C10, C11
2~Library:TSSOP-20_L6.5-W4.4-P0.65-LS6.4-BLU11, U16
2~Library:TSSOP-16_L5.0-W4.4-P0.65-LS6.4-BLU14, U15
2~Library:SOD-123_L2.7-W1.6-LS3.7-RD-1D12, D14
2~Library:SW-SMD_4P-L5.1-W5.1-P3.70-LS6.5-TL_H1.5SW1, SW2
2~Library:TSSOP-24_L7.8-W4.4-P0.65-LS6.4-BLU9, U13
2~Library:SOT-23-3_L2.9-W1.3-P1.90-LS2.4-BRQ9, Q10
1100pFLibrary:C0603C6
110nFLibrary:C0603C9
110uHLibrary:L0805L2
1120ΩLibrary:R0603R16
112kΩLibrary:R0603R50
113kΩLibrary:R0603R62
115uHLibrary:IND-SMD_L4.0-W4.0L1
11kΩLibrary:R0603R68
11mΩLibrary:R2725 Shunt with Kelvin connectionsR8
120kΩLibrary:R0603R40
124MHzLibrary:CRYSTAL-SMD_4P-L3.2-W2.5-BLX2
147kΩLibrary:R0603R41
149.9ΩLibrary:R0603R10
1~Library:WIRELM-SMD_ESP32-S3-WROOM-1U1
1~Library:ESSOP-10_L4.9-W3.9-P1.0-LS6.0-TL-EPU42
1~Library:CONN-TH_S8B-PH-K-S-LF-SNU19
1~Library:MSP2807 OLED with touchescreen and SD cardU35
1~Library:LED0603-RDLED1
1~Library:SOT-23-5_L3.0-W1.6-P0.95-LS2.8-BLU3
1~Library:LGA-16_L3.0-W3.0-P0.50-TLU18
1~Library:QFN-64_L9.0-W9.0-P0.50-BL-EP4.8U24
1~Library:QFN-28_L5.0-W5.0-P0.50-TL-EP3.3U10
1~Library:SOT-23-6_L2.9-W1.6-P0.95-LS2.8-BLU4

More from csiz/hex-single-motor-mini-drive

10
  • 4 layers120 × 70 mmMaster circuit, the printed circuit board in 3D

    Master circuit

    csiz/hex-single-motor-mini-drive

    FOC driver for a single BLDC motor.

    174 parts9MIT
  • 4 layers29 × 51 mmHex minidrive, the printed circuit board in 3D

    Hex minidrive

    csiz/hex-single-motor-mini-drive

    FOC driver for a single BLDC motor.

    97 parts9MIT
  • 4 layers18 × 48 mmHex minidrive, the printed circuit board in 3D

    Hex minidrive

    csiz/hex-single-motor-mini-drive

    FOC driver for a single BLDC motor.

    81 parts9MIT
  • 2 layers160 × 70 mmExtender cable circuit, the printed circuit board in 3D

    Extender cable circuit

    csiz/hex-single-motor-mini-drive

    FOC driver for a single BLDC motor.

    80 parts9MIT
  • 4 layers18 × 46 mmHex minidrive, the printed circuit board in 3D

    Hex minidrive

    csiz/hex-single-motor-mini-drive

    FOC driver for a single BLDC motor.

    78 parts9MIT
  • 4 layers18 × 50 mmHex mini drive, the printed circuit board in 3D

    Hex mini drive

    csiz/hex-single-motor-mini-drive

    FOC driver for a single BLDC motor.

    65 parts9MIT
  • 2 layers70 × 70 mmSensor circuit, the printed circuit board in 3D

    Sensor circuit

    csiz/hex-single-motor-mini-drive

    FOC driver for a single BLDC motor.

    54 parts9MIT
  • 4 layersPlug block, the printed circuit board in 3D

    Plug block

    csiz/hex-single-motor-mini-drive

    FOC driver for a single BLDC motor.

    18 parts9MIT
  • 2 layers6 × 10.5 mmFpc and usb plug, the printed circuit board in 3D

    Fpc and usb plug

    csiz/hex-single-motor-mini-drive

    FOC driver for a single BLDC motor.

    7 parts9MIT
  • 4 layersBack to back mosfets, the printed circuit board in 3D

    Back to back mosfets

    csiz/hex-single-motor-mini-drive

    FOC driver for a single BLDC motor.

    6 parts9MIT

Similar boards

  • 4 layers99 × 99 mmPrntrBoardV1, the printed circuit board in 3D

    PrntrBoardV1

    ghent360/PrntrBoard

    3D Printer controller board using STM32 NUCLEO-F446 kit TMC2130/2660/2209 drivers

    238 parts24
  • 4 layers130 × 105 mmVm101-inout, the printed circuit board in 3D

    Vm101-inout

    mirdej/vmix

    Multichannel modular analog PAL video mixer based on the SYNKIE project

    238 parts21
  • 4 layers70 × 92.8 mmFE 8CH, the printed circuit board in 3D

    FE 8CH

    osqzss/PocketSDR

    The Pocket SDR FE device includes 2, 4, or 8 RF frontend channels, supporting the GNSS L1 band (1525 - 1610 MHz) or L2/L5/L6 bands (1160 - 1290 MHz). For these signal bands, refer to GNSS Signal Bands.

    238 parts17
  • 4 layersLed panel 4x5, the printed circuit board in 3D

    Led panel 4x5

    Draganito/kicad-mcp

    Mini MCP server that drives a running KiCad 10 PCB editor from Cursor over the official IPC API. LCSC/EasyEDA footprints for JLCPCB.

    238 parts1AGPL-3.0
  • 4 layers220 × 160 mmV4 drone, the printed circuit board in 3D

    V4 drone

    Jailtonfonseca/drone-4in1-esc-esp32s3

    Projeto de uma única PCB que concentra: 4 inversores trifásicos (ESC), gate drivers, sensoriamento de corrente, MCU com WiFi (ESP32-S3), IMU, barômetro, USB e toda a regulação de energia a partir de pack LiPo 6S (25,2 V…

    238 parts1MIT
  • 4 layers86.4 × 68.6 mmCapstone, the printed circuit board in 3D

    Capstone

    camerondm9/ece4600capstone

    Code for our capstone project

    238 parts
  • 4 layersRound LED Flash, the printed circuit board in 3D

    Round LED Flash

    xmyoot/custom-round-pcb-led-flash

    Custom circular ring PCB LED flash controller prototype

    237 parts
  • 4 layers90 × 100 mm8ch v3, the printed circuit board in 3D

    8ch v3

    saewoonam/8ch_currentsource_jlc_v3

    V3 of 8 channel current source for biasing superconducting circuits

    237 parts

Questions

How big is the Master circuit PCB?

It measures 64 × 86 mm and has 4 copper layers, 1.67 mm thick.

What parts does the Master circuit use?

238 parts. 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 Master circuit KiCad files?

From the csiz/hex-single-motor-mini-drive repository on GitHub, at the commit this page was made from: the board is master-circuit-v0.2/master-circuit.kicad_pcb and its schematic circuits-v0.1/hex-mini-drive.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Master circuit 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).