Testing my custom motor controller

I have been working more on my motor controller recently, and this is a brief update on the progress. One of my test rigs is my 1:8 RC car. With this one, I can test the startup torque, the braking and many of the safety functions, e.g. the transitions and currents when going from full forward to full reverse. Here is a video of the tests:

In order to use the motor controller with a servo input signal and a similar RC car, open the conf_general.h file and use these settings:

* Select only one motor configuration
//#define MCCONF_STEN
* Select which application to use
//#define USE_APP_STEN

On Sunday it is time for more interesting tests:

IMG_2545 IMG_2551 IMG_2554

This is a longboard that my friend makes for his bachelors thesis. It uses my motor controllers (of course 🙂 ) and these motors.

16 thoughts on “Testing my custom motor controller

  1. very nice project.
    I have worked on my own project with non-standart 180° drive method of bldc.
    This give us up to +30% more power of motor for concret supply voltage
    I used DRV8301 and STM32F303 -Discovery.
    I have done till yet many simulations (with LT-Spice IV). The control is sensorless -motor works like tachogenerator.
    Im interesting for disscuss.
    If so, let me know.

    • Thanks!
      I haven’t been working on that yet, but hopefully I will find some time for that during my vacation.

  2. Hi, Benjamin.
    Your project is very interesting. Especially draws its flexibility in different applications. This is not a Chinese toy. I saw a video test custom ESC on the RC-buggy 1:8 and want to use your ESC to participate in the 1:12 RC Pan Car race. I want to know if you can sell me 2 pieces ready custom ESC or 4 pieces PSB (the matter is, and you probably do faced with the fact that the pilot production PCB takes a lot of money for pre-production, but I just need a few PCB)?
    Excuse my English. At school I learned German and not very successfully. So I had to resort to Google translator.

    • Hi Oleg,
      To use my ESC you have to set parameters for your motor to get it working optimally, so it is not really a ready-to-use product. Once you get the parameters right, it works exceptionally well. Are you familiar with ARM/STM32 microcontrollers?

  3. Benjamin,
    I have not studied in detail the documentation for your project. With ARM / STM32 not familiar. But I hope that will understand, as I am a bit familiar with Atmel microcontrollers and development environment IAR Embedded Vorkbench. A few years ago I was doing simple project condensing pressure control in air conditioners by changing the condenser fan with thermal feedback. Developed the program was not me, but I had to amend the original files, with often acting intuitively. I hope that the documentation for custom ESC find advice that will help me, and that ARM / STM32 is not very different from the IAR Embedded Vorkbench for CPU Atmel.

    • You can try to compile the code to start with. I have changed the PCB a bit, so I will order a few new PCBs soon. I could send you a few of them.

  4. Hi,
    I’m building a 48v self balacing unicycle controlled by a myRIO (I’m later planning to integrate the controller on the PCB). I’m Currently removing the “controller” part of your schematic and have few questions. Why do you have three identical conductor in series and what is the sens1-3 used for?

    If you are interested, here is my thread:

    Thanks for sharing your files!


    • I need to rewrite that…

      I’m building a 48v self balancing unicycle controlled by a myRIO (I’m later planning to integrate the controller on the PCB). I’m currently removing the “controller” part of your schematic and have a few questions. Why do you have three identical inductors in series and what is sens1 to 3 used for?

    • Hi,
      The inductors are not necessary, so I have removed them from the latest version of the design. Nice monowheel 🙂

  5. Thanks! 😀

    Two more questions:
    Why do you not use pull down resistor on the higher fets?
    Do you think the STM32F4 is capable of handling the extra calculations needed for FOC and if you were to be driving two or more pre-drivers with a single microcontroller, which mc would you suggest?

    I will be building my own electric longboard when the wheel is done, shouldn’t be as hard when I’ve wrapped my head around BLDC and FOC. However, I’ll be squeezing all the electronics on one PCB and also implement IMU, BMS and Bluetooth. Maybe you want to colaborate? I live in Gothenburg.


    • I used pull-down resistors on the low side only because that is enough to prevent cross conduction in case the gate voltages are undefined.

      The STM32F4 would be able to handle sensored or sensorless FOC easily for one motor. It should also work for two motors, but then sampling the currents can become a bit more tricky. For your balancing application, you really have to use sensors because tracking the motor position through zero speed is difficult for any sensorless observer. I guess that you plan to use the hall-effect sensors already present in your wheel and some interpolation if you are going to use FOC, but to be honest I don’t know if it is worth the effort. FOC is a buzzword in motor control right now, and for your application I think six-step commutation should work just as well and is considerably easier to implement with hall-sensors already present. I have attached a pulse encoder to a motor so that I can start experimenting with FOC in order to get some experience with it. First I plan to make sensored FOC work, then write and observer that I can debug/test against the encoder position, and then make it sensorless. I was planning to work on this a while ago already, but first I tried to make the 6-step implementation as good as possible which took me more time than expected.

      Sure, it would be nice to collaborate. I live in Borås, but I work in gbg occasionally. I also hang out at Chalmers now and then. Maybe we can exchange a few emails (in swedish 🙂 ) and find a time to meet and talk.

      Regarding IMUs and filters, I have also made a custom control system for quadcopters:


    • Hi Nils, hi Benjamin,

      I’m also on a SB unicycle project. Currently rooting a controller board widely inspired by Benjamin platform to test its software with similar ressources assigment. Add some improvements (LSM330 6DOF sensor for IMU, Bluetooth), bigger PCB for a single reflow process and better MOSFET cooling.

      If one of us is interested in, please let me know by mail to exchange some pictures and files.


Leave a Reply

Your email address will not be published. Required fields are marked *

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