Click here to Skip to main content
14,367,980 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi guys,
I am trying to commutate BLDC motor using encoder and one revulation is 1024 encoder value.And motor 10 pole pairs,in this case 18 encoder value(60 electrical degree) equals 6 mechanical degree so that when the rotor reached the 18 alteration I have to perform next stage.

For example now rotor in 0. position and rotate encoder 13 value and then rotate CCW -10(1024-13-10= 1001) I can't decice how can I find the right sequence.I can't find a good solution algorithm for it?How people do it right?

What I have tried:

encoderValue = Get_Encoder_Pos();

if(((encoderValue - xEncoderValue) >= 18) && dir==1)
{
   Set_Commutation_and_DutyCycle(table[x],PWM);
}
//This doesn't work,If motor rotate CCW from 0 to in this case enc value will increase 1024-1023 .... like that.
Posted
Updated 9-Oct-19 0:47am
Comments
CPallini 9-Oct-19 3:35am
   
Please detail your scenario and be precise. For instance, if a revolution corresponds to 1024 on the encoder, 18 should correspond to about 6 (not 60) degrees.
Emrah Duatepe 9-Oct-19 5:48am
   
every 6 mechanical degree equals 60 electrical degree according to 10 poles motors,so for encoder max 1024 counting, 360/1024 = 0.3515625 and 6 mechanical degree equals about 17 encoder value.I am gonna try to make an encoder maps like

1,2,3 encoder value is corresponding table[1],table[2],table[3] = activate A and C phases like that probably it works table[18] = activate different phases.
CPallini 9-Oct-19 11:43am
   
Assuming the encoder measuring the electrical angle, then, according to the following page:
https://www.researchgate.net/post/Is_there_a_relation_between_the_electrical_and_mechanical_angle
a 18 encoder value would correspond to
about 6 degrees (electrical angle)
about 30 degrees (mechanical angle)
That said, what are you trying to do? That is what should your program compute?
Still it is not clear to me.
Emrah Duatepe 10-Oct-19 1:37am
   
the code that I indicate above is not good approach already wrong.I am trying to create a table related with motor moving and encoder values to open phases in right sequence.Because of encoder resolution I get resolution error.60 electrical degree for 20 poles motor for 60 electrical degree equals 8.53333 encoder value.Totally electrical degree is 20*360 for 20 poles,but formula say (20/2)*360 ? I am confused.20 poles means 20 magnetic and every magnetic creates one 360 electrical degree.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100