Skip to content
Snippets Groups Projects
Select Git revision
  • master default
1 result

atkbldcdriver

  • Clone with SSH
  • Clone with HTTPS
  • Jake Read's avatar
    Jake Read authored
    2b91907d
    History

    MachineKit BLDC Driver

    See: Circuit Development, and Code Development

    Background, Motivation

    This project is largely a follow-on to my Teensy-Powered Brushless Motor Controller, and with this new work, may the TESC project RIP. A moment of silence.

    TESC, April 2016 - August 2016
    As the world turns,
    so did those motors.
    Once around is never enough

    Eulagies aside, I am still motivated to do this. Brushless motors are the go-to motive force for electromechanical systems. By that I mean that just about any time you see a robot-like thing, or machine, moving about, there's a big likelihood that the thing doing-the-moving has a brushless motor in it's guts - or some variant thereof (stepper motors count as BLDCs in my books). See this characterization of actuators to get a sense for why.

    An Overview of BLDC Drive

    Electric Motors actuate with a rotating a magnetic field.

    In relation to Ashby's fundamental actuator types, brushless or brushed electric motors are effectively continuously-rotating solenoids.

    We have something with magnets, and something else with electromagnets, we use the electromagnets to rotate the field, we pull the magnets along. Rotating the field is called Commutating the motor, and can be done mechanically or electrically. With mechanical commutation, we have Brushed DC Motors, with electrical, Brushless DC Motors.

    dc

    Brushed Motors rotate the magnetic field using 'brushes'

    Brushes are mechanical switches that use the motor's own rotation to change the magnetic field. Super neat. Here's a link to Sparkfun's explanation.

    And a GIF. While the rotor rotates, different switches are connected to current, and the coils - to - pads relationship is set up such that the current will cause the motor to rotate. Pardon my abbreviated explanation.

    brushed-dc

    Brushes make motors very simple. You just pump voltage (in time, current) through the rotor, and things happen. However, there are resistive losses at the brushes, as well as friction losses.

    Brushless Motors rotate the magnetic field with switches.

    Power transistor technology means that we can do this electronically - use a computer (or simple timer) to switch the phases.

    So we can make the coils stationary, and 'artificially' switch the direction and timing of current flowing through them.

    Here's an example of '6-step' commutation. This is incredibly common for speed control, and simpler devices, as it requires very little processor work. It can also be done in an open-loop fashion, where we blindly switch currents at a set rate to control for speed.

    bldc

    Here's a nice GIF of sinusoidal commutation (where phase currents follow a nice, smooth wave). This is more ideal than 6-step commutation for a number of reasons, some of which are discussed in the next section. Mostly, we get to use more of each coil (we have all three on simultaneously) and we have finer control over the magnetic vector.

    bldc-animation

    We can see the three current vectors (that translate into a combined magnetic field vector). The permanent magnetic field of the rotor follows this electromagnetic field around.

    Digikey has a nice article on sinusoid control here.

    Control

    Control of Brushed DC motors is straightforward, we use one Full H-Bridge to drive current in both directions across the coils.

    dc-schematic

    However, a brushless motor requires a bit more thinking. We use three Half H-Bridges to source and sink current between the three coils, each having a common connnection to one another.

    simple-bldc

    Gate Driving

    Driving those Half-Bridges also requires a bit of doing, and gets us into some intricacies of MOSFET selection and, well, gate driving. Namely, MOSFETS have 'gate charge' - a set charge we have to drive into the gate pin before the fet turns on. If you look at the mosfet datasheet from the FET I'm using in this circuit, you'll find the fets have a gate charge of 36nC. We have to drive this charge into the gate every time we turn it on, and we're doing so at 20kHZ or more. This adds up. While we can get away with driving a low-side MOSFET right out of a microcontroller pin, we might be limited at how fast we can do so due to that current. And we can't even begin to switch the high-side MOSFET with a microcontroller pin, as the V_gs (voltage between the gate and source) is above our source voltage, since in the case of a high-side fet, the source is our motor voltage.

    We can also use a P-doped fet on the high side, simplifying gate drive. See this schematic for an example of that scheme.

    Commutation Schemes

    While it's possible to blindly drive the switches at a set frequency (determining rotor speed) it's really advantageous to drive the coils with some form of feedback on the rotor's relative electric position. There are a few ways to do so.

    Hall Effect Sensors & Six Step

    Hall effect sensors measure the position of the rotor's magnets:

    hall

    This is a straightforward and very popular method for commutation, and is always useful information, but only completely effective for motor control schemes using 6-step commutation.

    Back EMF & Six Step

    Hall sensors add complexity, so Back EMF has become popular, although it doesn't work at lower velocities.

    With Back EMF, we take advantage of the fact that at any given time one of the coils is not being driven. This means that we can measure it's voltage (it's acting like a generator) and use the zero-crossing point (when that voltage is 1/2 of the voltage driving the other two phases) to inform our commutation (which should happen shortly thereafter.

    bemf

    Because we're driving the other two ends of the coil whose voltage we're measuring with a PWM signal, there's some complexity here. I won't get into it, now, but for jumping off try this or this.

    Field Oriented Control

    aka FOC

    This is 'modern' motor control, and represents the state of the art. FOC uses a good deal of embedded computing, and has a control schematic that looks like this:

    foc

    We use rotor position to drive a sinusoid of phase currents, and do control over those currents to overcome inductive lag.

    Normally, position information comes from an encoder, but Sensorless FOC exists where a state estimator is used to guess at the rotor position.

    In order to jump off here, try this, a brief overview, and this, a monster, from TI, on sensorless FOC.

    Circuits

    A number of brushless motor controllers are available in the open-source world:

    ODrive
    VESC
    Ben Katz
    MKBLDCDriver

    Here's the schematic that I'm most familiar with:

    schematic

    And the board,

    mkbldc

    In each of these boards, we find a microcontroller, a gate driver, three half-bridges (6 MOSFETS), and current and voltage sensing circuitry. And a few BFCs never hurt.

    Typically Available:

    For motors, I am deeply in love with Hobbyking.

    'Outrunner' Motors (rotor wraps stator) are popularized by drone enthusiasts and have fairly high torque densities due to an increased gap radius.

    outrunners

    pancake
    here

    Inrunners (rotor inside stator) are great for speed. Typical Inrunner

    To control these, look here to start, but preferrably pick up one of the open-source ESC's mentioned above - or try building your own. With off the shelf ESCs, open loop speed control is the only thing you can do.

    The State of the Art

    The design of BLDCs is not changing radically - it's a good idea, and it works.

    There is one exception to this - Thingap Motors use an ironless winding (patent here) and have relatively high torque densities. The performance is impressive but they cost ~1k at the low end.

    What is interesting is where BLDCs are being used, controlled, and how they are being designed (shape, new densities). Take a look at The Biomimetics Lab at MIT's discussion on optimizing gap radius, etc.

    mit-cheetah

    The MIT Cheetah team had their motors custom made to optimize for torque density (at a cost of total power density). Their discussion is really interesting, you can read This Paper, a great intro to the state of the art in robotic control, of which Brushless Motors and their cousins play a large role.

    As well, Ben Katz' thesis contains an excellent review, and more intelligent discussion, on FOC, motor selection, etc.

    And Simon Galouche's thesis contains a similar review on actuator selection for robotics.