Hey,
I'm trying to control a brushless gimbal motor with a l6234 three phase motor driver and my arduino.
It is important to note that gimbal motors are not like normal brushless motors. In contrast to the normal brushless motors, they use thin wire and many winding for the coils giving them high impedance and high torque. Therefore no feedback (sensors/back emf) is needed as the motor will be used more like an actuator.
So I did a lot of research about BLDC (and I couldn't find much information), but eventually I found out, that those motors are normally driven by three sine waves shifted by 120°.
In order to do this I generated an array with 256 entries containing the values which are depicted in the image above as "Phase A". The other two phases are simply the first phase shifted by 85 and 170 steps, respectively.
The L6234 has three IN pins and three EN pins. The IN pins controls whether the upper or the lower DMOS of the corresponding half bridge is activated and the EN pin turns the whole phase on or off. So to archieve the waveform shown in the diagram above, I need to use a pwm signal with the current value from the array on the EN pins and turn the IN pins on when the graph is above zero and off when it is below zero.
int stepA = 0;
int stepB = 85;
int stepC = 170;
void loop(){
if(sin_array[stepA] < 0){ //if current value is below zero
digitalWrite(L6234_IN1, LOW); //turn lower DMOS on (upper off)
analogWrite(L6234_EN1, -sin_array[stepA]); //pwm, but with positive value
}
if(sin_array[stepA] > 0){ //if current value is greater than zero
digitalWrite(L6234_IN1, HIGH); //turn upper DMOS on
analogWrite(L6234_EN1, sin_array[stepA]); //pwm
}
if(sin_array[stepB] < 0){ //if current value is below zero
digitalWrite(L6234_IN2, LOW); //turn lower DMOS on (upper off)
analogWrite(L6234_EN2, -sin_array[stepB]); //pwm, but with positive value
}
if(sin_array[stepB] > 0){ //if current value is greater than zero
digitalWrite(L6234_IN2, HIGH); //turn upperDMOS on
analogWrite(L6234_EN2, sin_array[stepB]); //pwm
}
if(sin_array[stepC] < 0){ //if current value is below zero
digitalWrite(L6234_IN2, LOW); //turn lower DMOS on (upper off)
analogWrite(L6234_EN2, -sin_array[stepC]); //pwm, but with positive value
}
if(sin_array[stepC] > 0){ //if current value is greater than zero
digitalWrite(L6234_IN3, HIGH); //turn upperDMOS on
analogWrite(L6234_EN3, sin_array[stepC]); //pwm
}
int value= analogRead(A0)/4;
stepA= value;
stepB= value+ 85;
stepC= value+ 170;
if(stepB >= 256) mstep_b -= 256;
if(stepC >= 256) mstep_c -= 256;
}
This is the main loop of a sketch I wrote to control the motor with a poti. When I start turning the poti the motor turns proportionally, but after like 20 steps it stops turning for a while (like 40 steps) and then start turning again. This behaviour continues all the way to the end.
My problem is that I have no idea where this behaviour is coming from, but I really need to move the motor in a linear way. I tried to use a trapezoidal waveform instead of a sinusoidal one. This seems to increase the torque of the motor, but is doesn't help concerning my problem.
What am I doing wrong?
Hoping for answers,
Josua