1
\$\begingroup\$

I am trying to implement sinusoidal control for a BLDC motor. After doing some research about sine wave controller, it seems that SPWM and SVPWM are the best methods for a sine wave controller.

  • I first wanted to try with SPWM method.
  • I have designed an inverter bridge circuit which was working fine with 6 step commutation.
  • Now I have to work more on an algorithm for generating SPWM with a 120 degree phase shift.

I have used this LUT for SPWM:

unsigned char sin_LUT[256]={0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,89,92,95,98,101,104,106,109,112,115,117,120,123,125,128,131,133,136,138,141,143,146,148,151,153,156,158,160,163,165,167,170,172,174,176,178,181,183,185,187,189,191,193,195,197,198,200,202,204,206,207,209,211,212,214,215,217,219,220,221,223,224,225,227,228,229,230,232,233,234,235,236,237,238,239,240,240,241,242,243,243,244,245,245,246,246,247,247,248,248,248,249,249,249,249,249,249,249,250,249,249,249,249,249,249,249,248,248,248,247,247,246,246,245,245,244,243,243,242,241,240,240,239,238,237,236,235,234,233,232,230,229,228,227,225,224,223,221,220,219,217,215,214,212,211,209,207,206,204,202,200,198,197,195,193,191,189,187,185,183,181,178,176,174,172,170,167,165,163,160,158,156,153,151,148,146,143,141,138,136,133,131,128,125,123,120,117,115,112,109,106,104,101,98,95,92,89,87,84,81,78,75,72,69,66,63,60,57,54,51,48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3};

I get good SPWM with the above table.

Since this is my first try in spwm technique in BLDC, I am a little confused how to use this. The inverter consists of 6 FETs/3 leg. SPWM will be generated for only 3 high side FETs and that will be complemented for low side the low

For the phase shift, I started the second SPWM with 170th value to get 120 degrees.

= 120 / 180 = 0.666

=0.666 * 256 = 170.6 value

Now I am confused how to activate the 3-SPWM signals according to the Hall sensor position. How I send the signal depends on the position. I know that something I want to do with speed.

Could someone clearly explain SPWM signal generation with a Hall sensor?

I also don't know to whether to use SPWM for 180 or 360 degree for high side FET. If so then how can I use the LUT?

EDITED

  • What is the correct formula or technique for generating 3 phase sine PWM?

  • Some sine look up tables {for 256} start from (+127)---(0)----(-127) and some from 0 to 255.

  • Which is the correct one for 3 phase sine LUT?

  • The below one is from saddle waveform (3rd harmonic rejection) which contains 1/3rd period to zero (reduces noise and ripples)

static unsigned char SinusoidalWaveTable[384]={
127,131,135,138,142,145,149,152,155,159,162,165,168,171,174,177,180,183,186,189,192,194,197,200,
202,205,207,210, 212,214,217,219,221,223,225,227,229,231,232,234,236,237,239,240,242,243,244,245,
247,248,249,250,250,251,252,253,253,254,254,255,255,255,255,255,255,255,255,255,255,255,254,254,
253,253,252,252,251,250,249,248,247,246,245,244,242,241,240,238,237,235,233,232,230,228,226,224,
222,222,225,226,228,230,232,234,235,237,238,240,241,243,244,245,246,247,248,249,250,251,252,252,
253,254,254,254,255,255,255,255,255,255,255,255,255,255,254,254,254,253,252,252,251,250,249,248, 
247,246,245,244,243,241,240,238,237,235,234,232,230,228,227,225,223,220,218,216,214,212,209,207,
204,202,199,197,194,191,188,185,183,180,177,174,171,167,164,161,158,154,151,148,144,141,137,134,
130,127,123,119,116,112,108,104,101, 97, 93, 89, 85, 81, 77, 73, 69, 65, 61, 57, 53, 49, 45, 41,
36, 32, 28, 24, 20, 16, 12, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 10, 15, 19, 23, 27, 31,
35, 39, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 99,103,107,111,115,118,121,124 
}
  • Could someone give me a simple sine table for 3 phase with an explanation?

Edited 2 SWPM for 360 degrees:

= 127.5 + 127.5 * sin( 2 * 3.14 * i / 360 ) 0 < i < 360

Using the above one I get good SWPM. I will store that in one array (say sin_lut[360],) then I will start the second wave when i reaches i=120 and the third one as i=240, using a single array.

  • I am getting the 3 sine waves with 120 degree shifted waves.
  • [PLL] Now I want to control the BLDC motor by synchronizing the phase sine (feedback) with the hall sensor position. -I need to learn about phase locked loops.

Am I going in the right direction, or do I need to change something?

\$\endgroup\$
4
  • \$\begingroup\$ Does this paper help? \$\endgroup\$ Jan 13, 2020 at 10:43
  • \$\begingroup\$ Hi marcus, i seen that paper before. My problem is controlling bldc via spwm using hall sensor. How to implement or synchronize spwm with hall sensor \$\endgroup\$
    – Bud
    Jan 13, 2020 at 10:51
  • \$\begingroup\$ You don't need to have another table for three phases. You just make the second phase lag 1/3 of a full cycle behind the first phase, and the third 2/3 of a full cycle. \$\endgroup\$ Jan 14, 2020 at 8:49
  • \$\begingroup\$ ya marcus i understood. Do i am going in a right path. I make changes in my answer. \$\endgroup\$
    – Bud
    Jan 14, 2020 at 11:25

1 Answer 1

1
\$\begingroup\$

I'd start based on Fig. 6 in this paper.

You'd simply calculate a speed estimate from the hall effect readings. That gives you how fast you'll be stepping through your LUT.
Hint: this becomes a lot easier if you use a reasonably large LUT – I think you're using an STM32F103? You've got plenty of flash and at least 20 kB of RAM - your LUT can be much larger, so that you get a better sine with less ad hoc calculations. Also you really don't need to store a symmetrical piece of sine – ¼ of a period is sufficient (the rest's just mirrored and/or sign-inverted).

In the end, you could implement that as PLL – your hall effect sensors give you a phase, and you'd subtract the phase that your current reading point in your LUT corresponds to, and low pass filter that error, and then subtract the error from how you increase the pointer into your LUT.

\$\endgroup\$
3
  • \$\begingroup\$ sry marcus i not getting you. phase locked loop word hearing first time. So could me even clear. \$\endgroup\$
    – Bud
    Jan 13, 2020 at 12:52
  • \$\begingroup\$ I explained what a PLL does in the same paragraph. You have two different phases: The one reported by your Hall sensor(s), and the one that your LUT-based SPWM generator has. You strive to make them the same. So, you build a control loop – a PLL. \$\endgroup\$ Jan 13, 2020 at 14:51
  • \$\begingroup\$ Marcus you are brilliant, i got that now. And there are formulas & paper for phase locked loop. I want to go through about that more. But i have an another doubt, i have edited in my answer \$\endgroup\$
    – Bud
    Jan 14, 2020 at 5:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.