Brushless Motor Direction control

Hi, i want to make my own version of brushless gimbal. For first step i want to know how to control brushless motor, especially for direction control. Is there any reference that i can learn?

i will use this motor:
http://www.rctimer.com/index.php?gOo=goods_details.dwt&goodsid=871&productname=

And i will use L6234D as a motor driver..

Thank You for your help..

That's a sensorless motor by the look of it, most ESCs are unidirectional (there is no way to cleanly reverse a sensorless motor
without stopping and re-starting it). The bulk of such motors power airscrews which only ever need to go one way.

However its worth looking for RC model car/truck ESCs to see if there's a reversing one for that application.

[ edit: Oh, that's a high-resistance motor - does it have hall-sensors then? ]

MarkT:
That's a sensorless motor by the look of it, most ESCs are unidirectional (there is no way to cleanly reverse a sensorless motor
without stopping and re-starting it). The bulk of such motors power airscrews which only ever need to go one way.

However its worth looking for RC model car/truck ESCs to see if there's a reversing one for that application.

[ edit: Oh, that's a high-resistance motor - does it have hall-sensors then? ]

Yes, the motor is sensorless. And for brushless gimbal system, i will use IMU as the sensor. This IMU will control the motor using close loop system, like this video:

There is an open source project about brushless gimbal:
https://code.google.com/p/brushless-gimbal/

But, I find it hard for understanding the concept and overall programming code. So I must to learn step by step, start from how to control Brushless Motor Direction..

The basic concept is that you're feeding the motor 3 phase AC power with each phase offset by 120 degrees (or 2/3 PI radians). Increase the frequency and the motor spins faster; stop the frequency and the motor stops, etc.

With the L2634 the control is via the IN1, IN2, IN3 inputs. It's basically three half bridges allowing each of the outputs to source or sink current. You have to analogWrite() to the inputs to get your smooth motion; analogWrite(pin, 0) makes the pin sink, analogWrite(pin, 128) is off, analogWrite(pin, 255) is source. So -- going out on a limb here with totally untested code -- for a smooth movement between two poles of the motor:

for (x = 0; x < 2 * M_PI; x += speed) {
  analogWrite(IN1, 128 + 128 * sin(x));
  analogWrite(IN2, 128 + 128 * sin(x + 2/3 * M_PI));
  analogWrite(IN3, 128 + 128 * sin(x + 4/3 * M_PI));
  delay(100);
}

Is that right? My trigonometry is horrible. :disappointed_relieved:

Chagrin:
The basic concept is that you're feeding the motor 3 phase AC power with each phase offset by 120 degrees (or 2/3 PI radians). Increase the frequency and the motor spins faster; stop the frequency and the motor stops, etc.

With the L2634 the control is via the IN1, IN2, IN3 inputs. It's basically three half bridges allowing each of the outputs to source or sink current. You have to analogWrite() to the inputs to get your smooth motion; analogWrite(pin, 0) makes the pin sink, analogWrite(pin, 128) is off, analogWrite(pin, 255) is source. So -- going out on a limb here with totally untested code -- for a smooth movement between two poles of the motor:

for (x = 0; x < 2 * M_PI; x += speed) {

analogWrite(IN1, 128 + 128 * sin(x));
  analogWrite(IN2, 128 + 128 * sin(x + 2/3 * M_PI));
  analogWrite(IN3, 128 + 128 * sin(x + 4/3 * M_PI));
  delay(100);
}




Is that right? My trigonometry is *horrible*. :disappointed_relieved:

Great explanation Chagrin, but i stil wait my brushless motor and L6234D to come. I will try your code when they arrive..

Sine wave drive may not be optimal - depending on the magnet pole and stator shapes a rectangular or trapezoidal waveform may give more even torque - I'd recommend using a phase -> drive level lookup
table - you can then try out different waveforms trivially.

In the first instance straight trapezoidal is the easiest, either on or off, you can use PWM for speed
control.

MarkT:
Sine wave drive may not be optimal - depending on the magnet pole and stator shapes a rectangular or trapezoidal waveform may give more even torque - I'd recommend using a phase -> drive level lookup
table - you can then try out different waveforms trivially.

In the first instance straight trapezoidal is the easiest, either on or off, you can use PWM for speed
control.

What is the difference between use sine wave and trapezoid wave? Why sine wave may not be optimal?