web analytics

Spining BLDC(Gimbal) motors at super slooooooow speeds with Arduino and L6234

First of all You won’t find here any information on high speed BLDC motor driving. For that purpose You need to know rotor’s position, so You have to measure back-EMF or use Hall sensors (not needed here).

For basic info about driving BLDC motors here is best “classic” articles on internets:
Driving a three-phase brushless DC motor with Arduino – Part 1. Theory

Driving a three-phase brushless DC motor with Arduino – Part 2. Circuit and Software


I used specialized triple half bridge IC L6234 (~ 8$). You can make the same spending less money (but more time) with MOSFET transistors or other IC.

But be careful, I found a lot of cases in various forums, where people burned their Arduinos or L6234 chips.

Magic Blue Smoke Attention

If You connect L6234 INputs directly to Arduino and OUTputs to low impedance motor – current from Arduino pins will be driven directly through L6234 to the windings and to the ground (without external Vs power applied to L6234). This makes very good chance to burn Your lovely microprocessor.
Also in application note, one sentence is worth to mention – “To avoid overload of the logic INPUTS and ENABLES, voltage should be applied to Vs prior to the logic signal inputs.”

I also very recommend to study (or/and purchase) this open hardware driver board based on L6234 BLDC Motor Driver by Michael Anton. It has input protecting resistors, zeners, power supply/filtering components and even back-EMF sensing circuit with amplifier (not used here).

L6234 datasheet is surprisingly useless. Go straight to Application Note AN1088 instead.

My setup of Arduino and DIY driver-board:


I added current limiting resistors (1kΩ) to all INputs and ENable pins, a bunch of capacitors recommended in application note and current sensing shunt resistor 0.6Ω (big blue one).

There is main illustration, for basic BLDC driving using 6 step sequence(rectangular current):

6 step BLDC driving sequence
It works very well on high speeds. But on slow RPM’s You will have choppy steps. So we need to smooth out driving current to sine waves:
 six steps BLDC to sine wave

To achieve this, You simply set ENable pins to HIGH (as except few zero moments, voltage is continously changing). And feed the sine-wave modulated PWM (SPWM) to INput pins:

I didn’t tried to force Arduino to make sine calculations. Lookup tables was used instead. Here is a link to OpenOffice spreadsheet:
openoffice_calc BLDC_SPWM_Lookup_tables
You can generate traditional sine waves (SPWM) and Space-Vector PWMs (SVPWM). Try both and decide which to choose for Yourself.

And here is actual Arduino code, fused from different sources:

After compilation You will have info that there are still plenty of memory. Even after heavy 360 values sine array.

So, there are 360 “steps” in one electrical revolution, and tested motor had 6 electrical revolutions, per one mechanical. This means 360×6 = 2160 “steps” per mechanical revolution or 0,16(7) degree of precision. If not enough, You can make even 3x more precise lookup table.

Here is some video illustrating results (You have to be very patient to notice movement on last one! )

SVPWM modulation is used in this video. Pot interactively changes delay(); value.


If I helped You, please help me. Thank You!

    1. Salvador Hurtado April 20, 2015 at 21:22

      Thanks a lot, great easy code and perfect explanation. Help me a lot with my robot project.

      Your sketch go perfect with a ST-L298 motor driver and a Turnigy gimbal motor.


      • Jason Lee May 23, 2015 at 18:27

        I almost copied this program to generate SPWM using STM32,along with a DRV8313 in the hope for driving a 3-phase BLDC,would you please help me?
        My e-mail address is 827366470@qq.com

    2. Pingback: Driving A Brushless DC Motor Sloooooooowly | Ad Pub

    3. Pingback: Driving A Brushless DC Motor Sloooooooowly - zeax blog (ze-ax.com)

    4. Pingback: Driving A Brushless DC Motor Sloooooooowly | Hack The Planet

    5. Pingback: Driving A Brushless DC Motor Sloooooooowly | MyWebspace

    6. A/P Daniel F. Larrosa April 21, 2015 at 08:22

      Nice work ! It has appeared also in Hackaday.com


      Thanks !

    7. Moritz April 21, 2015 at 09:37

      Pretty cool job! Thanks for sharing!

      Since I don’t have much of an electrical engineering background I wonder What exactly are the limitations of this compared to a “real” stepper motor. I imagine that the torque is probably pretty low…? Are there any other drawbacks?

    8. Pingback: Spining BLDC motors at super Slow speeds with Arduino and L6234 - Arduino collector blog

    9. John April 21, 2015 at 14:59

      Hallo! Great job!
      Please tell us about motor torque!

    10. Niko April 22, 2015 at 15:41

      Nice job

      Can you publish or send a diagram of the circuit?

      Thank you

    11. blipton April 22, 2015 at 17:31

      I’ve got a motor that doesn’t have any hall sensors, so this looks perfect!

      But does it matter which of the 2 switches the pwm is on? For example to adjust the speed, do you change the duty cycle on the high side phase switch, or on the switch connected to the low side? With respect to pwm, I’ve seen references to ‘unipolar’, ‘bipolar’, ‘complimentary’, ‘1-4 quadrant’, but I’m not sure if/how it’s related.

      Does anyone know if assembled boards are available for purchase? I saw another bldc driver, but no assembled boards either (https://github.com/lgbeno/BLDC-Booster http://open-bldc.org/wiki/Open-BLDC)

      • Michael Anton February 22, 2016 at 01:06

        I often have assembled boards available on my Tindie store. I’m out of stock just now, but I have another assembly run in process, so they should be in stock soon.

      • Michael Anton July 28, 2016 at 09:29

        Yes, I have some assembled boards available on Tindie for purchase. See my website at http://manton.ca for details.

      • Michael Anton October 22, 2016 at 23:20

        Yes, I have assembled boards available in my webstore at: https://www.tindie.com/stores/manton/.

    12. Serlo April 24, 2015 at 00:47

      Good job

      Can U post the circuit diagram???

    13. Mark April 27, 2015 at 23:47

      I would love to see what your wiring diagram looks like

    14. roberto May 11, 2015 at 06:56

      Hi there, thank you so much for info..but if there to make change if my motor is delta connection inside?

      and mind to share the circuit diagram?or u directly use as shown in AN1088 datasheet?

      thank you.

    15. Yasin Kaya May 15, 2015 at 12:26

      Thanks for perfect explanation.

    16. Yasin Kaya May 16, 2015 at 14:11

      I have some overheating problems while using this control technique. Is there anyone has same or any solition recommendation?

    17. Anatolia January 11, 2016 at 21:56

      Hi, I have a problem I can not get the minimum speed on video, I tried everything, if you can give a sketch of the video evlgenii@gmail.com

    18. Robert January 22, 2016 at 13:36

      I have the same problem with motor overheating… ,

    19. omid February 6, 2016 at 17:15

      Thank you very much

    20. ang April 19, 2016 at 12:28


    21. ang April 19, 2016 at 12:31


      please give schematic diagram for connection with components in arduino and BLDC and L6234 please give ,

    22. Patrick May 16, 2016 at 19:03

      I’ve tested this code with Arduino and adapted to to an STM32 and it works as expected. An issue that I’m running into though is that my motors are warming up considerably. I know that as the speed goes down, torque increases which is proportional to the current flowing through the coils but is there any way to reduce the current while still maintaining the low speeds?

    23. mitch September 5, 2016 at 14:42

      I would love to buy you a beer but can we see the schematic?

    24. Gustavo Murta September 15, 2016 at 15:23

      Hello BerryJam. Im doing some tests with L6234 and Arduino. First test using L6234 Linear mode with HD disk motor.
      Thanks for your tutorial.

    25. Gustavo Murta September 15, 2016 at 15:23

      Hello BerryJam. Im doing some tests with L6234 and Arduino. First test using L6234 Linear mode with HD disk motor.
      Thanks for your tutorial.

    26. John Nikhil September 22, 2016 at 12:49

      Hello guys,
      could you help me with code.. my motors arent working.. all connection to the motor driver are connected as mentioned in the datasheet.. but i get output voltage of 0.5V from all three OUT pins of the motor driver..
      could you upload the circuit diagram?? Im not figuring whether its the problem of driver or of the code..

    Leave a Comment