Driving A Brushless DC Motor Sloooooooowly

circuit board

Driving a brushless DC (gimbal) motor can be a pain in the transistors. [Ignas] has written up a nice article not only explaining how to do just this with an Arduino, but also explaining a little bit on how the process works. He uses a L6234 Three Phase Motor Driver, but points out that there are other ways to interface the BLDC motor with the Arduino.

warningA warning is warranted – this is not for the faint of heart. You can easily destroy your microcontroller if you’re not careful. [Ignas] added several current limiting resistors and capacitors as advised in the application note (PDF warning) to keep things safe.

Everything worked well at high speeds, but for slower speeds the motor was choppy. [Ingus] solved this riddle by changing over to a sine wave to drive the motor. Instead of making the Arduino calculate the wave, he used a look up table.

Be sure to check out his blog for full source and schematics. There is also a video demonstrating just how slow he can make the motor move below.

66 thoughts on “Driving A Brushless DC Motor Sloooooooowly

    1. Theoretically maximum possible torque. Motor is in “almost” stalled condition.
      On the other side, You even may want to reduce it by lowering supply voltage, as motor becomes hot after some time.

      1. Correct me if I’m wrong, as I am no expert and haven’t had the time to go through the whole project, but aren’t you changing speed by changing the duty of the PWM? If so, you are applying less effective voltage to the coils, and then you would have a lower speed AND torque.

        1. I’m not an expert also, just learning ;) But as I see – all point of this that you modulate PWM duty cycle by sine wave. And when You decrease the speed You don’t decrease duty cycle in each period of PWM (as in “normal” 6 step rectangular drive), but instead You just “stretch” modulating sine waves in time. Somebody can do math on which one results more power…

        2. BLDC motors are structurally similiar to stepper motors, and they are driven in the same fashion. There’s just less steps.

          The positioning between steps is done by changing the relative currents through adjacent poles, which changes the magnetic field orientation, which is to say you are “half-stepping” the motor. You apply various voltages to the coils (with PWM), which drives corresponding currents through them, which creates the appropriate magnetic field.

          You do lose holding torque when you’re doing that. To maintain torque you need a feedback system that monitors the position and applies a load-appropriate skew to the phase of the motor. i.e measures where the motor is and tries to advance the motor by the amount that creates the appropriate torque.

        3. A motor’s (yes as in generaslized) torque is simply determined by the current going into it. At low speed, the back EMF is low so the current can be reach easily. i.e. you get more torque.

          > [Ignas] added several current limiting resistors
          As same inductance/resistance, bigger voltage (because you have less back EMF) so it takes less time (less duty cycle) to reach a given current. They are current *sense* resistors. The firmware is the one that *limits* the current by lowering the PWM duty cycle to regulate/limit the current. Unlike the old days where you actually use current limiting resistors!

          See here for some basic background: http://www.edn.com/design/sensors/4406682/2/Brushless-DC-Motors—Part-I–Construction-and-Operating-Principles

          They also shows the Torque-Speed curve with max torque at stall. You want a Wye winding configuration for these type of operation. By driving with a sine wave, he has effectively turned it into a 3-phase synchronous motor. The precise phase angle control of the windings gives a smooth rotating magnetic field i.e. smooth rotation. The rotational inertia isn’t there to help you at low speeds.

  1. I did this last week except I used the HIP4086 and external transistors because I needed higher current. Other than that it almost identical. Torque wasn’t great on the little motor I had to test with (no position feedback), but I wasn’t building it as a normal motor drive.

      1. The torque is proportion to the coil current. However the windings are mostly inductive with a back end prooortional to the velocity. If the motor is stationary the back emf is 0 so one has to limit the average current to avoid overheating. However this current should be nearly constant over the operating range. The torque with maximum allowable control is nearly constant until the supply cannot overcome the back emf. The torque can be made constant up to this point. Then it drops with some critical speed.

        The result is the delivered power is linear up to this point ( constant torque times the speed). After this critical point the torque decreases proportional to 1/rpm. Then the delivered power is constant. At very high speeds the coil resistance becomes significant and the delivered power decreases abouve this point.

        This is one reason in some applications use bldc s. The delivered power is relatively constant over a large speed range. Most other motors have a constant torque over most of the useful speed range. In effect the bldc delivers constant power over a large range like a traditional motor would if a transmission was used to maximize delivered power.

  2. I’m curious. What is the advantage of using model airplane DC brushless motors for small camera gimbals versus small stepper motors? I’ve only recently gotten into UAVs and I’m more interested in the autonomous flight and navigation aspects of the hobby. Maybe at a later time…

    1. Nevermind. I forgot that Google was my friend. Apparently it has to do with power consumption as stepper keep the windings energized for holding torque.
      If this is wrong please correct me.

      1. It has very little to do with power consumption. A camera gimbal should be set up so that the assembly is very near balance to begin with, such that it is almost passively stabilized. These motors spin very freely and the controller only has provide a little “kick” in the direction that it needs. For the most part, you don’t want much holding torque at all. You also need smoothness; stoppers are way too jerky. With a BLDC motor and a good controller, not only can you easily control speed and direction, but also torque and slip.

        Also, to call these “brushless DC” motors is wrong. These are three phase AC motors; but that’s beside the point.

          1. Yes and no. There are both ac and dc brushless motors. AC brushless use ac move the motor, with bldc you use dc. The motors are pretty much the same, it is how you drive them.

        1. If these motors were fed an AC 3phase voltage then you would be right calling it an AC motor. But that is not what i being fed in 99% of the controllers. They are fed a DC voltage that is PWM-ed to limit the current and cut up into 3 phases. No effort is made to resemble a sinusoid; the angled sides of each pulse are caused by the motor itself. From the perspective of the controller all voltages are between zero and Vbat, so the the DC in BLDC makes sense.

          In this case it is mostly used as a (3phase) stepper motor: the driver measures/limits the current and generates a signal that resembles a BLDC signal. To increase resolution a lot of in-between steps are used, called microstepping. Microstepping in essence is creating a sinusoid signal.With microstepping you can increase the resolution of a pretty common 200steps/rev to 3200steps/rev, at the expense of precision: the steps in between have a lot less torque.

          1. Re-read your own message – you’re speaking about how the motor is driven, not the differences between this motor and a 3-phase motor (there are none).

            What you described could be also be called a 3-phase “modified sine wave inverter”, or an inverter that outputs pulses rather than sinusoids.

          2. The only real difference between a three phase stepper motor and a BLDC motor is the number of poles. Simple as that.

            Somebody might say, “but you can give a stepper motor continuous current to hold it in position, which you can’t do with a BLDC”. Well, you CAN do that with a BLDC motor as well – you just have to drive it with a low enough voltage that it won’t melt down. As [Jelle] says, nobody’s feeding these things AC, or even straight DC. They’re effectively supplying a low DC (or AC) voltage by reducing the duty cycle.

            And if you want to argue the semantics of what’s an AC motor and what’s DC, ALL motors have alternating current through either the stators or the armature when they’re rotating. In brushed motors, the DC->AC conversion is done by a mechanical commutator, and in brushless ones, electronic commutation is used.

        2. the distinction is usually that brushless DC motors are constructed to have a trapezoidal emf and be driven with the usual six-step sequence, three phase AC motors to have a sinusoidal emf and be driven with sine waves

          1. Not an expert on this, but I think the windings are done differently on motors meant to be driven by sine waves. And by “differently”, I mean the distribution of numbers of turns of wire across how many slots, if that makes any sense at all.

        3. I thought that these were call brushless DC motors be cause the current only flows through the windings in one direction whereas an AC motor has the current flow alternating directions. The controller is just sending DC pulses to the motor in a synchronized pattern.
          Thanks for the info on why the gimbals use brushless motors instead of steppers. I would have thought that with the fewer poles on a BLDC motor vs the 200 or so on a stepper would have made the stepper smoother.

          1. The construction of three phase ac and bldc does differ slightly. The rotor the ac motor is not magnetic. It consists of aluminium rods set into a laminated core. This is called a squirrel cage as the rods look like bars in a cage. As it is not magnetic it uses induction to produce motive force. A bldc motor has permanent magnets glued to the rotor and the motice forve is produced when a coil is magnetised around it. Took me a while to find the answer too, as i used large multiphase ac motors for work and brushless dc for hobby stuff. It is my belief that you could drive either motor with the same control types.

          2. Also in a BLDC motor the current flows in both directions through each winding, when you want a useful amount of power – which is the reason you need H-bridges (exactly 3 half bridges) to drive it.
            @JOLLYRON: What you describe as “AC-motor” is only one type: the asynchronous induction motor. The BLDC is the same as a SYNCHRONOUS AC motor. But you can not use the same driver. The controller for the asynch- motor just needs to produce a rotating field of suitable speed (frequency). A controller for a permanently excited machine (synchronous motor) needs to take into account the current rotor position.

          3. Martin: drivers for BLDC motors use various methods to detect the rotor position, but this is really just necessary for starting. In fact, not even for that. You can feed a BLDC three phase power, ramping up the frequency according to the desired speed, and as long as the motor can supply enough torque to get the load up to that speed, it will track. No feedback at all is needed, just as with AC synchronous motors.

            In real life, most synchronous AC motors have some sort of cheat that allows them to act like induction motors when they’re starting, so complicated starting circuits are not needed. But many really ARE pure synchronous motors, and you have to drive them with something like a variable-frequency drive to get them to accelerate to operating speed.

            Back in the days when audio turntables used synchronous motors to get accurate speed, I remember three methods I saw used to get these to start, and run the right direction: 1) a small part of the rotor built like an induction motor (Garrard’s “synchronous-hysteresis” motor), 2) an actual separate induction motor connected by a belt to the synchronous motor (Acoustic Research used this for a while, then switched to the Garrard type), and 3) a mechanical clutch that would “kick” the rotor backward it it started up the wrong way (don’t remember where I saw that). Electric clocks, which also used synchronous motors, used a “shaded pole” winding (actually just a loop of solid copper bar) that phase shifted part of the stators to produce a sort-of two-phase rotating field, which prevented the rotor from starting in the wrong direction. Clock motors had rotors with very low moments of inertia, allowing them to come up to speed very quickly, almost like stepper motors.

    2. Generally, the brushless motors provide smoother motion with a more rapid, powerful response. I’ve made camera gimbals from both and nothing beats the brushless gimbals in terms of response time and accuracy.

    1. I think a lot of HDD stuff is custom chips. Apart from stuff like RAM. I suppose there’ll be a power driver chip in there somewhere. But you can already buy those for not much money, vs the hassle of desoldering tiny little chips that weren’t meant to ever be removed. Debugging would be a pain if you can’t 100% be sure of your parts.

      Whereas the motor itself is a powerful stepper, and they’re expensive, so it makes sense to salvage those. Tho usually people just seem to take the magnets, it’s an easy source for ludicrously strong ones.

      And the platters are good for making fingerprints on. At first.

      1. The motor driver are often not really custom, I have found datasheets for some of them. It depends on the manufacturer of the HD.
        Unfortunately you can make fingerprints on them, but not use them for a fingerprint sensor :-)

    2. hello
      the motor controller for a HDD is a custom part, and requires a complicated set up and microcontroller to start these up. Your best bet is to get an off the shelf motor driver solution from STM, TI or ON semi conductor.
      regards

  3. You could get higher torque at extra slow speeds by coupling a second 3-phase motor offset by 45degrees, effectively creating a 6-phase motor. But some kind of gearing or precision connection of the two rotors would need to be worked out. Also it will requre 3 additional drive lines (and a second motor driver ic).

      1. Not in these kind of brushless DC motors it isn’t, because they’re set up to require multiple cycles of the input waveform per rotation. The guy who wrote this blog post says that his motor actually has 6 full cycles per physical rotation which sounds fairly typical.

    1. you would get something very similar by using double the amount of magnets (or stator poles) in the motor. I think that s much easier to accomplish. A 5phase motor would give an even smoother movement though.

      1. The field on a brushless DC motor behaves similar to a transformer – it will saturate if driven at too low a frequency. This means that if you’re driving down to 0 RPM (0 Hz), you need to limit the current. Stepper motors handle this by having enough resistance in the coils that they can be driven continuously up to a rated voltage, but if you don’t do something to limit current in a BLDC motor, you will fry it and/or the controller.

        This can be done either by sensing the current or by limiting the pulse width driving it. If you put “freewheel” diodes from each field terminal to the power supply, clamping each positive to the high supply (i.e., cathode to the motor, anode to + supply) and negative to the negative supply (or ground if using a single supply), then pulsing the drive at low speeds effectively raises the drive frequency. So you can design a drive that guarantees the field won’t saturate without having to have current feedback. This also has the advantage of operating in switch mode, reducing power dissipation in both the field and the drive transistors.

        Determining the lowest frequency or the maximum current to allow requires characterizing the motor, and I haven’t seen any BLDC motors that specify their worst-case saturation current. This is a little bit tricky, since it depends on the rotor position, and the permanent magnet in the rotor will contribute to the magnetic flux in the field, so if you’re taking measurements to determine what the low frequency limit is, you have to do this for a number of rotor positions.

        1. Only the worst/cheapest/least demanding stepper motor application rely on the ohmic resistance to limit the current. Any more demanding application (power/torque/speed) uses a chopper-mode driver which regulates the current, not the voltage at the coils.

  4. Everybody is asking about torque.

    Torque is essentially proportional to current. Independent of motor type.

    The problem with BLDC motors is that you need to know where the rotor is before you know where to direct that current….

    The normal strategy for e.g. ESCs in the model-flying world is to apply say about 10% torque in a certain orientation. As a prop is easy to turn that will force the rotor in a known position. Then at that current setting, an acceleration phase is started. After a while a simple measurement of the back EMF in the un-energised phase will allow the controller to detect the motor position and then apply the proper voltages on the phases to keep the motor running at a desired speed and/or torque. The problem however is that this breaks down when the back EMF is small, i.e. when the rotor is turning slow.

    What the motor in the video seems to be doing is simply applying a fixed (low) current to force the rotor in a certain position. The torque in that setup will be very low. Either you need hall sensors, or you need some other trick to determine the rotor’s position. It is apparently possible to do that with measurements of the inductance of the motor phases.

  5. Way cool. I’ve been waiting for somebody to demonstrate that there is no fundamental difference between synchronous multiphase motors and stepper motors, by treating a BLDC motor like a stepper. One advantage of fewer poles is that you can usually make these motors go WAY faster than steppers.

    So everybody already knew how to drive 3-phase motors at high speed (using back-EMF sensing), and now we see that you can also drive these like steppers. All that remains is to come up with a control system that makes a smooth transition between the two regimes.

    1. Yes, been there done that, see my patent! :-)

      Full speed is a PID control loop and slow speed is a stepper drive. Preload the PID variables at the transition from low to high, set the stepper position to the current rotor position when going high to low.

      We had sensor equipped motors which makes things a little easier.

      I used an Atmel AT90PWM3 to control the motor.

  6. To adjust the speed, I understand you can bypass the switches (in order to avoid the losses), and instead do it by adjusting the VBus going to the motor. The switches would only be used for commutation.

    But what if you want to control speed via the PWM duty cycle.. does it matter which switch you pulse (i.e. high side, low side, both (complimentary))?

    Also, there’s unipolar vs bipolar (1-4 quadrants) that I’m not sure how what this means in practical terms. From what I’ve read, when doing unipolar, the rotation direction is determined by the commutation sequence, but in bipolar, the direction is based on if the duty cycle is less than or greater than 50%?! But how (or why) does this actually work?

  7. The original datasheet is not clear – it implies that IN1 matters when EN1 is low – IN1 is a don’t care while EN1 is low, and OUT1 is tri-stated (ignoring inductive circulating currents and intrinsic MOSFET diodes.)

    I’m not sure why MCU’s would be getting burned… unless code is trying to quickly initialize the MCU output pins before motor power comes up. Use the 10k Ohm pull-down resistors – they keep the driver inputs safely low while the MCU is in reset (and MCU pins are tri-stated).

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.