How to control speed or torque of your Brushless Motor with Arduino using SOLO (closed-loop) 1
Written by SOLO Team
20/02/2020
How to control speed or torque of your Brushless Motor with Arduino using SOLO (closed-loop)

SOLO features outstanding options for its users and one of them is enabling them to control the speed or torque of their BLDC, PMSM, BLAC motors in a sensorless closed-loop manner with cutting edge technology of Field Oriented Control, but what’s more interesting is SOLO is probably the simplest motor controller to do FOC with! You can do FOC without even writing a single line of code! With two Potentiometers! In this article, we are going to explain how to apply FOC to your brushless motor with Arduino and SOLO. it’s highly recommended that before proceeding with this article you also check our article about how to control the speed of your brushless motors using ARDUINO and SOLO in an open-loop manner which is the simplest way to run SOLO.

If you have no technical knowledge about these terms we are mentioning like FOC or even closed-loop or open-loop control, it’s not important at all, just follow the following procedures and you’ll have your Brushless motor spinning like a charm.

With SOLO you can have either Torque or Speed control, but what are the differences?
In a simple language, the Torque control is like you want to directly control how much Torque is generated on the shaft of your motor! To simplify even more, you can imagine that The higher the Torque the more forceful your motor will spin. Torque Control is used in TRACTION units, Electric cars or Electric Scooters and so on.

On the other hand, Speed control is used when you want to control the rotational speed of the shaft of your motor! In some applications like Drones, it’s more important to have a constant speed on the propellers to keep the motion steady.

One might ask, Ok then, what’s the difference between Speed and Torque Control? Actually this is a very valid and tricky question to ask, and to answer that, we can say, the speed is a phenomenon resulted from Torque! Meaning that in electrical Motors, by injection current into the windings of your motor, you generate mechanical Torque on the shaft of your motor, now depending on the load on the shaft of the Motor and the amount of generated Torque you will have Speed as the result. So in practice, if we consider a fixed load on the shaft of your motor ( like a robot on a flat plane with a fixed weight), if you increase the Torque your robot will move faster and vice versa!

Anyway, Regardless of the type of Control, you choose ( Speed or Torque ) the wiring of your Brushless motor controller with ARDUINO will be here:

How to control speed or torque of your Brushless Motor with Arduino using SOLO (closed-loop) 2

In Closed_loop configuration with SOLO, you only need one pin of ARDUINO which is capable of generating PWM and one Digital I/O pin which can output a logical 0 or 1 ( 0V or 5V ) outputs. As you can see in IMG1, the configuration in Closed-Loop mode is very simple and all you need to do are as follows:

Closed-Loop Configuration of SOLO

1. Connect your BLDC or PMSM motor to pins “A”, ”B” and “C” of SOLO, The order of connection is not important and it can only affect the direction of rotation of the motor which you can control through “DIR” pin in SOLO.

2. Connect pin number “3” of ARDUINO (or any other pins which is capable of generating PWM) to pins named “SP/TR”.

3. Provide the +5V supply to your ARDUINO module from “+5V” and “GND” pins of SOLO

4. Connect a generic digital output pin from ARDUINO ( in this case pin “7” of ARDUINO) to the “DIR” pin of SOLO for controlling the direction of rotation of your brushless motor.

5. Push “P1” switch in the Piano switch of SOLO “UP”, this will put SOLO in Closed-loop mode

6. Depending on the type of your Brushless motor put switches “P4” and “P5” in PIANO Switch of SOLO in one of the following conditions

    • Motor Type: Normal Brushless Motors ( nominal speed < 7000 rpm) then “P4” Position DOWN and “P5” Position UP
    • Motor Type:Ultra-Fast Brushless motors ( nominal speed > 7000 rpm) then “P4” Position UP and “P5” Position UP

“Ultra-Fast Brushless motors” is referring typically to small-sized motors for drones or hobbyists which are capable of reaching up to 50000rpm. In the case of selection of Ultra-Fast mode, which in practice are motors with very low inductance, SOLO will operate with switching frequency of 80kHz, which in case of Normal mode the switching frequency of SOLO will be 20kHz.

7. Now you can Select between “Torque” or “Speed” control using “P2” switch in Piano Switch as below:

    • Control Mode: TORQUE control then “P2” Position UP and the Tuning is NOT Required
    • Control Mode: SPEED control then “P2” Position DOWN and the Tuning is Required

As you can see in the table above, you just need to select a proper position of “P2” for having Torque or Speed mode selected, in the current version of SOLO, Torque control needs no Tuning since SOLO does all the jobs for you, in case of Speed controller you need to tune a little bit two potentiometers which are named “Kp” and “Ki”. in the following you can see 2 videos one is dedicated for explaining the Torque control and how tune SOLO for that, while the other one is dealing with the Speed control and how to tune the Kp,Ki gains of SOLO for that.

Closed-loop sensorless speed control video

Closed-loop sensorless torque control video

Now you have SOLO configured completely, so depending on the control Mode you’ve selected, you can increase or decrease the Speed / Torque of your Brushless motor by variation of your PWM duty-cycle (from 0% to 100%) or your analog voltage amplitude (from 0V to 5V) from the minimum value to maximum value.

Please notice that in case you use PWM for commanding SOLO, the frequency of your PWM can be anything between 5kHz to 100kHz as can be seen here
How to control speed or torque of your Brushless Motor with Arduino using SOLO (closed-loop) 3

4 Comments

  1. Christoforos Rekatsinas

    Hello,
    I have a question regarding your product!

    I want to perfrom a FOC using a pmsm motor. The thing is that I also need to perfrom Hardware in the Loop with your module and arduino.
    To achieve that I need either sensor less or sensored control of the speed (or torque of the motor).
    Is it possible to upload my code to arduino? Does solo outputs the BEMF of the motor?

    Reply
    • Staff

      Hi Christoforos,
      Thanks for the question, to answer that properly I would initially say that SOLO is coming to make Motor Controlling easy and accessible, so in SOLO we tried to shield our users from dealing with complexities of the motor controlling and providing them an easy high-level interface, but if you are interested to dig down deeper you have the possibility as below:
      As you know FOC of a PMSM motor consists mainly of two control loops, one internal control loop which is in charge of controlling the Torque (current) and the exterior loop which is in charge of controlling the speed of the motor. using SOLO you can separately control each of these loops depending on the application.
      For your application specifically, I have an idea for you:
      – What you can do with SOLO and your HIL system can be like you putting SOLO in Torque Control Mode, this means you are neglecting the internal speed Loop which SOLO is providing, as you mentioned now you have two possibilities:
      1- If your motor has an encoder you can connect the encoder to your Arduino, measure the motor’s speed there and close the Speed loop externally inside Arduino
      2- If you want to work in sensorless mode, SOLO provides you the estimated speed of the Motor (much better than BEMF for your application I suppose) on UART or USB which you can read it with the serial input and close your Speed loop in Arduino or your PC.
      I think for you the first method will be a good starting point but also the second method will be powerful.

      Reply
  2. Wu Ke

    Hi there,

    I am working on a robotic project, which is controlling 4 DC motors in terms of torque in Matlab. As my controller is developed in Matlab, I need to send commands from Matlab through Adruino mega to the 4 DC motors. Does that mean I need 4 SOLOs and one Adruino in this case? I used to do the same with 4 servo motors but I am new in DC motors.

    One more important question: where is the link of the product where I can order it?

    Thanks so much,
    Ke

    Reply
    • Staff

      Hi Wu,

      Thanks for your question, the simple answer is YES! As you might know, the Torque Control is done in a closed-loop fashion and SOLO does it totally automatically without the need for any tuning from the user side, so for each motor, you’ll need one separate SOLO, but since in order to control the Torque on SOLO, you’ll need 1 PWM enabled pin from your Arduino, and 1 general-purpose I/O to define the direction of rotation, so in total for 4 motors, you’ll need 4 PWM outputs plus 4 digital outputs (1 if all the motors spin in the same direction), which I’m sure a single Arduino mega can provide them all.
      To Control the Torque of your motor using SOLO, you just need to send to SOLO your desired current ( Torque = Current * TorqueConstant ) in form of a PWM pulse with a variable duty cycle from 0%-100% in which 0% stands for 0 current in the motor ( no torque ) and 100% means the maximum current in the motor ( in SOLO by default it’s 32A, but you can adjust it ). The frequency of the PWM pulse is not important and anything above 5kHz is acceptable and valid. This project has been done using torque control feature of SOLO on a DC motor in an E-Scooter, Pls have a look.
      To have SOLO now you should participate in our BETA program here. Pls subscribe there and we will contact you soon.

      Reply

Submit a Comment

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

Related Articles

Share This

Share This

Share this post with your friends!