# 3 phase motor calculate proper phase voltages

I'm driving a brushless motor in "star" configuration using 3 sinusoidal waveforms. I'm getting pretty good results mostly by determining correct wiring and phase by trial and error, but I would like to do even better by understanding what is actually going on in the motor and determining the correct wiring and phase of each signal by applying what I learn.

As far as I understand, the maximum efficiency is achieved when back-emf waveform is precisely in phase with supplied waveform. So I want to ensure this is so by measuring the back emf and aligning my inverter sine waves such that they are precisely in phase with all three back-emf signals.

So I have measured the back-emf using scope across two of the windings for each hall sensor signal. I also know that hall sensor signal tells me when the back-emf waveform crosses zero point, so by measuring back emf and looking at hall sensor outputs I was able to pair each hall sensor line with the correct pair of coil wires to make sure that the hall sensor signal changes state precisely when the back-emf crosses zero point.

For example, in my case it looks like this:

Hall_1: +red -black
Hall_2: +yellow -red
Hall_3: +black -yellow


The above is how I connected the probe to the motor wires while spinning the motor to determine two wires and their polarity that corresponds to the hall signal if hall signal were to output a square wave that switches state at each zero crossing of the sine wave.

So the above picture shows signal of hall3 (square) and the corresponding back emf waveform measured with probe ground connected to yellow wire and probe itself connected to black wire. Obviously if I measure it across any other two wires, it would be the same waveform but it would be out of phase with the hall signal.

Now I would like to determine the input waveforms to all three phases such that the signal across these same two wires corresponds to the back-emf waveform above.

The main issue that I can not quite understand is the fact that midpoint between each two windings above also is fed a sine wave through the third winding. How can I calculate the phase of all three input waveforms then so that the resulting voltage across black and yellow wires corresponds to the waveform above?

This is getting really confusing so how should I be thinking about this to understand it better?

Yes, driving a 3 phases motor is a non-trivial problem, but there is way to make it simpler.

The basics and defining what we want to do

First, have a look a this wikipedia article and try to get a picture of why you have 3 phases. Your goals is to create a rotating magnetic field, and that will happen if your 3 phases are shifted from 120 degrees. You should see that on your EMF as well.

Now I would like to determine the input waveforms to all three phases such that the signal across these same two wires corresponds to the back-emf waveform above.

The waveform will be 3 sinusoids shifted from 120 degrees. The real problem is knowing in what direction you want your magnetic field.

As far as I understand, the maximum efficiency is achieved when back-emf waveform is precisely in phase with supplied waveform.

I am not so sure this statement holds. I'd say : Maximum torque per amps is obtained when magnetic field is 90 degrees with respoect with to the rotor field. Efficiency is a function of torque and speed (and motor performances). To make the motor turns, you need torque. If you create a magnetic field that is in phase with the rotor field (0 degrees), you get no torque and waste energy in the winding resistance.

At this point, we have defined what we want. 3 sinusoids shifted from 120 degrees, with a total phase such that the magnetic field is 90 degree from the rotor field. Now the real problem is determining this angle which depends on the position of the rotor.

Controlling the field vector

Let's say you know what angle you want. Your rotor is at say, 38 degrees, you want maximum torque, so you will have to define a vector with an angle of 128 degrees. The amplitude of that vector will control the amount of torque you ask. For the sake of the example, let's say you want a current vector of 1A.

Since your controller can output a voltage, you would need to make a close loop system that regulates the current to get that 1A. I assume you don't have current sensors, then we will control the voltage and the current will be whatever it will be. The motor will still turn, be we won't know the amount of torque we give precisely.

Assuming we do voltage control, we can make our previous current vector a voltage vector. $\vec{v}=1V\angle128^{\circ}$

How do we converts that voltage vector into 3 voltage? The answer is the Reverse Clark Transform The Clark Transform will converts your 3-axis system into a 2-axis system. Instead of working with $V_a$, $V_b$, $V_c$, you will work with $V_\alpha$ and $V_\beta$. These 2 voltages represents vector components on a 2D planes. The reverse Clark Transform obviously converts $V_\alpha$ and $V_\beta$ back to $V_a$, $V_b$, $V_c$

The rest of the work only matters of simple vector calculation. For $\vec{v}=1V\angle128^{\circ}$ $$V_\alpha = 1V*cos(128^{\circ})$$ $$V_\beta = 1V*sin(128^{\circ})$$

Then apply the inverse Clark Transform and find $V_a$, $V_b$, $V_c$

Knowing the rotor angle

Our last problem is to deduce the position of the rotor. It is indeed related to the EMF. If you apply the Clark transform on the EMF, you will find its angle in the $\alpha \beta$ plan. But you can't read that input, instead you have hall effect sensors that output a digital signal that is high when the EMF is positive and low when the EMF is negative. I see that as 3 square waves shifted from 120 degrees. You can apply the Clark transform to these 3 square waves, what you will obtain is a vector with a resolution of 60 degrees. Instead of a smooth rotational movement, you will have a vector that do 60 degrees steps.

You then have everything you need to control your motor

Summary

The way of doing is then as follow:

2. Apply Clark Transform and find the angle of the rotor
3. Define a command vector that is shifted from 90 degrees
4. Apply the inverse clark transform
5. Output voltage on three lines.

Make it easier with FOC

There is a way to make your control even more simple by doing FOC (Field Oriented Control). Even though the Wikipedia article seems complex, the idea is quite simple. Using the Park Transform, you shift your axis $\alpha$ and $\beta$ so that they align with your rotor. That will yields a new voltage/current vector with two components $I_d$ and $I_q$ where $I_d$ is parralel to the rotor and $I_q$ is perpendicular to the rotor. All you have to do then is set $I_d = 0$ and control the torque with $I_q$.

With FOC, step 3 above becomes:

• Apply Park Transform
• Set $I_d = 0, I_d = 1V$
• Apply Inverse Park transform

There is this very nice video from Texas Instrument that covers the subject of FOC very well. You will pretty much find everything you wan to know in the first half of it. I strongly suggest you watch it.

Good luck!