Level 1
Level 1

# Help With BLDC Sensorless Speed Control

Hey there!

we tend to drive a specific bldc sensorless motor using two different algorithms.

both of them are based on zero crossing detection, a vey simple approach.

the algorithm one detects ZCs by analog comparators and of course their corresponsive interrupts to apply the next step of commutation.

the algorithm two detects ZCs using ADC and then comparing the BEMF to VBus/2.

here is my broblem. the max speed achieved by algo.1 differes from algo.2 while the applied duty cycle is the same(for both almost 100%)

how could it be possible? I know that the speed is related to duty cycle so I tought the max speed would be the same no matter which algo I used.

I would be grateful if you could help.

1 Solution
Moderator
Moderator

# Re: Help With BLDC Sensorless Speed Control

Hi @MoHo98,

Good Day!

Sorry for the delay in response.

For BLDC commutation in sensorless mode, please refer to section 2.5.2 Speed and position calculation for sensor-less control in the application note BLDC motor control software using XMC.

Algorithm 1 detects zero crossing of back EMF with an analog comparator, comparing back EMF (produced in the third phase, when the first two phases are excited) with Vdc/2.

Algorithm 2 detects zero crossing of back EMF using ADC.

Using a resistor divider circuit from the stator phase, the terminal voltage is stepped down to a level the microcontroller can read. After the resistor divider circuit, we have to filter it out the high-frequency component from terminal voltage to extract back EMF using a low pass filter or a digital filter. This filtered signal is sampled by ADC and is continuously compared with a digital value corresponding to a zero point to detect zero crossing of back EMF.

In which algorithm you are getting higher speed?

Please confirm whether you are using an LPF or a digital filter after resistor divider circuit in algorithm 2?

Could you share the Back EMF signal calculated from algorithm 1 and algorithm 2?

Thank you!

Best Regards,
Vinay
4 Replies
Moderator
Moderator

# Re: Help With BLDC Sensorless Speed Control

Hi @MoHo98,

Good Day!

Thanks for posting your question in Infineon Community.

Yes, we can achieve the maximum speed based on the duty cycle. Higher the duty cycle, higher the speed we can achieve.

Could you share with me the rotor position calculated in both algorithms?

Did you observe any difference in rotor position calculated in both algorithms?

Thank you!

Best Regards,
Vinay
Level 1
Level 1

# Re: Help With BLDC Sensorless Speed Control

Actually, we haven't calculated the rotor position cause we don't need it.  Let me explain how the algorithm works.

firstly, an arbitrary number of steps applies to the motor in order to drive it in open loop mode. After that the algorithm switches to the closed loop mode. then speed is estimated using a timer

the speed is estimated by measuring the time between the point of ZC detection and the instant of the previous commutation step.

here is the code I used:

////////////////////////////////////////////////////////////////////////////////
/*! \brief Calculates the current speed in electrical RPM.
*
* This function calculates the current speed in electrical rotations per
* minute from the global variable \ref filteredTimeSinceCommutation.
*/
static unsigned long CalculateSpeed()
{
// Copy used to minimize period where interrupts are disabled.
unsigned int filteredTimeSinceCommutationCopy;
unsigned long rotationPeriod;
unsigned long speed;

/*
Disable interrupts to ensure that \ref filteredTimeSinceCommutation is accessed in
an atomic operation.
*/
disableInterrupts();
filteredTimeSinceCommutationCopy = filteredTimeSinceCommutation;
enableInterrupts();

/*
filteredTimeSinceCommutation is one half commutation time. Must be multiplied by 12 to get
one full rotation.
*/
rotationPeriod = (unsigned long)filteredTimeSinceCommutationCopy * 48;
speed = (TICKS_PER_MINUTE / rotationPeriod);

return speed;
}

do you wanna say that the instant of applying of the commutation steps is incorrect?

Moderator
Moderator

# Re: Help With BLDC Sensorless Speed Control

Hi @MoHo98,

Good Day!

Sorry for the delay in response.

For BLDC commutation in sensorless mode, please refer to section 2.5.2 Speed and position calculation for sensor-less control in the application note BLDC motor control software using XMC.

Algorithm 1 detects zero crossing of back EMF with an analog comparator, comparing back EMF (produced in the third phase, when the first two phases are excited) with Vdc/2.

Algorithm 2 detects zero crossing of back EMF using ADC.

Using a resistor divider circuit from the stator phase, the terminal voltage is stepped down to a level the microcontroller can read. After the resistor divider circuit, we have to filter it out the high-frequency component from terminal voltage to extract back EMF using a low pass filter or a digital filter. This filtered signal is sampled by ADC and is continuously compared with a digital value corresponding to a zero point to detect zero crossing of back EMF.

In which algorithm you are getting higher speed?

Please confirm whether you are using an LPF or a digital filter after resistor divider circuit in algorithm 2?

Could you share the Back EMF signal calculated from algorithm 1 and algorithm 2?

Thank you!

Best Regards,
Vinay
Level 1
Level 1

# Re: Help With BLDC Sensorless Speed Control

It's very nice of you. Thanks for your time!

Yes I used a low-pass filter and it filters the BEMF voltage of each phase. I'll send you the schematic I used for this purpose. I have also used a digital filter (an IIR filter) to filter the commutation time due to the noisy environment created by PWM

I'll also send you the ISR code related to detecting BEMF ZCs.

I guess I should mention that I increase the ADC threshold variable( the value that BEMF signals are compared to) as the motor speeds. If I don't, the motor stalls some point while accelerating and I'm not sure if it's right. ( I Know that the BEMF voltage increases when the motor speeds)

I should also mention that the speed estimated by my algo is almost equal to the  speed measured by a tachometer so the commutation times seem to be applied correctly( correct me if I'm wrong)

in algo 1, which uses analog comparators, I get higher speed. this method is kind of similar to using hall sensors, isn't it?

what do you exactly want me to send you about the bemf signal? its waveform you mean?

Is there any source code for this ? BLDC motor control software using XMC

thanks!