PWM Deadtime compensation

Anybody interested in giving this a try ?
It should already give good results in openloop at slow speed/low load.
I just want to make sure I am not fighting with a problem only I have with my setup.

I can summarize what I did so far.

I declared a global variable for deadtime compensation so I can update it and observe the waveform.

float dtcomp = 0;

Here I added the code for the deadtime compensation.

if (dtcomp > 0){
  center = driver->voltage_limit/2;
  Ua += (Ua > center ? 1:-1) * dtcomp;
  Ub += (Ub > center ? 1:-1) * dtcomp;
  Uc += (Uc > center ? 1:-1) * dtcomp;
}
// set the voltages in driver
driver->setPwm(Ua, Ub, Uc);

Here, I compensate the voltage command so that the amplitude is same with or without the deadtime compensation.

if (dtcomp > 0 && abs(dtcomp) > abs(Uq)) Uq -= _sign(Uq) * dtcomp; 

I ended up compensating for 0.70V, which in my case is almost the power supply voltage * Deadtime% * 2.
I am not sure if it’s a coincidence, based on this paper I am compensating both for the deadtime and the stiction.

A supplementary test using a current
sensor and the torque sensor on motor M4 found that, while
current production starts at d = 0.071, external torque is not
felt until d = 0.083. This indicates that the deadtime ddt =
0.071 is the deadtime duty cycle for this motor driver and the
stiction is dst = 0.012 or Vst = 60 mV at the tested location

I want to experiment by checking at what minimum pwm duty cycle the current starts flowing, and at what minimum pwm duty cycle movement is visible. I think this could even be measured by software.

This method is not taking all the ripple/cogging sources as does the anticogging map mentioned in the paper, but can probably already give good results with little tuning without an encoder.

@runger I believe this thread was created because of the deadtime compensation discussions, but please feel free to move my posts to a new thread if you think it doesn’t belong here, because I have more bla bla and screenshots coming :rofl: Thanks in advance