Showing results for 
Search instead for 
Did you mean: 

PSoC 4

New Contributor II

I'm using the Cypress KIT-037 to control a BLDC motor using the "Sensorless FOC Motor Control" example. The motor is running correctly.

I have seen that for the motor to turn in a different direction, a button can be pushed, which basically swaps 2 of the phases. This is the same as plugging the phases in a different order.

My question is, how can I use negative speed references in the control loop to have the motor running in the opposite direction?

I have been trying different approaches and PID seems to be causing trouble. I have even modified the i32_OutMin variable of the PID structure to a negative value. With a fake PID structure, I can see that the PID function can output negative values. Why doesn't it work when I use a negative speed reference value?

1 Solution

Hello Andres,

Your understanding is correct regarding the phase change. But changing just the output to negative will not serve the purpose.

PID source code might not be developed to take care of negative number.

If you are looking to change the speed based on the potentiometer, lets say you need to be at zero speed at potentiometer mid point and opposite speed at both end.

You can try changing the void Adc_MotorCurrentSense(void) function.

Here Motor_u8RunningDirection is used to vary the motor direction. You might be able to use the potentiometer position itself for determining the direction. (if the potentiometer value is less than half --> direction = CW, else direction = CCW)

This is just a vague idea and might needs to take care of many potential issues. Hope this helps.


Jobin GT

View solution in original post

1 Reply