

Plug block
FOC driver for a single BLDC motor.
- Copper layers
- 4
- Thickness
- 1.67 mm
- Parts
- 18
- Nets
- 24
- Pads
- 93
- Tracks, vias
- 175, 12
- Routed
- Yes
- KiCad
- KiCad 10.0 (file 20260206)
- Created
- 24 Jun 2024
- Updated
- 5 Nov 2026
Overview
Plug block 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 with 18 parts on 24 nets, routed with 175 tracks and 12 vias.
Its parts include 8 resistors, 3 capacitors, 2 ICs, 2 transistors and 1 diode. It belongs with the robots and motor control boards of this library.
README
readme.mdHex 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 titledmotor-monitor.md. - The interface spec and autogenerated serialization code under
interface; because of this we must use thenpm update --install-linkscommand when updating dependencies formotor-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: 
The motor sim, with GPU rendered soundwaves should look like this: 
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
18| Qty | Value | Footprint | References |
|---|---|---|---|
| 3 | 1uF | Library:C0603 | C40, C80, C81 |
| 2 | 1MΩ | Library:R0402 | R101, R108 |
| 2 | 56kΩ | Library:R0603 | R71, R89 |
| 2 | ~ | Library:WDFN-5_L3.1-W3.1-P0.65-BL_1 | Q19, Q20 |
| 1 | 100kΩ | Library:R0402 | R91 |
| 1 | 10kΩ | Library:R0603 | R75 |
| 1 | 20kΩ | Library:R0402 | R70 |
| 1 | 5mΩ | Library:R2512 Shunt with Kelvin connections | R6 |
| 1 | ~ | Library:SOT-23-6_L2.9-W1.6-P0.95-LS2.8-BR | U32 |
| 1 | ~ | Library:SOT-23-3_L3.0-W1.7-P0.95-LS2.9-BR | D11 |
| 1 | ~ | Library:WLCSP-6_L1.2-W0.8-P0.40-TL | U31 |
| 1 | ~ | Library:USB-C-SMD_TYPE-C16PIN | USB6 |
| 1 | ~ | Library:FPC-SMD_20P-P0.50_XUNPU_FPC-05F-20PH20 | FPC6 |
More from csiz/hex-single-motor-mini-drive
10- 4 layers64 × 86 mm

- 4 layers120 × 70 mm

- 4 layers29 × 51 mm

- 4 layers18 × 48 mm

- 2 layers160 × 70 mm

Extender cable circuit
csiz/hex-single-motor-mini-drive
FOC driver for a single BLDC motor.
80 parts9MIT - 4 layers18 × 46 mm

- 4 layers18 × 50 mm

- 2 layers70 × 70 mm

- 2 layers6 × 10.5 mm

- 4 layers

Similar boards
- 4 layers55 × 72 mm

DB9 Differential Signal Selector
nanographs/Open-Beam-Interface
Just what you need to control the beam and get an image.
18 parts371 - 4 layers18.6 × 34.4 mm

- 4 layers42.4 × 40.8 mm

- 4 layers97.8 × 22.2 mm

- 4 layers100 × 60 mm

Picocart64 v1
khill25/Dreamdrive
Open source Retro Rom Carts and ODEs by Dreamcraft Industries
18 parts26 - 4 layers76 × 31 mm

Vm006-mixbus
mirdej/vmix
Multichannel modular analog PAL video mixer based on the SYNKIE project
18 parts21 - 4 layers23.3 × 10.7 mm

- 4 layers85 × 56 mm

Probe shield
probe-rs/hive
A Raspberry PI shield for testing probe-rs against many chips & probes.
18 parts15
Questions
What parts does the Plug block use?
18 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 Plug block KiCad files?
From the csiz/hex-single-motor-mini-drive repository on GitHub, at the commit this page was made from: the board is symbols-and-footprints/Library.kicad_blocks/plug-block.kicad_block/plug-block.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 Plug block 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).