El. angle and sensor alignment accuracy

I set up a small test rig in order to play with anticogging (ACT BLF42BLF03, B-G431B-ESC1, AS5047 (SPI)). I did this before with a very low cogging , but it went nowhere, so this time I tried it with a real cogging monster. Unfortunately, my experiments stopped right at the start, since I cannot move the motor to the sensor zero position. The cogging is so strong that it always jumps over this, by >100 pulses. Of course, I can “virtually” move my zero position by just adding a offset to the sensor count, but this behaviour raised the question for me, if the sensor alignment of simpleFOC is reliable for such motors. Looking at the code, all it does is to move to the electrical zero and then read the sensor position. This of course will work since the the move will always be to the same position, but is this position really the electrical zero or is it heavily biased by the cogging?

For the fun of it, here is a chart position vs. time for three full sensor rotations (counter clockwise). It seems that with decreasing el. angle, the motor moves less than expected and then, at a certain point it jumps.

BTW: STMViewer is a pretty cool tool to create such charts without interfering with the motor timing!

Nice tool :stuck_out_tongue_winking_eye:

Can you maybe try this ?

I am still trying to understand how much of it is due to the cogging and how much due to the deadtime.

To experiment with such things as your deadtime compensation was exactly the reason for setting up the test rig. What i experience here is definitely cogging however. You can also feel it with the unpowered motor. Also, I dud not expect it to be any better, but my concern is more general, that for motors with such strong cogging, the angle alignment might be off.

What I forgot to mention above: It is all very low level open loop.

What motor is it ? I need to get myself a coggy motor.
The hoverboard motor have 15 pole pairs so you don’t feel it too much.

It is an ACT BLF42BLF03. It also has strong BEMF and killed some of my driver boards before I understood things well enough.

Sorry you mentioned it in the first post but when I googled it it wasn’t returning anything.

Sorry, my mistake. It is just ACT 42BLF03. The first mention was wrong, the second copy and paste…

1 Like

Actually I remembered I had this, it comes from a skateboard.

Although the waveform improves, it’s still very coggy even with the deadtime compensation.

Since I have very, very low cogging with other motors, I think the deadtime comp has also very little impact. With the motor above, you can see from the charts that it has very distinct cogging points. Effects if the waveform I would expect to be differently distributed. Still, I would like to try your work with a good motor and see if it further improves. There is always the hunt for making it better and it is pretty amazing, what hobbyists can achieve today!

On hoverboard motors I definitely hear less vibrations at low speed as there is less torque ripple. At high speed it shouldn’t make a difference anymore.

My main interest is that it will also help align the hall sensors better, exactly your point in this post.

I still need to work on this, I wanted to correct the amplitude of the waveform but it’s doesn’t work as I wanted. I assume this will also help measure the KV rating better.

One doubt.
You use an encoder, but you are not sure your electrical zero is correct because of the cogging.

Is it possible to do the opposite ? Use closed loop angle to zero sensor angle, and check what electrical angle is applied ?

That‘s more or less how I came to my doubts. I cannot move to sensor zero, because the motor jumps over that position by >100 pulses.

I have never used position control, so I must be saying something wrong.
But I thought that was the point of the cogging map.
Commanding a position in closed loop and checking how much q axis has to be applied to stay there.

And sorry, another doubt.
Wouldn’t sensor align work with higher voltage ? Maybe higher voltage + deadtime compensation ?

In order to create that map, I first need to calibrate the sensor and I need an absolute zero positon. For my case, I can just define any other position as zero, so that’s not the real problem. My concern is more the default electrical angle. Most people will use a very low voltage for the sensor alignment and the result may be completely off, depending on the alignment of motor and sensor, but I am not sure of that, hence just doubt…

I have a motor on my desk with 3PP. It also has quite high inertia due to attached weights, but the setup has low friction.
The result with the alignment procedure is a very high amount of oscillation, as the motor is snapped towards the zero position but massively overshoots due to inertia, low friction and generally low power of the motor.
The motor perhaps doesn’t settle in time, resulting in a non-optimal zero angle.

So I’m also thinking about a more intelligent alignment procedure, but its not that easy to come up with a general concept.

One thing that might be worth it is to separate the alignment for encoder and hall sensors if possible, I think it could be very different for both.

Maybe a noob-idea, but the cogging has valleys and peaks. So far you are trying to find the peak.
Why not look for the valley and calculate the offset-angle? You know the peaks are spread evenly, based on the PP-count.
Just have to figure out which peak is CW or CCW from the valley.

That‘s exactly my solution right now, but it comes with a very big „but“:

  • I manually pick the offset and can place it exactly where i don‘t expect any jumps. A general solution would need to perform that automatically. This is not very difficult, but time consuming (detecting jumps is easy, then try iteratively different offsets).

  • This only solves the alignment of sensor and motor, but is the electrical zero angle really the true zero, if it is impacted by cogging? That was my real initial question and it is still unanswered. I simply don‘t know enough about motor physics (virtually nothing).

I’m talking about the zero-finding procedure… not really specific to the cogging problem.

The tools available are:

  • a sensor, currently un-aligned to the rotor, but useful for delta measurements and velocity
  • open-loop driving of the motor
  • the rotor’s magnetic field of the permanent magnets, which will align itself to the stator field

Assumptions we can make are:

  • the motor is unloaded, and does not have significant friction
  • the motor is free to move, also trough multiple rotations
  • operating conditions such as power supply voltage are constant throughout the calibration procedure

My thoughts are currently along the lines of running the motor in open loop mode, slowly, and stopping it each time it crosses an electrical zero. Use a “homing” procedure around that zero and then move to the next one. Repeat this for 2-3 revolutions, and average the results to get a good value for the electrical zero.