Author Topic: BLDC Driver  (Read 5318 times)

0 Members and 3 Guests are viewing this topic.

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
BLDC Driver
« on: June 02, 2025, 08:16:09 am »
Attempting to design a BLDC motor driver. Attached is the first version of my schematic. Do not yet have the PCB laid out.

Considerations so far:
- Planning to include the AEAT9922 encoder directly on the PCB.
- ATSAME51 MCU (was considering the ATSAMD51, but I believe it lacks CAN).
- The DRV8316 gate driver comes in several flavors. The one I currently chose includes a buck converter capable of outputting 600mA at 3.3V. I am guessing this will be enough for the MCU and encoder. If I can get away with that, I will remove the external buck converter (currently U4). If I do need the external power supply, I will probably go for a version of the DRV8316 without the internal buck converter.
- CAN transceiver not yet included, will definitely be present to allow for 2 CAN ports (for daisy-chaining).
- Not sure I protected the USB connector from the main battery/power supply voltage properly.
- Do I need a cryptographic coprocessor? Some include it in similar projects, will explore benefits.
- Status LED  may be a good idea.
- Additional port/ports for hall sensors, motor thermistor, and possibly an external encoder. Should have enough IO.
- Very aware that I need to clean the schematic up, renumber components better, etc., but as this is a work in progress I was thinking of doing that later.

All critiques welcome.
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: ca
  • Non-expert
Re: BLDC Driver
« Reply #1 on: June 02, 2025, 11:47:19 pm »
- Only you would know if you need a crypographic coprocessor
- Power LED as well as status LED is always good.
- Probably never an issue but if Vbus were to be low it could cause issues (spec is down to 4.4V)
- I would still connect up M0 on the AEAT even if you aren't using it, just in case
- Vdda missing cap and not connected on AEAT
- You probably want more bulk capacitance on 24V, not sure what the limit is. You can add a TVS on here too if you want overvoltage protection.
- You are exceeding LM66100 pin voltage limit of 6V
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 
The following users thanked this post: anvoice

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5404
  • Country: nl
Re: BLDC Driver
« Reply #2 on: June 03, 2025, 01:24:05 pm »
DRV8316 looks quite nice. Cost around EUR 4 (single) or EUR 2 (3000+) also looks good.

It's the other side of integration than I expected. A while back I looked at STspin. It has all electronics (uC, SMPS, OPamps, FET drivers)in a single package, except the power FET's themselves for a motor controller.

Your schematic does not look that bad. I find it quite refreshing to see wires instead of labels everywhere.

3V3 @600mA is plenty to power the uC and other low voltage circuitry. (uC rarely needs >100mA). The integrated Buck is especially intended for such things.

But why design this from scratch? If it's for some commercial product I understand, maybe it's just for fun and having something to do or to get some expericence with KiCad. All valid reasons, but if you wand a handful of BLDC controllers for DIY, then it's probably a lot simpler to just start with one of the many available projects that are freely available, and maybe make some small changes to suit specific wishes.
« Last Edit: June 20, 2025, 10:32:21 pm by Doctorandus_P »
 
The following users thanked this post: anvoice

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #3 on: June 04, 2025, 12:42:46 am »
- Only you would know if you need a crypographic coprocessor
- Power LED as well as status LED is always good.
- Probably never an issue but if Vbus were to be low it could cause issues (spec is down to 4.4V)
- I would still connect up M0 on the AEAT even if you aren't using it, just in case
- Vdda missing cap and not connected on AEAT
- You probably want more bulk capacitance on 24V, not sure what the limit is. You can add a TVS on here too if you want overvoltage protection.
- You are exceeding LM66100 pin voltage limit of 6V

Thank you for the input. As far as cryptographic coprocessor goes, it wasn't so much a question as a general thought for myself to remember to explore further. On Odrive micro for example, it's connected to the SWD pin, which makes me think they're validating connections for firmware flashing or something, but I have not looked into this more.
The unconnected M0, VDDA, and VSSA are indeed an error.
I also forgot to add more capacitance between 24V and GND, will do that.
I didn't notice the maximum reverse voltage on the LM66100. Guess I'll need a different ideal diode since I need no less than 24V for the motor supply.

DRV8316 looks quite nice. Cost around EUR 4 (single) or EUR 2 (3000+) also looks good.

It's the other side of integration than I expected. A while back I looked at STspin. It has all electronics except the power FET's themselves for a motor controller.

Your schematic does not look that bad. I find it quite refreshing to see wires instead of labels everywhere.

3V3 @600mA is plenty to power the uC and other low voltage circuitry. (uC rarely needs >100mA). The integrated Buck is especially intended for such things.

But why design this from scratch? If it's for some commercial product I understand, maybe it's just for fun and having something to do or to get some expericence with KiCad. All valid reasons, but if you wand a handful of BLDC controllers for DIY, then it's probably a lot simpler to just start with one of the many available projects that are freely available, and maybe make some small changes to suit specific wishes.

I was worried about the wires as many projects prefer labels. Labels enforce a bit more discipline and order in my opinion, but wires keep things simpler. Also the way I designed the IC symbols allows me to visualize how they will be connected on the PCB better.

The reason for designing for scratch is mostly for fun, experience and a bit of cost-savings compared to commercial products. As far as commercial goes, the Odrive micro would likely do most of what I need (except its power is a bit low at 100W), but it's out of stock and in general expensive. Moteus is cheaper but I hear it isn't smooth at low speed. I have no idea how Odrive 3.6 "upgraded" clones on Aliexpress will behave. The open-source Sequoia project appears to be abandoned (last commits I found were 8 years ago).
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: ca
  • Non-expert
Re: BLDC Driver
« Reply #4 on: June 04, 2025, 12:49:54 am »
There are schematics for the MKS clones here, probably worth looking at: https://github.com/makerbase-motor/MKS-ODrive/tree/master/Hardware

Some mentions: https://ffbeast.github.io/docs/en/hardware_controller.html
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #5 on: June 04, 2025, 06:25:52 am »
There are schematics for the MKS clones here, probably worth looking at: https://github.com/makerbase-motor/MKS-ODrive/tree/master/Hardware

Some mentions: https://ffbeast.github.io/docs/en/hardware_controller.html

I'll look through those, much appreciated.

Also, it looks like CAN transceivers usually require 5V (and sometimes 3.3V too), so it looks like I'll be needing that external buck converter to 5V after all.
« Last Edit: June 04, 2025, 07:58:22 am by anvoice »
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #6 on: June 05, 2025, 02:02:12 am »
Big design flaw that I just noticed: because the DRV8316 provides power to the MCU, I won't be able to program the board unless battery is connected. I was thinking of being able to program and power the MCU by USB.

Therefore, question: how good an idea is it to replace the DRV8316 with an internal buck by one without, then have a switching regulator provide 5V, followed by another LDO regulator from 5V to 3.3V? USB VBUS will then connect through an ideal diode like LM66100 to the 5V rail. I currently see no other way to power the MCU from both USB and battery.


I just found out that you can get 3.3V CAN transceivers... So that's probably what I'll do. As far as the DRV8316 remaining off, that's also a non-issue apparently as it can operate from 4.5V to 30V, and thus will work with the USB power even without PD. Thus I just need to create an ideal diode that will protect USB from battery back-feed.
« Last Edit: June 05, 2025, 04:00:07 am by anvoice »
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #7 on: June 05, 2025, 05:27:56 am »
New schematic attached. I am hoping that the ideal diode will provide protection against back-feed into the USB connection when power is on. To that end, I currently have a 470kOhm/100kOhm ladder dividing the battery/power supply voltage, which cannot exceed 30V, down to about 5V and feeding it to the active low chip enable pin on the diode. The idea is that this will disable the diode if I have the battery plugged in. Any better way to do this?

Edit: wrong again, feeding 5V into DRV8316 buck... I'll get some sleep before tackling this again.
« Last Edit: June 05, 2025, 08:14:54 am by anvoice »
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: ca
  • Non-expert
Re: BLDC Driver
« Reply #8 on: June 05, 2025, 09:50:01 pm »
Yes more sleep needed

You have VBUS 5V going into 3.3V net, and where is 24V coming from
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #9 on: June 05, 2025, 10:04:02 pm »
Yes more sleep needed

You have VBUS 5V going into 3.3V net, and where is 24V coming from

Indeed.

I noticed that before falling asleep. Hopefully corrected in latest schematic (attached). 24V is coming from battery or external PSU, likely by XT30 connector which I have yet to show on the schematic.

I'm still not sure I've designed the measure against USB C and 24V connected at the same time properly. I currently have an ideal diode controller connected to a N-MOSFET, which should become disabled if I connect 24V. Question: could I just use a single PMOS transistor instead of the ideal diode controller and NMOS transistor? That would also mean I don't need the inverter, though it removes the overvoltage protection (possibly a non-issue since overvoltage will likely fry the whole board before it can transmit to the upstream USB device).
 
The following users thanked this post: thm_w

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: ca
  • Non-expert
Re: BLDC Driver
« Reply #10 on: June 05, 2025, 11:37:02 pm »
You can do PFET and diode: https://learn.adafruit.com/assets/120409

But not exactly as shown, as 24V will blow the gate on most FETs.
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #11 on: June 06, 2025, 12:00:04 am »
You can do PFET and diode: https://learn.adafruit.com/assets/120409

But not exactly as shown, as 24V will blow the gate on most FETs.

Right. I don't see a good way around the Vgs restriction, so the current setup appears superior (assuming it works).
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #12 on: June 19, 2025, 08:11:31 am »
Coming along somewhat. I am fighting for every mm of board space on the PCB so need a way to minimize components. The prime candidate appears to be the circuit designed to prevent backfeeding 24V to USB if I plug the battery in while USB is connected, as it uses essentially 3 components: an ideal diode controller, an NFET, and an inverter (because the ideal diode controller needs a low signal to shut off, whereas I have ~24V coming in from the psu/battery). All are large components and I'm not sure I can fit them all efficiently. Here's the current schematic, with CANBUS yet to be properly connected (PCB coming soon):
* bldcDriver.pdf (134.87 kB - downloaded 68 times.)
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #13 on: June 24, 2025, 10:36:36 pm »
Ok. this might seem very obvious, but is there a reason I cannot use a diode rated for a reverse voltage of, say, 30V, and with reasonably low forward voltage drop to feed power through usb and block backflow? The current method I am using seems gargantuan for now reason.
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: ca
  • Non-expert
Re: BLDC Driver
« Reply #14 on: June 24, 2025, 10:45:24 pm »
You can use diodes instead of FETs yes, but you'd need two diodes, one protects VBATT from going into VBUS, one protects VBUS from going into VBATT. If you don't care that VBUS might charge the battery then only one small diode would be needed.

If you have one on VBATT it would need to be rated at least whatever your motor current is (3A+?).
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 
The following users thanked this post: anvoice

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #15 on: June 24, 2025, 11:05:41 pm »
You can use diodes instead of FETs yes, but you'd need two diodes, one protects VBATT from going into VBUS, one protects VBUS from going into VBATT. If you don't care that VBUS might charge the battery then only one small diode would be needed.

If you have one on VBATT it would need to be rated at least whatever your motor current is (3A+?).

VBUS is essentially guaranteed to be below VBATT at all times (unless VBATT is not plugged in). Using any voltage significantly lower than VBATT would mean I can barely turn the buck converter on to power the MCU, and the motor is unlikely to spin much (at least the motors I have in mind). The only issue I would foresee is someone using a 1C lithium battery, but beyond that it is probably a non-issue.

Currently trying to find an appropriate part, but Digikey doesn't seem to let me use reverse voltage as search criteria...
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: ca
  • Non-expert
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #17 on: June 25, 2025, 01:44:35 am »
Yes, I think I clicked on the wrong category of diodes.

Found an appropriate part. I'm attaching the latest schematic. As usual, would appreciate any feedback.

In particular, I'm not yet sure how to properly wire the cryptographic coprocessor. Not very familiar with SWD, which is (probably?) what I may need to use for that.
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: ca
  • Non-expert
Re: BLDC Driver
« Reply #18 on: June 25, 2025, 08:26:32 pm »
I would probably use the I2C connection for ATECC608B. Maybe SWI can work but its going to make debugging absolute hell (you'd have to turn off debug to let MCU communicate with IC).

SWD you've wired correctly for debugging with the ATSAM on PA30 and PA31, usually you don't want anything else connected to those pins unless you are absolutely starved for IO.

I use a 4 pin connector for debug (Vcc, CLK, IO, Gnd), most people do 5 pin and add reset in as well. I would at least bring out that RESETN connection to a test point in case its needed.

Adafruit has a RC across it, not sure if that is required per datasheet or not: https://cdn-learn.adafruit.com/assets/assets/000/057/242/original/arduino_compatibles_schem.png?1531010817
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #19 on: June 25, 2025, 11:40:16 pm »
I would probably use the I2C connection for ATECC608B. Maybe SWI can work but its going to make debugging absolute hell (you'd have to turn off debug to let MCU communicate with IC).

SWD you've wired correctly for debugging with the ATSAM on PA30 and PA31, usually you don't want anything else connected to those pins unless you are absolutely starved for IO.

I use a 4 pin connector for debug (Vcc, CLK, IO, Gnd), most people do 5 pin and add reset in as well. I would at least bring out that RESETN connection to a test point in case its needed.

Adafruit has a RC across it, not sure if that is required per datasheet or not: https://cdn-learn.adafruit.com/assets/assets/000/057/242/original/arduino_compatibles_schem.png?1531010817

Thanks for the feedback!

I changed the ATECC608B connection to I2C on one of the SERCOM pads on the ATSAME51.

How important is that reset signal? I'm attempting to wrestle the last several millimetres needed for the fifth connection from the PCB and it's not going well. Also, I'm assuming you mean a resistor and capacitor across reset? All I see in the schematic you posted is a pushbutton, but maybe I'm looking in the wrong place.

Another question: both the ASTAM and the buck converter on the DRV8316 call for a 22uH inductor after the logic power output. I'm guessing that's a shared inductor in this case? That is, I don't need two 22uH inductors in series? I currently have L4 going into the VDDANA pin on the MCU but if it's just one inductor that will go. Attached is the schematic, hopefully close to the final version. I might need to add some resistive ladders for the encoder and hall sensors though, researching that now.

Edit: how good/bad an idea would it be to put the 48MHz oscillator on the opposite side from the MCU (connect by via) but very close to it? I'm struggling for space.
« Last Edit: June 26, 2025, 04:17:17 am by anvoice »
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #20 on: June 26, 2025, 06:11:56 am »
Most ICs require 100nF capacitors close to the logic voltage pins. Does anyone know if it's ok to put these on the other side of the board (essentially right under the pin in question)? Does it depend on the via's electrical characteristics? I am having trouble fitting some of these on the same side as the chip.
 

Offline thm_w

  • Super Contributor
  • ***
  • Posts: 9935
  • Country: ca
  • Non-expert
Re: BLDC Driver
« Reply #21 on: June 27, 2025, 12:57:16 am »
Will be fine on the other side of the board for standard stuff like logic ICs and MCUs.
You can calculate the via inductance, and trace length inductance, if you want some numbers for comparison.

https://www.allaboutcircuits.com/technical-articles/different-via-configurations-for-connecting-decoupling-capacitors/
https://learnemc.com/estimating-connection-inductance
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 
The following users thanked this post: anvoice

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #22 on: June 27, 2025, 10:17:26 am »
Interesting, good to know that it works.

I ended up reconnecting a lot of pins, and unfortunately there's way too many labels everywhere. I'll try to bring back the wires and post an updated version.

In the meantime, the PCB is nearly finished (DRC errors aside). I'm attaching the front and back png files for anyone who is curious. I don't think it's fair to ask anyone to sift through the actual Kicad PCB version. The board is currently still 32mm to a side, with 3mm diameter holes spaced on a square 28mm to a side.
 

Offline anvoiceTopic starter

  • Frequent Contributor
  • **
  • Posts: 320
  • Country: us
Re: BLDC Driver
« Reply #23 on: June 29, 2025, 05:06:18 am »
After fighting the DRC rules for a while, looks like I have a near-final version of the PCB. I've also updated the schematic and cleaned it up a little: unfortunately the wires I initially had instead of labels became unsustainable as signals became tangled to accommodate appropriate connections. The only way around that is currently to mix and match the pins on the symbol out of order. I don't know if that becomes more or less readable in that sense.

The PCB and updated schematic are attached. One major dilemma is whether to use a 4 or 6 layer PCB. One fab lets you get a 6-layer prototype for cheap, but I assume the price for the next batch will be very high and at that point I'll be dependent on it (probably why they offer the discount in the first place). Assuming I go the 6-layer route, I was thinking of having internal power GND and VCC (VBATT) planes, as well signal GND and 3.3V. Would need to figure out how to make sure KiCAD connects the proper vias to GND or power GND, which probably means using 2 different nets for the two, with a single small connection somewhere. If I stick with 4-layer, it'll have to be a split power/signal ground plane with a narrow bridge connecting them, as well as a split 24V/3.3V plane.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->