# MOT: PP check: fail - estimated pp:16.4384

**URL:** <https://community.simplefoc.com/t/mot-pp-check-fail-estimated-pp-16-4384/1918>\
**Category:** Uncategorized\
**Created:** [April 10, 2022, 6:13am UTC](https://community.simplefoc.com/t/mot-pp-check-fail-estimated-pp-16-4384/1918 "2022-04-10T06:13:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolaewich1988](https://community.simplefoc.com/user_avatar/community.simplefoc.com/nikolaewich1988/32/2736_2.png) [@nikolaewich1988](https://community.simplefoc.com/u/nikolaewich1988)\
**Post date:** [April 10, 2022, 6:13am UTC](https://community.simplefoc.com/t/mot-pp-check-fail-estimated-pp-16-4384/1918/1 "2022-04-10T06:13:48Z")

</div>

Good morning, everyone. After calibration, such a message. I think something is wrong. Is it so?

 ![Безымянный](https://community.simplefoc.com/uploads/default/original/2X/1/12cb222a380e946153e714f631631062293e85e4.png)

---

<div class="post-metadata">

**Author:** ![Antun\_Skuric](https://community.simplefoc.com/user_avatar/community.simplefoc.com/antun_skuric/32/21_2.png) [@Antun\_Skuric](https://community.simplefoc.com/u/Antun_Skuric)\
**Post date:** [April 10, 2022, 12:08pm UTC](https://community.simplefoc.com/t/mot-pp-check-fail-estimated-pp-16-4384/1918/2 "2022-04-10T12:08:34Z")

</div>

Hey @nikolaewich1988,  
Yeah, failed pole pair number check usually indicates that there is something whong.  
But it doesn’t have to be so. Pole pair check is optional.  
If your motor spins after this check and if you can control it, you can ignore the message. If your motor is stuck and drawing a lot of current, there is something wrong. 🙂

What is the number of the pole pairs of your motor?  
Can you describe your setup, driver, sensor, mcu and the motor?

---

<div class="post-metadata">

**Author:** ![nikolaewich1988](https://community.simplefoc.com/user_avatar/community.simplefoc.com/nikolaewich1988/32/2736_2.png) [@nikolaewich1988](https://community.simplefoc.com/u/nikolaewich1988)\
**Post date:** [April 10, 2022, 12:14pm UTC](https://community.simplefoc.com/t/mot-pp-check-fail-estimated-pp-16-4384/1918/3 "2022-04-10T12:14:54Z")

</div>

Hello. atmega 328, motor hoverboard (15), rotaryencoder 600ppr. cw & ccw have different speeds (5, -5)

---

<div class="post-metadata">

**Author:** ![nikolaewich1988](https://community.simplefoc.com/user_avatar/community.simplefoc.com/nikolaewich1988/32/2736_2.png) [@nikolaewich1988](https://community.simplefoc.com/u/nikolaewich1988)\
**Post date:** [April 10, 2022, 12:26pm UTC](https://community.simplefoc.com/t/mot-pp-check-fail-estimated-pp-16-4384/1918/4 "2022-04-10T12:26:28Z")

</div>

#include \<SimpleFOC.h\>  
int S;

BLDCMotor motor= BLDCMotor(15);  
BLDCDriver3PWM driver= BLDCDriver3PWM(9, 10, 11, 8);

Encoder encoder= Encoder(2, 3, 600);

void doA(){encoder.handleA();}  
void doB(){encoder.handleB();}

Commander command= Commander(Serial);  
void onMotor(char\* cmd){command.motor(&motor, cmd);}  
struct \_poligonInexes{  
int minIndex;  
int maxIndex;}  
;  
int \_Poligon\_InArray\_2[4] = {0, 12, 22, 1000};  
int \_Poligon\_OutArray\_2[4] = {0, 0, -3, -7};  
int \_Poligon\_InArray\_3[4] = {0, 12, 22, 1000};  
int \_Poligon\_OutArray\_3[4] = {0, 0, 3, 7};  
int \_gtv2;  
void setup(){

encoder.init();  
encoder.enableInterrupts(doA, doB);  
motor.linkSensor(&encoder);  
driver.voltage\_power\_supply = 24;  
driver.init();  
motor.linkDriver(&driver);  
motor.foc\_modulation = FOCModulationType::SpaceVectorPWM;  
motor.controller = MotionControlType::torque;  
motor.PID\_velocity.P = 0.1f;  
motor.PID\_velocity.I = 6;  
motor.PID\_velocity.D = 0;  
motor.voltage\_limit = 8;  
motor.LPF\_velocity.Tf = 0.01f;  
motor.P\_angle.P = 20;  
motor.velocity\_limit = 50;  
motor.init();  
motor.initFOC();  
motor.target = 2;  
}  
void loop(){  
S = \_gtv2;  
motor.loopFOC();  
motor.move(S);  
command.run();  
if (!(((analogRead (0))) \> (20))){\_gtv2 = (\_poligon(((analogRead (1))), \_Poligon\_InArray\_3, \_Poligon\_OutArray\_3, 4));}  
if (!(((analogRead (1))) \> (20))){\_gtv2 = (\_poligon(((analogRead (0))), \_Poligon\_InArray\_2, \_Poligon\_OutArray\_2, 4));}  
}  
int \_poligon(int value, int intArray, int outArray, int arraySize)  
{  
struct \_poligonInexes indexes;  
indexes = \_getPoligonIndexes(value, intArray, arraySize);  
return map(value, intArray[indexes.minIndex], intArray[indexes.maxIndex], outArray[indexes.minIndex], outArray[indexes.maxIndex]);  
}  
struct \_poligonInexes \_getPoligonIndexes(int value, int array, int arraySize)  
{  
struct \_poligonInexes result;  
int i;  
result.minIndex = 0;  
result.maxIndex = 0;  
for (i = 0; i \< arraySize; i++) {if (array [result.minIndex] \> array[i]) { result.minIndex = i;}  
if (array [result.maxIndex] \< array[i]){result.maxIndex = i;}  
}  
for (i = 0; i \< arraySize; i++)  
{  
if ((array [i] \>= value) && (array [result.maxIndex] \> array[i]))  
{result.maxIndex = i;}  
}  
if (result.maxIndex==0)  
{  
result.minIndex = 0;  
result.maxIndex=1;  
}  
else  
{  
result.minIndex = result.maxIndex -1;  
}  
return result;  
return result;  
}

---

<div class="post-metadata">

**Author:** ![Kacko](https://community.simplefoc.com/user_avatar/community.simplefoc.com/kacko/32/4370_2.png) [@Kacko](https://community.simplefoc.com/u/Kacko)\
**Post date:** [February 9, 2023, 2:19pm UTC](https://community.simplefoc.com/t/mot-pp-check-fail-estimated-pp-16-4384/1918/5 "2023-02-09T14:19:21Z")

</div>

ppr stands for “points per revolution” and only applies to encoders, right? curious if this is something i should be setting with my hall-sensored motor. just started with bldc motors, excuse me if it’s a stupid question.

---

<div class="post-metadata">

**Author:** ![runger](https://community.simplefoc.com/user_avatar/community.simplefoc.com/runger/32/395_2.png) [@runger](https://community.simplefoc.com/u/runger)\
**Post date:** [February 9, 2023, 4:55pm UTC](https://community.simplefoc.com/t/mot-pp-check-fail-estimated-pp-16-4384/1918/6 "2023-02-09T16:55:54Z")

</div>

hey, answered in the other thread… you just supply the pole pair number to the HallSensor class, and it works out the CPR from that 🙂
