Custom BLDC motor vibration

Hi everyone,

I’ve built a custom BLDC motor to go with a DRV8302 driver I’ve build recently (discussed here).

The new motor has 42 poles, 36 slots and aims for high torque at low speeds. 26 AWG (0.4mm diameter) enamled copper wire was used to wind up the stator. Turned out like this:

It rotates quite decently, if it weren’t for the vibrations. Video ilustration:

I would like to ask if anyone has faced similar problems and knows how to resolve them or at least what to tinker with :D.

Things I have already tried:

  • Increasing the driver.voltage_limit
  • changing motor.PID_velocity constants (primarily disabling I and D)
  • lowering and increasing motor.target velocity (velocity controller)

Attaching used code for completeness:

#include <SimpleFOC.h>

// MANUALLY GROUNDED -> M_OC, GAIN, DC_CAL
// MANUALLY PULLED HIGH -> OC_ADJ (needes to be remade in final design)

// --- ENCODER ---
MagneticSensorI2C sensor(AS5600_I2C);

// --- DRIVER ---
#define INH_A 6
#define INH_B 5
#define INH_C 3
#define ENABLE A3

#define M_PWM 4

BLDCDriver3PWM driver(INH_A, INH_B, INH_C, ENABLE);

// --- CURRENT SENSING ---
// skip for now

// --- BLDC MOTOR ---
#define POLE_PARIS 21
#define KV 100
#define PHASE_RESISTANCE 5.0f

BLDCMotor motor(POLE_PARIS);

void setup()
{
  Serial.begin(115200);

  sensor.init();
  motor.linkSensor(&sensor);

  // external driver setup
  pinMode(M_PWM, OUTPUT);
  digitalWrite(M_PWM, HIGH); // set 3-pwm mode
  
  // set driver voltage
  driver.voltage_power_supply = 20.0f;
  driver.voltage_limit = 2.0f;

  driver.init();
  motor.linkDriver(&driver);

  motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
  motor.controller = MotionControlType::velocity;
  motor.voltage_sensor_align = 0.5f;

  motor.useMonitoring(Serial);

  motor.PID_velocity

  motor.init();
  motor.initFOC();

  // set desired speed
  motor.target = 1.0f;
}

void loop()
{
  motor.loopFOC();

  // move at the desired speed
  motor.move();
}

Final side note: I’m aware that a lot of mistakes may arise from the motor not being wound up evenly or some of the magnets being slightly stronger/weaker than others, but the motor seems to rotate very fluently during the sensor align phase. Are there any reasons why this might be?

Thanks for your time and help!

Papouc

1 Like

You are doing a few things wrong.

driver.voltage_limit = 2.0f;

Don’t limit the driver voltage.

You can limit the motor voltage until you are sure your setup is working well (I think it’s 12v by default if you don’t set it)

motor.voltage_limit = 2.0f;

Don’t use velocity mode for now.

I think now the waveform is being clipped so it’s not sinusoidal:

Torque mode also uses the sensor, so it’s probably only a matter of PID tuning now.

That’s pretty awesome, you must have a lot of patience.

Cheers,
Valentine

I’m more concerned about the missing flux-ring around the magnets… at least I don’t see any?

Maybe in torque mode it runs smooth, but did you apply any load to it?

It should still be usable without flux ring, just about 40% less torque than it would have with it. Iron rings are pretty impractical to make yourself, so the usual solution for 3D printed motors is a halbach array, which is about 5% less torque than a flux ring according to the simulations here.

The steel stator core is a huge improvement over most 3D printed motors. It should be great if you can find suitable size magnets for halbach.

My guess:

  1. Poor quality magnets. Each magnet has different magnetization. Very common with cheap chinese magnets.
  2. Winding non-homogenous. Manual winding creates differences in the magnetic field strength due to rather messy shape of wires.
  3. Stator lamination inconsistencies. Not sure what you used for stator lamination, but manually or custom made stators suffer from non-homogenous issues, too. I see you used pre-made ones, so may be there is some factory inconsistency?
  4. Missed / over windings on some poles. You may have mis-counted the number of windings on some poles, and the magnetic field is stronger or weaker there.
  5. Inconsistencies in the stator/magnet gap. The 3d plastic is slightly deformed and that leads to magnetic strength deformity.

Cheers,
Valentine

Such hardware issue would explain it. But if it is caused by one of your suggestions (quite accurate by the way, magnets are truly very cheap and chinese :smiley:) it wouldn’t be dependent on the zero_elec_angle, right?

Maybe I am missing something entirely, but the deceleration is getting very subtle with lower zero_elec_angle values (around 3.7 already feels very OK). Shouldn’t this value always be the same (I mean around the same)?

The only relation I can see is that the inconsistent properties of the motor affect this value, since the motor always starts .init() method in different position, thus in differently strong magnetic array.

Hi, thanks for the tips!

Motor truly spins very fluently when switched to torque control mode (simplest voltage based torque controller) and the voltage limit is set only on the motor instance.

In that case a faulty winding or any other hardware problem is improbable. Am I right?

Is the problem more likely to be related to the magnetic sensor somehow? The sensor used is AS5600 connected via I2C interface. It seems to output pretty reasonable values based on some brief reading from the serial line.

Thanks,

Papouc

You mean it’s smooth in torque/voltage mode but noisy in velocity mode?

Yes, exactly. The rotation is jittery in velocity mode, but very smooth in torque/voltage mode.

Yeah, I am aware of that. I don’t really care about the torque capability so much at this point since this printed one is just a prototype. The plan is to get the rotor part machined from steel at PCBway or someone similar :D.

Not really, I am running it at very low voltage limit so the torque is miserable. When I go up with the limit it just starts to spin somewhat fast in torque mode (too fast in my opinion).

I’ll dive into the PID tuning when I get back from week at college.

Thanks for the advice!

Hi everyone,

had some time to tinker with the motor, PID tuning etc…

Unfortunately, I wasn’t able to resolve the issue. I narrowed it down to something related to the zero_elec_angle setting during init.

I am running the motor in torque mode and the behavior seems to vary every time I restart the arduino board in the driver. During debugging I discovered that the zero_elec_angle is always somwhere in the range of 3.5 to 4.8.

MOT: Align sensor.
MOT: sensor_direction==CW
MOT: PP check: OK!
MOT: Zero elec. angle: 4.25
MOT: No current sense.
MOT: Ready.
MOT: Monitor enabled!
MOT: Init
MOT: Enable driver.
MOT: Align sensor.
MOT: sensor_direction==CW
MOT: PP check: OK!
MOT: Zero elec. angle: 3.91
MOT: No current sense.
MOT: Ready.
MOT: Monitor enabled!
MOT: Init
MOT: Enable driver.
MOT: Align sensor.
MOT: sensor_direction==CW
MOT: PP check: OK!
MOT: Zero elec. angle: 4.63
MOT: No current sense.
MOT: Ready.
MOT: Monitor enabled!
MOT: Init
MOT: Enable driver.
MOT: Align sensor.
MOT: sensor_direction==CW
MOT: PP check: OK!
MOT: Zero elec. angle: 3.75
MOT: No current sense.
MOT: Ready.

Is this expected? I tried to change alignment, orientation and distance of the AS5600 sensor, but no luck there.

The rotor always accelerates and somewhat brakes in each revolution. Looks/sounds like this:

The lower the electrical angle is, the better the motor behaves (meaning less uneven acceleration and deceleration in one revolution).

Did anyone experience similar behavior?

Thanks!

wenn Motor wie bei Video nicht regelmäßig dreht in Zyklus von eine Umdrehung oft ist schuldig nicht genau zentrische Magnet auf Motorachse und nicht mittig Sensor zu Achse!