# Inconsistent 3-phase BLDC current

I come here because I am struggling to understand the signals coming from my 3 phase BLDC motor current. I am using a BLDC motor with a DRV8323RS driver in 1xPWM mode with Hall sensors. I measure the current A, B and C using low sense resistor R_sense of 2mOhm as described in the typical application of the datasheet (cf schematics below).

The gain amplifier G_csa of the DRV8323RS chip is set to 20V/V. The current measurement is set as bidirectional. The voltage of the sense resistor is outputed on SOA, SOB and SOC and routed to the ADCs of my µC. I sample these 3 ADC channels of my µ-controller and I send the current via UART to my computer.

I do the conversion from voltage to current with the following equation with SOx on 16-bits resolution :

Regarding the following pictures I can see several problem :

• Picture 1 shows the currents with the motor being moved by hand and no voltage applied. We can see an offset of approximately -2A when there is nothing happening. Then we see the resulting current of the Back EMF which looks OK

• Picture 2 shows the currents when the motor has 2V (10% duty cycle) applied with no load on it. Difficult to interprete but OK the offset is still there.

• Picture 3 shows the currents when the motor has 2V applied with a load by hand to slow down the commutation. Here we see that the shape of the signal looks correct for the green BUT not so much for the blue and red ones. Why the red has a bigger magnitude that the others ? And why the blue signal does not go to negative ? Also, the currents measured seem to not have the correct order of magnitude as I could see on my power supply screen 0.5A. What can be wrong electrically or in my computation ?

• Picture 4 shows the currents with 6V (30% duty cycle) applied and a load by hand. Here the signals are not going negative except some spikes. What is happening ? I thought about aliasing but does not look like.

Update after progression :

I did some improvements on the measurements and partially solved the problem.

• I measured with an external tool the static voltage out of the driver when there is no current flowing and I saw that the voltage was fluctuating between 1.61V and 1.65V where it is supposed to be static at 1.65V. This shows fluctuation but it is not big enough to explain a big offset of -2A shown in the original picture. This must come from an offset on the ADC channels. For the moment I compensated it by software.

• I did a simple averaging filter for the noise.

• The problem of some channels not going negative have been solved by increasing the sampling time of the ADC channels. The following picture shows the improvement on the motor running under 10% PWM. However, when the motor speed increases under 30% of PWM, I cannot get a good measurement even when I tried different ADC sampling times. It looks like the capacitive effect of the ADCs is too big to adapt with the changing voltage of the 3 channels.

My remaining questions are :

• How do you deal with this ADC limitation ? I was thinking about changing the gain of the amplifier to reduce the magnitude but I will loose in resolution.
• I still don't know why one of the channel has a bigger amplitude than the others, any idea ?
• How can I explain the difference between current consumption displayed on my DC power supply and the current measured with my ADCs (0.5A vs 4A) ? It is related with RMS ?

Thank you all for your help :)

• Show the schematics and exact measurement point and measurement equipment. BEMF stands for voltage, not current so explain how do you measure BEMF. – Marko Buršič Apr 1 at 16:06
• I updated the original post with a schematics. The current I measured when no voltage is applied are not due to back emf voltage ? – Robs_vic Apr 1 at 17:37
• Sure, the current is due to BEMF voltage, correct. Except it could go just one direction if the MOSFETs are not switching. – Marko Buršič Apr 1 at 19:15
• @Robs_vic Please ask a specific question – Voltage Spike Apr 2 at 19:17
• What is the CAL pin connected to? What are the part numbers of the MOSFETs? What values did you put into the configuration registers? – Bruce Abbott Apr 2 at 20:17

## 2 Answers

$$I=\dfrac{\dfrac{V_{ref}}{2}-V_{SOx}}{G_{cs}R_{sense}}$$

MCU ADC code reading:

$$V_x=\dfrac{V_{ref}}{2^{N-1}}ADC_c$$

Calculate I from ADC code:

$$I=\dfrac{V_{ref}}{G_{cs}R_{sense}}(\dfrac{1}{2}-\dfrac{ADC_c}{2^{N-1}})$$

$$I=\dfrac{V_{ref}}{G_{cs}R_{sense}}(\dfrac{2^{N-2} - ADC_c}{2^{N-1}})$$

Suppose you have 10 bit ADC

$$I=\dfrac{V_{ref}}{G_{cs}R_{sense}}(\dfrac{511 - ADC_c}{1023})$$

If you don't read very close to zero if the current is zero, then you might have wrong register settings, PGA, offset,...

Make sure you start one issue at once, so remove the offset, first.

• Indeed, I fully agree with your equations. It is what I am doing with 16 bits resolution. But the things is yes, even when there no current, I don't measure Vref/2 = 3.3V/2 = (2^16 - 1) / 2 However, I don't know if it is a software issue or if the voltage value at this point is not 1.65V. I can check that tomorrow. – Robs_vic Apr 1 at 17:31
• @Robs_vic - Hi, I see you are new here. Please note that you reply to someone's answer (if a reply is necessary) using a comment below that answer - not using the "Your Answer" box yourself, since you are not answering your question at the top of the page. Therefore I have moved your "answer" into a comment here. Further details of site rules and guidelines are in the tour and help center. Thanks. – SamGibson Apr 1 at 17:42

Picture 3 shows the currents when the motor has 2V applied with a load... the currents measured seem to not have the correct order of magnitude as I could see on my power supply screen 0.5A. What can be wrong electrically or in my computation ?

The power supply meter shows average current going out of it, but the controller only draws current from the power supply during the 'on' portion of the PWM period. At 10% PWM an average current of 0.5 A corresponds to 5 A during the 'on' time. During the 'off' time the current recirculates through the FETs, so the motor current is 5 A continuous.

But even this is not the full story. The phase windings have inductance which limits the rate of current change and smooths out the motor current, but unless the PWM frequency is very high there will be ripple due to the current ramping up and down.

Here is an example scope trace of current though and voltage across a BLDC motor with ~50% PWM applied at 12 kHz:-

In this example the current ramps up to ~3.4 times higher than the average power supply current during PWM 'on' time, and drops to zero during the 'off' time.

Your ADC is apparently not sampling fast enough to capture the current waveform accurately, and may also be aliasing with the PWM frequency to produce a bogus sample waveform. To fix this you can increase the sampling rate (if possible) or apply external (analog) low pass filters to produce a more accurate average of the PWM pulses.

You should also use a scope to see the actual waveforms and voltages. This is the only way to to know what is really happening.