DIY Brushless Servo

Hello,
Thinking of developing a brushless motor controller to be used in a servo for robotics applications. I think I figured out most of the main parts needed: MCU, gate drivers if I want to use dual N-channel MOSFETs for the half bridges, the MOSFETs themselves, a control for measuring BEMF (would like to use sensorless motors), some overcurrent protection scheme.
I am not an electrical engineer, and I'm a bit lost in all of the available MCUs for this task. I want to get something so I can start prototyping on a breadboard, but don't know if an Atmega (perhaps one of of the Xmega series with high-resolution MCUs) will do or if I should get something more specialized for motor control. E.g. I know that the PWMs need to be fairly well-synchronized, (some MCUs state specifically in the specs that they have well-synced PWM channels), so will a regular general-purpose controller do?

I'd really appreciate some feedback. Thanks in advance.

Spend some time here...
http://openservo.org/

Spent more than a little time there, and developed my own brushed motor controller using the atmega 328P. That schematic they have is not directly transferable to a BLDC motor.

My intuition tells me I'll be ok with the Xmega, at least as a starter, but I wanted some expert advice if possible.

Older article but useful for showing some of what is in a standard analog servo. You might start your project using an arduino, a pot, and a bidirectional ESC to drive the motor. The basic servo "knob" example program might work for starting code.

http://www.seattlerobotics.org/encoder/200009/S3003C.html

For three-phase motors the ATtinyX61 family is a good choice.

https://www.google.com/search?q=BLDC+three+phase

The first two hits are from Atmel's website...

http://www.atmel.com/images/atmel-2596-sensor-based-control-of-three-phase-brushless-dc-motors_application-note_avr443.pdf
http://www.atmel.com/images/doc8012.pdf

Thanks, I'll start reading.

zoomkat:
Older article but useful for showing some of what is in a standard analog servo. You might start your project using an arduino, a pot, and a bidirectional ESC to drive the motor. The basic servo "knob" example program might work for starting code.

I think that is a little too simplistic as a starting point, using an ESC and the "knob" I'm pretty sure I can manage.

I'm not sure about the ATtiny X61 since these seem to have the I2C interface on 2 of the 6 total timer outputs, meaning my PWM will be limited to 4 if I want I2C communication (I do), falling short of 6 needed for the commutation. The application note is interesting (I also found a bunch of those) but is for sensored systems, I'm trying to go for a sensorless design.

Right now I'm leaning to using a companion gate driver chip such as the TI DRV8301 or the Microchip MCP8024 along with the MCU, and Fairchild FDMS7650DC dual n-channel power MOSFETs for the triple h-bridges, which will give me the ability to work with up to about 6S LiPoly power sources no problem. Using one of the AVRs would be a huge boon at least to start, since it would let me develop using an IDE I know already, I'm just not sure it'll work well.

I'm thinking I might try using a spare 328P I have lying around and getting all the other components together in the meantime, the downside is I'll need to design a PCB prototype board for all my non-through-hole components.

anvoice:
I'm not sure about the ATtiny X61 since these seem to have the I2C interface on 2 of the 6 total timer outputs...

PA0 (ADC0/DI/SDA/PCINT0)

...no PWM on that pin.

PA1 (ADC1/DO/PCINT1)

...no PWM on that pin.

Spend more time with the datasheet.

anvoice:
The application note is interesting (I also found a bunch of those) but is for sensored systems, I'm trying to go for a sensorless design.

Uh huh. Maybe you should at least glance at the document titles before embarrassing yourself further...

AVR444: Sensorless control of 3-phase brushless DC motors

I was talking about the first one, "Sensor-based Control of Three Phase", didn't get a chance to read the second one yet.

Thank you for your input everyone.

I decided for now to go with a ATXMEGA32E5-AUR for its 12-bit ADC and other features for motor control. I'll probably start planning out the board soon, if anyone is interested I can keep this updated.

Thanks for your help.

anvoice:
if anyone is interested I can keep this updated.

Excellent. Please do.

So parts should be arriving soon, and I can start assembling some of the circuit. I have a couple of questions for anyone with background in this type of design:

  1. Per-phase current sensing: is there any real use? I notice some schematics measure the current across each phase independently, which of course complicates design. Even if I need to know the current for something like overcurrent protection, why not use a single sensing resistor?

  2. I understand that the BEMF is measured separately from the current using something like a voltage divider/low-pass filter connected to 3 of the ADC channels, but I had trouble finding example schematics of that arrangement, most are greatly simplified and don't have all the elements presented. If anyone has any example schematics, would be glad to see them.

I'm basically reverse engineering this as I go along, so any help would be greatly appreciated.

As I learned in another thread, brushless DC motors can be controlled by mere digital signals, no DACs required. The motor current can be measured in the common supply branch. The only (and reasonable) requirement is a BLDC motor with sensors, summing up into 6 wires out of the motor. Search for "brushless dc motor diver chip" for a couple of links.

DrDiettrich:
As I learned in another thread, brushless DC motors can be controlled by mere digital signals, no DACs required. The motor current can be measured in the common supply branch. The only (and reasonable) requirement is a BLDC motor with sensors, summing up into 6 wires out of the motor. Search for "brushless dc motor diver chip" for a couple of links.

Thanks for the advice. I know I don't need a DAC, just some PWM signals. The trick is to measure the BEMF (here I need an ADC and to properly set up the signals), I'm trying to go sensorless (cheaper, smaller motors).

The question about current sensing was because I saw some designs implement what looks like per-phase current sensing, i.e. sensing current in each individual path for some reason.

I already have a couple of driver chips on the way, so I'll start testing those soon.

Why do you need any kind of sensing at all? Drive the brushless motor like it's a stepper. That's how camera gimbals work. They don't have any current sensing. You have feedback from the output pot (or gyro in the gimbal example.)

You can't drive a BLDC without sensing the BEMF at least. The commutations rely on knowing the exact position of the rotor in regards to the stator, which needs either sensors or BEMF. The pot doesn't help because it gives no indication of rotor position vs stator.

The current might not be needed for most applications, unless you want overcurrent protection, in which case it is.

For servo type operations, you don't need to know the EMF or anything. If you energise one coil, the rotor will be attracted to that position. It may spin forwards or backwards, depending on which one is closer. Then you energise the next coil and it will step to that position. Micro steps can be used to get a smooth rotation by energising two coils at once in the right proportion.

The reason why you need sensors is if you're not stepping but trying to operate it as a continuous-rotation motor. For example a hub motor on a bicycle. From standstill, if the controller engergises one coil without knowing in advance where the rotor is, it may start rotating in reverse. That kind of application needs hall-effect sensors. For a brushless propeller on a quadcopter, you drive it with a specific amount of power but you don't know in advance how long it will take to reach the next pole and require the next coil to be energised. That application uses the EMF feedback to find out when the rotor is approaching the next coil so that it can be switched on at the correct time.

Fair enough, I've never heard of a BLDC running as a stepper. My guess is that won't provide very good torque performance, as the commutations will need to be done slowly enough for the rotor to stabilize at the right position every time. If that isn't true, I'd definitely be willing to at least try it.