Why High velocity noise while angle is fixed?

I finally got some hardware to play with. I have some success and something I can’t figure out

Hardware setup

  1. Arduino Uno
  2. FOC Mini Shield
  3. gimbal motor (12N, 14P, 5.6 ohm, 1A)
  4. AS5600 magnetic sensor
  5. 12V power supply

What works

  1. Open loop works well the motor turns smoothly up to about 40 rad/sec.

  2. The magnetic sensor demo in examples/utilities works sort of. I turn the motor by hand and the position updates from 0.0 to 3.14 with a half revolution. It goes back to zero when I turn it back. It seems accurate. Does the direction matter? While looking at the top of the as5600 sensor chip, numbers get larger when I turn it right.

  3. while the position stays dead-on and does not jump around, the velocity mostly reads out a stream o zeros except every 10 or 12 times I see big velocity errors of +1.1 or -1.1 then back to zero velocity. How can it compute != 0 velocity while the position is fixed with no noise out to two decimal places?

  4. While open loop motion works well, FOC is completely non-functional. The motor oscillates very fast over about 5 to 10 degree and with a regular pattern. I think it might have to do with the wrong velocity numbers pointed out above.

Here is a list of (angle, velocity) pairs the example program printed. The 0.04 is “good” it tracks the motor if I turn it by hand at 2*pi per revolution

angle velocity
0.04 0.00
0.04 -1.11
0.04 1.05
0.04 0.00
0.04 0.00
0.04 0.00
0.04 -1.12
0.04 1.06
0.04 0.00
0.04 0.00
0.04 0.00
0.04 0.00
0.04 0.00
0.04 -1.11
0.04 0.00
0.04 0.00
0.04 1.11
0.04 0.00
0.04 -1.11
0.04 1.06
0.04 -1.08
0.04 0.00
0.04 0.00
0.04 0.00
0.04 1.11
0.04 0.00
0.04 -1.11
0.04 1.06
0.04 -1.

Awesome :sunglasses: you’ll get faster speeds on a faster MCU, most likely… unless you’re at the motor’s limit.

No, and if you care about the way the motor is turning (due to the application, normally you care) you can flip it in software if it’s the wrong way round… or you can switch any 2 of your phase wires to flip it in hardware :slightly_smiling_face:

Because it computes with the full precision of a float value, not just the 2 printed decimal places… so if you investigate more you’ll find there was a small difference in sensor reading, which can become a potentially large velocity due to the short time interval between readings…

The source of the angle change can be motor vibration and or sensor noise. AS5600 is not a good sensor, the lower bit often isn’t completely steady.

Certainly sensor noise can lead to less stable control, but which mode are you using? You should try torque voltage mode first, and make sure the closed loop control is working in principle. Then try the velocity mode and tune the PID and LPF…

Thanks, I’m new to BLDC motors and FOC. However, I do have experience with motion control. I’ve done what you suggested.

I have the motor running in torque mode with no current sensing. Using the docs, I have velocity PID and then angle PID running, and I can command the motor to a given angle. There is a 100 mm lever on the motor shaft, so I can see the angle and measure torque. The lever also provides some mass to make testing “real”.

Problem: When at the target angle, the sensor noise makes the controller “think” constant corrections are required and the motor shakes and rattles unacceptably at low audio frequency range.

If I displace the arm then the error is all on one side and the shaking stops and there is a constant torque trying to move to the target angle.

When it gets to the target angle, the loud vibration starts. This is not PID oscillation from a too-large “P”, it is random buzzing noise, because the PID is tracking noise in the sensor.

To make this work at all, I had to use a very high “Velocity.I” value and a lower “Velocity.P” This acts a little like a low-pass filter.

Is there a filter I can use?

(I have an idea for a technical fix, I will start a new thread in “development” and ask if it could work.)

Yes, there is a simple low pass filter for the velocity, you can set it like motor.LPF_velocity.Tf = 0.01;

Of course you’re trading the noise reduction for a bandwidth reduction of the system, which due to the slow speed of I2C is already very low… but you probably know more about this than me. :slight_smile:

To replay to my own question. The RS5600 has a register you can read that gives the strength of the magnetic field. I added code to read this and found the field strength was marginal. This is with a ~2 mm air gap. I reduce the air gap to about 0.5mm and the sensor performs better. The magnets seem powerful for their size. But are only 4mm diameter by 1.5 mm thick.

When I get this system into production, I’ll have to add a field strength check some place in setup.

But STILL, I should be tossing out outlier data from the sensor. Any data that implies impossible physical motion should not be used.

1 Like