
SUMMARY
DURATION
Oct 2026 - Present
ACCUMALTOR INDICATOR LIGHT
ACCUMALTOR INDICATOR LIGHT
BLDC FOC MOTOR CONTROLLER
Designing a custom 3-phase BLDC inverter with FOC for a 6S LiPo-powered Ballbot
ROLE
Personal project
IN-PROGRESS
Schematics being designed



ENGINEERING JOURNAL
Last Updated: Nov 30 2026
Monday 11/30/2026:
Swapped all my 100nF 0603s to 0402
Swapped all my 1uF 0603s with 25V to 50V
Added I2C pull-ups. 4.7k assuming I am running at standard 100kHz. Need 2.2k for 400kHz
Added TVS across input for regen spikes
Added ADC RC filters for shunts. Need to double check values later
Need to add motor phase outputs
Need to add DRV8320S SDO pin pull-ups
Do I need to add screw terminal for input and/or output?
Could downsize all resistors with low power requirements to 0402
Sunday 11/29/2026:
Added nRST button, SWD connector
Added solder jumpers such that on-board encoder can isolated if I choose to use an encoder integrated in the motor in the future
Added headers for SPI, UART, I2C, CAN
Added Amass XT30PW-M header
Need to add I2C pull-ups and find a TVS for XT30 input
Saturday 11/28/2026:
For bat voltage reading, nominal bat voltage is 25.2V but spikes from regen braking might make it rise to 40V so assume max 40V for divider into G4 ADC
Added temp reading via an NTC and indicator LEDs
Reverse polarity PMOS not worth due to size and only really matters for bat plug-in and an XT30/60 is keyed assuming soldered connector on bat is correct polarity
Friday 11/27/2026:
Added bypass/bulk caps for G4, encoder block
NOTE: Add test points and learn proper practice after board is done
PMOS for reverse polarity protection must have a power rating of Rds(on) hot for largest current draw
I'll design for 20A peak and 10A continuous
Added temp reading, also have to add bat reading
Tuesday 11/24/2026:
Ended up doing pmos-pmos architecture for ideal diode since a Schottky will add output voltage drop.
Did CAN, USB-C blocks
Tuesday 11/24/2026:
Added a bunch of circuitry over weekend
The GL60 KV25 provides very little torque. Less than a cheap servo. So I will likely have to make my own gear box, probably a planetary, and just choose a motor with smaller torque, I can probably get something cheaper too, just adds more to the project.
I need some sort of power path management so when I have USB plugged in, I can power the LV electronics. The reason its nice to have USB power without a bat is for debugging firmware without needing a bat. I wouldn't be driving the motor but just powering the LV electronics for debugging and uploading code.
So I'll need to implement some sort of scheme. I think a power mux is unnecessary and limits my current and voltage input and frankly boring while diode ORing wastes too much power when the USB is unplugged and you see a constant voltage drop on the buck output so I will go with an ideal diode controller. Looking at the LTC4412 with a shottky in the USB bus path since I don't care about power loss when I have USB plugged in and having mosfet on buck output acting as the ideal diode when USB diode is important for increasing battery life
Wednesday 11/18/2026:
Going to use the STM32G431CBT6 since the 64-pin package is a waste with so many unused pins so will have to order from LCSC Electronics
I'll use the DRV8320S since I can use the internal G4 amplifiers, I want to set registers to be set with SPI and I would prefer an external buck chip
I will also use my own AS5047P-ATSM since motor will be cheaper without coming with an encoder and worse case I buy it motor with it down the line
Implemented crystal. Used placeholder 12pF load caps with an approx. stray capacitance but I should re-calc after I do layout
Started making bridge. Selected for small gate charge and Rds(on). Selected placeholder 10R gate resistors but should re-calc after layout.
Selected placeholder shunt but should look at more closely based of ADC res
Saturday 11/14/2026:
I can actually use a STM32G431RBT cuz the TIM1 channel 1 has alternative mappings
For motor I will go with a GL60 KV25: https://www.cubemars.com/product/gl60-kv25-gimbal-motor.html
The GL60 has a KV25 and KV55 config. The motor geometry doesn’t change between them but their coil winding config changes such that the KV25 has
For testing if there is not enough time for ballbot, I'll use: https://www.amazon.ca/dp/B0G2LPC1C7/ref=twister_B0G2S3JT2M?_encoding=UTF8&th=1
Monday 10/26/2026:
It's either I use MA704GQ-P with 10-bit resolution at about $8 a piece or the AS5047P at $15.8 a piece but with 14 bit res. I will need more resolution if I use a gear box, so I should select my motors before board design.
Should check LCSC Electronics site to see if I can find components I want in-stock or to find cheaper versions
Need to check what the lowest pulse width G4 ADC can sample based of its sample time. If I likely going to run at that PWM, then need to use external shunt amplifiers
Got ams AS5047P-ATSM off LCSC
Can't use STM32G431 32-pin because not enough flash and enough pins to use USB and CAN
Can't use STM32G431 48-pin because doesn’t have pins for all TIM1 channels
Can't use STM32G431 64-pin because pin for TIM1 channel conflicts with PF0. This is for the whole series so
I need an external crystal if I want CAN communication for more precise timing
Maybe STM32G473RCT6, looks like for TIM1 even for G4x3 a TIM1 channel is also used for PF0, so will have to use a TIM8 or TIM20. Need to also check how ADCs use TIMs
Sunday 10/25/2026:
Assume 6SLipo setup
Cells shouldn’t operate below 3.3V, so cell pack will be 19.8V - 25V
Design decision:
DRV8320H: Hardware config
DRV8320S: SPI
DRV8320RS: SPI, Buck Regulator
DRV8323S: SPI, Shunt Amplifying
DRV8323RS: SPI, Buck Regulator, Shunt Amplifying
For determining whether to use DRV8320 or DRV8323, need to calculate what I will select as my Rsense. Smaller Rsense will have less power loss but will require amplification for Vsense.
I will likely use DRV8323 to have smaller shunts
Will use SPI, likely not regulator since capped at 600mA so external buck would be more robust
No DRV8323s are in-stock but there are DRV8320S in-stock so I'll use external amplifiers, INA18, for each shunt. If my G4 chip has internal amplifiers, I could use those, called PGA mode.
Actually G431 has 3 internal op-amps so no need for external amplifiers
Monday 08/24/2026:
Orbots mechanical design will be a 2D gimbal on a shaft with 2 BLDC motors
How do I determine how big I want it to be? Does it depend on speed? Higher mass higher accel? What about electronics size
