How to calculate RPMs of a BLDC e-bike motor using its controller?

MaxHeadRoom

Joined Jul 18, 2013
30,881
But the commutation of a BLDC motor cannot be identical for every motor with different number of poles.
Whatever is used to register the hall detector, it has to be geared to the number of rotor poles.
IOW, the degree or rate of the commutation has to vary with pole count.
Take for example, the motor that the BLDC is named after, the DC brushed motor with the commutator, The hall sensors, replace what essentially is the commutator on a DC motor..
The number of commutator poles vary from motor to motor, depending on the amount of poles wound onto the rotor.
 

MisterBill2

Joined Jan 23, 2018
28,552
My intent was to present a scheme for knowing the RPM without digging into the motor or control circuits at all. A capacitive pickup from one phase will report the phase rotation speed, which will be some number of three times the mechanical rotation speed. So if the frequecy can be read accurately and the RPM at that time read fairly closely, the relationship can be determined precisely, without digging into the motor wiring at all.
 

Thread Starter

Mario Marquina

Joined Mar 1, 2023
23
But the poles are the magnets?
And the Hall effect sensors are triggered by the rotor magnets, which can be from 1 pair to 4 pair, typically.
So if you are using the hall as a rev counter, you need to know the number of poles, the higher the number of poles, the higher the number of hall pulses/rev.
This is why when you do fit an optical equivalent to the hall sensor, the number of poles has to be known.
I appreciate the insightful suggestions. The issue is that I've checked the output of one of the 3 cables carrying the signal from the Hall sensors using an oscilloscope and I've observed that a change in motor speed corresponds to a change in the duty cycle of a square wave with a constant frequency. Given that the PWM frequency remains the same but the duty cycle changes, how can I calculate the speed?
 

MisterBill2

Joined Jan 23, 2018
28,552
The PWM frequency will need to be filtered out, the average current variation frequency will be much lower. And really, tapping into the position sensing circuit can be a big deal challenge unless you know and understand the sensing circuit. Not every scheme is referenced against an obvious common. A capacitive pickup from one of the driver leads , with the PWM frequency filtered out would give a representation of the rotation speed, although the frequency may be some multiple of the RPMs.
 

Thread Starter

Mario Marquina

Joined Mar 1, 2023
23
The PWM frequency will need to be filtered out, the average current variation frequency will be much lower. And really, tapping into the position sensing circuit can be a big deal challenge unless you know and understand the sensing circuit. Not every scheme is referenced against an obvious common. A capacitive pickup from one of the driver leads , with the PWM frequency filtered out would give a representation of the rotation speed, although the frequency may be some multiple of the RPMs.
I'm not sure I understood correctly. I tapped into the signal directly from the motor, before the driver. Is there a signal conditioning circuit inside the motor? I was thinking of filtering the signal to keep only the DC component and obtain a voltage value proportional to the speed, as the average voltage would increase with the increasing DC. However, there isn't a direct relationship between speed and voltage, such as knowing the frequency at which the Hall sensor is triggered. Am I mistaken?
 

MisterBill2

Joined Jan 23, 2018
28,552
My original suggestion was a capacitive pickup consisting of a few inches of bare wire wrapped over the insulation of ONE of the motor power leads. That would be a totally non-intruding method of picking up the drive speed signal, with no chance of causing a problem with motor operation. That frequency would be proportional to the RPM, but multiplied by some number, based on the number of poles. It might need a bit of amplifying, but that part is easy.
And since this application IS NOT AN E-BIKE, we have no ideas as to what else is part of the arrangement.
And certainly hacking into the system wiring is one way to cause problems, unless the person is very skilled at digging into packaged hardware.
 

MaxHeadRoom

Joined Jul 18, 2013
30,881
I appreciate the insightful suggestions. The issue is that I've checked the output of one of the 3 cables carrying the signal from the Hall sensors using an oscilloscope and I've observed that a change in motor speed corresponds to a change in the duty cycle of a square wave with a constant frequency. Given that the PWM frequency remains the same but the duty cycle changes, how can I calculate the speed?
You count either each rising edge or each falling edge of the pulses, the number of hall sense/rev pulses vary from motor to motor, dependent on the pole count of the motor.
Change in RPM should change the No of hall pulses/min
 
I've checked the output of one of the 3 cables carrying the signal from the Hall sensors using an oscilloscope and I've observed that a change in motor speed corresponds to a change in the duty cycle of a square wave with a constant frequency.
I was about to post a suggestion related to the sniffing of one of the motor’s hall sensor lines until I read this. Are you absolutely sure that the frequency of pulses doesn’t go up and down with the motor speed? For hall sensor commutation, regardless of whether it’s a square wave/sine wave/FOV drive signal the controller needs to know the angular position of the motor which has to trigger the change of state of the hall sensor. I can’t think of a reason to do any pre-processing within the motor itself. Maybe you are not seeing these transitions if noise on that line is triggering the ‘scope to show a higher frequency?
 

MaxHeadRoom

Joined Jul 18, 2013
30,881
For an example:
This shows the relative position of the commutation pulses in relation to the generated sine wave when the motor is back-fed/rotated.
The generated sine, occurs at the same position as the imposed power fed to that winding.
These are not the older hall sensors but pulses on the encoder, they perform the same, although the encoder method is far more accurate.
 

Attachments

shortbus

Joined Sep 30, 2009
10,049
These are not the older hall sensors but pulses on the encoder, they perform the same, although the encoder method is far more accurate.
We had another disagreement on this in this thread. While what your saying is true in a servo type situation, the need for precise position, this is just a Ebike motor. I'll be willing to bet it uses the old 120degree Hall sensor positions, like in the first part of your PDF.

After what you said in the earlier discussion, I read up on why you said the Halls and the PM's on the rotor had to be known. In the servo type the Hall sensors are placed near the rotor, not controlled by an extra magnet especially for the Hall position. That was new to me since my references only talk about the old Hall sensor positioning.
 

MaxHeadRoom

Joined Jul 18, 2013
30,881
I am not sure if we were talking at odds on the previous posts, but what I meant is, and the encoder works identically to the physical hall device versions, the placement of these devices depends on the amount of poles. So the pulses/rev detected by the means of sensing has to change, to correspond to the varying pole count.
BLDC motors typically have 2 to 8 pole pairs. So the point that commutation occurs has to change for each version. ;)
Just as its DC motor counterpart with the physical commutator bars, the number of com bars change with the pole count on the rotor
 

Thread Starter

Mario Marquina

Joined Mar 1, 2023
23
I was about to post a suggestion related to the sniffing of one of the motor’s hall sensor lines until I read this. Are you absolutely sure that the frequency of pulses doesn’t go up and down with the motor speed? For hall sensor commutation, regardless of whether it’s a square wave/sine wave/FOV drive signal the controller needs to know the angular position of the motor which has to trigger the change of state of the hall sensor. I can’t think of a reason to do any pre-processing within the motor itself. Maybe you are not seeing these transitions if noise on that line is triggering the ‘scope to show a higher frequency?
The point is precisely this: I was expecting to obtain a variable frequency as the speed changes; instead, I'm getting a constant frequency with a variable duty cycle. The key issue is that the driver needs to know the rotor's position to control it, and this information is contained in the respective square wave signals from the 3 hall sensors. Through their phase shifts, they provide the rotor's position. I'm not interested in the position itself; I just want to calculate the speed. So, having just one hall sensor with its variable frequency would be sufficient, but it's not the case. While there might be noise present, I shouldn't be able to clearly observe the duty cycle change with the oscilloscope in this scenario. However, I see a clear square wave with a duty cycle that changes proportionally to the speed. But it seems odd that the motor would convert the frequency change into a duty cycle change and send this signal to the driver, which then needs to decode it. For this reason, I'm quite confused and I'm returning to ask if you think there's a relatively simple way to calculate the RPM, with the information I've provided so far, and having an ST core board at my disposal. Thank you for all the suggestions you've provided so far!
 

MaxHeadRoom

Joined Jul 18, 2013
30,881
The point is precisely this: I was expecting to obtain a variable frequency as the speed changes; instead, I'm getting a constant frequency with a variable duty cycle.
That doesn't make any sense,? How can varying the rpm of the motor NOT affect the frequency that the commutation pulses occur?
 

Thread Starter

Mario Marquina

Joined Mar 1, 2023
23
That doesn't make any sense,? How can varying the rpm of the motor NOT affect the frequency that the commutation pulses occur?
In my opinion as well, it doesn't make sense because the frequency when the engine is running very slowly at 5 rpm, for example, cannot be the same as that at 270 rpm. The only thing that changes is the voltage the cable provides if you filter its signal – 2.5V when it's at 50% duty cycle (engine stopped) and 5V at 100% duty cycle (maximum RPM). However, it's an odd piece of information to use for counting RPM.
 

Ya’akov

Joined Jan 27, 2019
10,365
I appreciate the insightful suggestions. The issue is that I've checked the output of one of the 3 cables carrying the signal from the Hall sensors using an oscilloscope and I've observed that a change in motor speed corresponds to a change in the duty cycle of a square wave with a constant frequency. Given that the PWM frequency remains the same but the duty cycle changes, how can I calculate the speed?
Since this doesn’t make sense, are you sure of which signal you are actually looking at? A PWM signal would be a speed control signal for the motor, not the Hall effect sensor output.
 

MisterBill2

Joined Jan 23, 2018
28,552
What does make some sense to me i that a good cope with a good triggered sweep set to display one cycle of a PWM signal will show close to a constant image if the sweep rate is such that only a bit of the PWM is displayed. Also, why would there be any PWM involved with the position portion of the system??
So I am guessing that there is something incorrect about the tet scheme.That may be possibly the common reference connection for the cope, and certainly the sweep speed. Any PWM should only be present on the drive coils connection.

So what i the total number of wires connected from the motor to the driver circuit? It might be a sensor-less motor, Consider that an E-Bike motor doe not need overly precise control.
In addition, try a much slower sweep speed. Using the PWM frequency to synch the sweep will not display the drive rate variations.
 

MaxHeadRoom

Joined Jul 18, 2013
30,881
What does make some sense to me i that a good cope with a good triggered sweep set to display one cycle of a PWM signal will show close to a constant image if the sweep rate is such that only a bit of the PWM is displayed. Also, why would there be any PWM involved with the position portion of the system??
So I am guessing that there is something incorrect about the tet scheme.That may be possibly the common reference connection for the cope, and certainly the sweep speed. Any PWM should only be present on the drive coils connection.

So what i the total number of wires connected from the motor to the driver circuit? It might be a sensor-less motor, Consider that an E-Bike motor doe not need overly precise control.
In addition, try a much slower sweep speed. Using the PWM frequency to synch the sweep will not display the drive rate variations.
"Also, why would there be any PWM involved with the position portion of the system??"

That I believe is Ya'akov's point the PWM is of constant frequency so no point using that signal for RPM indication, the commutation pulses, if present should be used.
If the motor has just three power conductors then it is self detect commutation, if three or five smaller wires are also present, then one of these would be the one to monitor for RPM.
I have helped my son with his two E-bikes and they both use commutation sensors.
 
Last edited:

Thread Starter

Mario Marquina

Joined Mar 1, 2023
23
What does make some sense to me i that a good cope with a good triggered sweep set to display one cycle of a PWM signal will show close to a constant image if the sweep rate is such that only a bit of the PWM is displayed. Also, why would there be any PWM involved with the position portion of the system??
So I am guessing that there is something incorrect about the tet scheme.That may be possibly the common reference connection for the cope, and certainly the sweep speed. Any PWM should only be present on the drive coils connection.

So what i the total number of wires connected from the motor to the driver circuit? It might be a sensor-less motor, Consider that an E-Bike motor doe not need overly precise control.
In addition, try a much slower sweep speed. Using the PWM frequency to synch the sweep will not display the drive rate variations.
The motor is not sensorless but uses 3 Hall sensors because the connection to the driver occurs through the 3 phase wires for power supply and then a connector with the 3 wires of the Hall sensors, 2 for power supply (GND and 5V), and then another wire, whose signal doesn't carry meaningful speed information and is heavily distorted (I've observed the signal with an oscilloscope). Now, the fact remains that in my opinion, when looking at the signal with the oscilloscope using the GND provided to the motor through the driver as reference and one of the 3 Hall sensor wires, the observed signal should be a variable-frequency square wave, not a PWM.
 
Top