# limiting the current when driving a BLDC motor

#### Flawake

Joined Aug 25, 2023
4
Some background information:
I am a newbie to hardware design I got a project with my classmate to design and make a turntable.
The teacher already got us a brushless motor we need to use with a maximum power of 52W:
Motor: https://www.reichelt.com/de/en/brushless-dc-motor-24-v-52-w-16-5-ncm-act-57bl03-p271493.html
Datasheet: https://cdn-reichelt.de/documents/datenblatt/C300/57BL03-1.pdf

As part of the project we are making a FOC and we chose the DRV8318 to drive the motor
We're planning to drive the motor with 24V as suggested, so we want to supply it with a maximum of 2A since that 24x2 = 48 and that is less than the maximum power

But this is the problem:

How can I limit the current to the motor to 1A, 1.5A and 2A (choice of user by reading a button).
There is a comparator output available to see if the motor current is too high, but I have no clue how I can make a current limiting circuit with different current levels.

#### Alec_t

Joined Sep 17, 2013
14,005
Welcome to AAC!
There is a comparator output available to see if the motor current is too high
What comparator? What provides its current-sensing and reference inputs?
What is the output in response to currents of 1A, 1.5A and 2A?

#### Flawake

Joined Aug 25, 2023
4
Thanks for showing interest and asking for clarification

The comparator is inside of the DRV8313. It has as inputs COMPP and COMPN. It gives a output on the nCOMPO if the current is too high when connected as shown on page 18.

We will get more torque when we have higher currents at the outputs, and the teacher wanted the user to be able to set the torque with buttons.

Last edited:

#### Alec_t

Joined Sep 17, 2013
14,005
The 100mΩ resistor in Fig 15 of the datasheet is the current-sense resistor, connected in the common ground line to the motor coils, so generates a voltage at COMPP proportional to coil current. Using the buttons, you need to provide three reference voltages for COMPN to compare with that, then use the comparator output at nCOMPO to enable/disable the driving of the coils.

#### BobTPH

Joined Jun 5, 2013
8,075
Do you know what that chip is actually doing? It is not a complete motor driver. It is merely the power stages for driving the 3 coils in your motor. You need to provide the signals that create the waveforms by applying overlapping PWM signals to the different coils. The comparator is used to measure the current by using a sense resistor in the ground line. You need to program a microcontroller of your choice to drive the motor. The duty cycle of the PWM signals is how you control the current.

#### Flawake

Joined Aug 25, 2023
4
@BobTPH, yes I know that it is just a chip with 3 half H-bridges. We're planning to generate the PWM signal with the Atmega328p-AU, programming it with the Arduino IDE and uploading using a AVR-ISP programmer.
I think that there is a problem with the duty cycle trick. Because when the PWM signal is HIGH(5V) the motor will just take 24V / 0.8 = 30A, so the chip will get into overcurrent state (p.13) and disconnect the gate from the motor so that the motor is basicly always off, or am I wrong?

#### Flawake

Joined Aug 25, 2023
4
@Alec_t I can just stop driving the coils when there is too much current. But the turning needs to be really smooth and I don't see how that would limit the current to the motor. Because the problem of too much current nearly immediately returns after energizing a coil again.

#### BobTPH

Joined Jun 5, 2013
8,075
@Alec_t I can just stop driving the coils when there is too much current. But the turning needs to be really smooth and I don't see how that would limit the current to the motor. Because the problem of too much current nearly immediately returns after energizing a coil again.
No. The motor is an inductor. Go back to your textbook and learn what happens when you put a voltage across an inductor.

#### nsaspook

Joined Aug 27, 2009
12,266
@BobTPH, yes I know that it is just a chip with 3 half H-bridges. We're planning to generate the PWM signal with the Atmega328p-AU, programming it with the Arduino IDE and uploading using a AVR-ISP programmer.
I think that there is a problem with the duty cycle trick. Because when the PWM signal is HIGH(5V) the motor will just take 24V / 0.8 = 30A, so the chip will get into overcurrent state (p.13) and disconnect the gate from the motor so that the motor is basicly always off, or am I wrong?
No, there's no problem with PWM duty cycle for current control with FOC (instead of simple BLDC block-commutation). It's a high frequency (several kHz) PWM cycle that the motor inductance will filter to a controlled current via a torque feed-back loop in the FOC algorithm.

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3231115/