# How to Implement this BEMF Observer

I'm using the lecture by Dave Wilson at TI to implement a BEMF observer.

I have the motor winding currents for phase A, B and C.

I also have the Bus Voltage

I also am in the stationary reference frame (I did the Forward Clark Transform), so I have Alpha and Beta.

I've also measured the winding resistance and inductance for each phase.

So, the idea is that you make a mathematical model of the motor, using an RL series circuit with a voltage source (which exists as the BEMF generated by the windings when you're driving the motor). Then, you observe the voltage and currents directly (since my hardware allows for direct measurement of those two parameters). Then, I'm supposed to sum the estimate of where the current vector should be and the actual observation of where the current is...This difference is an error signal that's fed through a PI controller, then inverted to create negative feedback, and is then fed back into the modeled motor...This signal MUST be the BEMF voltage vector, assuming that the other two components (the resistance and inductance) of the motor windings are correct.

Anyway, here's a block diagram of what it's supposed to be doing:

Where i'm getting into a jam is how to get the the exponential terms into my code.

Here's a snippet of the function that get's called to try and implement this...It get's called after every ADC conversion, which happens each time the mid point of the drive signal (~16kHz, although Dave's slides shows a 10kHz carrier...It doesn't matter).

How do I get the LPF into this code? I've got the operating frequency and I have the inductance, so that means I've got the reactance...But, I'm not sure if this is something I can just hard code in, or if there's more to it than that to stay robust and future proof.

void Current_Observer(motor *c)
{
uint16_t current_observer_p = 10;
uint16_t current_observer_i = 10;

uint16_t winding_voltage_estimate = (BUS_VOLTAGE + c->bemf_estimate)/MOTOR_RESISTANCE;
winding_voltage_estimate = ??????LOW PASS FILTER GOES HERE ?????;

winding_voltage_error = winding_voltage_estimate + c->motor_current;

///BEGIN PI CONTROL
c->bemf_error= current_observer_p * c->bemf_error;
c->bemf_error+= current_observer_i * c->bemf_error;

c->bemf_estimate += c->bemf_error;

}

• What seems odd is that 120Vac 60Hz is RMS, not peak voltage as shown. – Sunnyskyguy EE75 Jun 9 at 0:06
• I would ignore that... Those are from his slides, not my application. I've got a DC bus feeding the 3 half bridges on the motor windings. That seemed odd to me as well. – testname123 Jun 9 at 0:08
• enter link description here maybe this shows the code – Sunnyskyguy EE75 Jun 9 at 0:22