I am designing my own FOC (field oriented control) system, and I am trying to implement sensorless control. I have successfully implemented sensored FOC with my system on two different motors using custom magnetic encoders. I decided to implement the sensorless position estimator described in this paper as a starting point:


The observer is described in equation (9) of the paper, and is computed directly using motor current measurements, and pre-computed motor constants. I'm restating it here:

\$\dot{\hat{x}}= y_{12} + \frac{\gamma}{2}(\hat{x}-Li_{\alpha,\beta})(\Phi^2- |\hat{x} - Li_{\alpha,\beta}|^2 \$

Where \$\gamma\$ is the controller gain, \$y_{12} \, , \, i_{\alpha,\beta}\$ are measured and \$ L, \Phi\$ are motor constants. I approximate the state variable \$\hat{x}\$ by estimating the integral of the observer output:

\$ \hat{x} \approx \sum{\dot{\hat{x}}}\ dt\$

Where dt is the time between concurrent calls of the observer. The variable \$\hat{x}\$ is defined as:

\$ x = Li_{\alpha,\beta} + \Phi \begin{bmatrix} \cos\theta \\ \sin\theta \end{bmatrix} \$

Which means that the encoder position \$\theta\$ can be finally computed from \$\hat{x}\$:

\$ \theta = atan2( x_2 - Li_{\beta} \, , \, x_1 - Li_{\alpha}) \$

I am able to run the observer while commuting my motor using the encoder, and print the observer and encoder theta in matlab (shown below). The observer seems to track the motor position fairly well, but when I start using the observer position after a few seconds of using the encoder, my motor starts vibrating in place/stops spinning. I've simulated the same observer in matlab/simulink and got results good enough to use the simulated observer theta for commutation.

I've also tried introducing errors in the same range (.1-.3 radians) to my encoder and it isn't enough to stop motor commutation. I've tried tuning the observer gain, but so far I haven't been able to get better tracking than what is depicted in the image below.

I'm running this on an STM32F0 microcontroller, and using the DRV8323 for mosfet gate driving and current shunt amplification.

It seems to me that the observer theta should be good enough to use for commutation, but in practice it is not. How should I approach solving this issue?

enter image description here

Edit: updated the plot with a slower motor speed for readability (motor speed is approximately 5Hz), and added error.

  • \$\begingroup\$ "FOC" was used but not defined. \$\endgroup\$ – Olin Lathrop Jul 12 '18 at 21:29
  • 1
    \$\begingroup\$ Field Oriented Control ...in other words no external position indicators, just using the back EMF from the motor. Typically done by driving two phases on a BLDC and 'listening' to one for positional feedback: ti.com/lit/an/spra588/spra588.pdf \$\endgroup\$ – Jack Creasey Jul 12 '18 at 21:37
  • 1
    \$\begingroup\$ @JackCreasey Not exactly. What you describe is the "sensorless" thing. FOC by itself is about generating continuously rotating magnetic field by controlling two orthogonal current components. \$\endgroup\$ – Eugene Sh. Jul 12 '18 at 21:41
  • 2
    \$\begingroup\$ @JackCreasey in FOC, all 3 phases are energized continuously. Position sensing using the bemf of an un-energized phase is not possible. I believe some types of observers estimate bemf (Luenberger-type) \$\endgroup\$ – Ocanath Jul 12 '18 at 21:47
  • \$\begingroup\$ The only way I understand you can do this while driving all three phases is to sense the current waveform and from this extrapolate the BEMF. \$\endgroup\$ – Jack Creasey Jul 12 '18 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.