Hardware suggestion: STM32 based mini FOC-controller

Hi all,

I’m looking for a small controller using a STM32 µC (ideally G4xx), current sensing (as simple as possible) and cacapble up to 4A@12V max. and 1 or better 2 UARTs.

Could be a ready-made hardware or a pcb-design to be ordered from some manufacturer (like jlcpcb or other).

Thank you for any hints!
Wilhelm

1 Like

I’m working towards something that is close to this right now!
But for now: what is wrong with the B-G431B-ESC1? I think this meets your specs, except for needing two UARTs.

And if one of the UART is intended for communicating with the computer, SEGGER RTT can be used instead.

That’s good news!!! Do you have some more details about your design?

Nothing special, I own onw and the B-G431B-ESC1 is good to experiment with.

Yes, but in the end I need the two UARTs for communication with some other µC.

It will be an upgrade to my earlier board, lemon pepper stepper, but only supporting up to 24V, but with increased current up to 4 or 5A, and supporting USB-PD up to 100W.

I’ve got a board design using STM32G431CBU6 and the DRV8316, 6-25V(due to capacitors used) and 8A peak, probably able to do 5A continuous with cooling and 3A without, has lowside current sensing, choice of 1x uart or i2c for comms, and motor sensor port supporting sin/cos encoder or incremental encoder. Comes with 2.54mm screw terminals for power input, SWD debug port and BLDC connection, and JST GH for i2c/uart and the sensor port. Size is 24x40mm and height is 13mm.

Although I didn’t design it this way, the sensor port is able to support a second UART, but then you lose the ability to use a sensor and have to run open loop which is really bad for performance.

The board supports SimpleFOC but I find that the performance with SimpleFOC is not good enough for my use case, so I wrote my own firmware for sinusoidal control. The main loop, current sense, position sense and PWM runs at 50KHz. The board currently drives a Robomaster M2006 P36 motor at 75K ERPM.

I’m thinking about selling ready made boards soon after I finish the firmware development to do FOC. I can probably sell you a sample if you’re interested, or I can provide you with the files for assembly at JLCPCB. Let me know if this meets your requirements.

Do you have any github for the project?

No, unfortunately no github for this yet, since my custom software is not ready. But I make available the schematic and PCB on easyeda here: EasyEDA(Standard) - A Simple and Powerful Electronic Circuit Design Tool

2 Likes

Nice, this looks close to something I’d like to use in a little robot project. It’s a shame the DRV8316 doesn’t seem to be stocked at JLPCB? If it was stocked it looks like the driver board be ~£40pc in low quantities.

If there is enough interest in my board design I can get it manufactured and sell it at $30 USD a piece plus shipping. The cheapest way to assemble it at JLCPCB would be to use the consign parts function to get the DRV8316 directly from TI to JLCPCB for assembly, but you can also use global sourcing parts if you pay a bit more. You can also assemble it yourself if you buy the stencil, some solder paste and have a reflow oven suitable for double sided assembly.

The board layout linked is an 8 layer board, but for mass production it will be a four layer instead to save cost. The only reason the prototype is 8 layers is because JLCPCB has a special offer which makes 6 layer and 8 layer the cheapest option for leadfree boards, and my university has equipment to assemble them.

I’ve also managed to get my own FOC implementation working by using the block diagram in the simplefoc docs as a guide, and I am now able to hit 130K ERPM on the motor.

1 Like

I’d take two at $30/pc if you do manage to get that together.