They all say, start your articles with positive sentences! but we all know how hard it can get, setupping a motor controller and getting it to do what you exactly want them to do! SOLO is here for the same reason and the same goal, just to make the whole thing easier, and step by step, make the process seamless and unnoticeable, that is the whole point of existence of SOLO and us here. In this article, we are aiming to deepen the consciousness of how SOLO works and how to tune your Motors regardless of their types with SOLO. Just to say, this is going to be a LOOOOONG article, but believe me, unless you are the GOD of motor controlling, you are going to find some interesting stuff there 😉
Everything starts with the following scary looking diagram shown below in Figure 1, and again, If you don’t know these stuff, don’t worry, you are going to understand a lot about it by the end of this article:
Figure 1 – The main Control Scheme in SOLO
The diagram you just saw in Figure 1, is known as FOC which come from “Field Oriented Control” which is one of the best methods to control different electrical Motors, despite the fact that so many people think FOC is only for 3 phase motors, but the main story is in fact different! Actually the main idea of this type of control is coming from DC motors especially separately excited DC motors. In those motors, you can control the Torque and the intensity of the Stator field separately, so FOC initially introduced to make the control of 3 phase motors in the same way as DC motors within two main branch of Torque and Flux completely decoupled and independent from each other as can be seen below in Figure 2:
Figure 2 – Two main branches of a FOC
The first branch shown in Figure 2, is where most of the things related to our article occurs, and we will remain mainly focused on that. As you see this branch basically consists of 3 controllers coming on the back of each other, Torque, Speed and finally Position Controller.In Control World, they call them cascade controllers. Each of these controllers will affect other controllers in the loop.
The closest Controller to the Motor is the Torque or Current Controller, and this is actually the fastest controller because it’s dealing with controlling the amount of current inside of the motor ( called Iq in 3 phase motors). In another word, considering the fact that each Motor has two aspects, the Electrical and the Mechanical aspects, and among these two normally the Electrical aspect of a motor has faster reaction time than the Mechanical aspect, to understand more, the Current inside a motor, deals with Electrical aspect of a motor, but Speed of a rotating shaft, deals with the mechanical aspect of it, and that’s why the Current controller ( Torque controller ) comes first with respect to Speed controller.
So now we know why the arrangement of these controllers is like that, we have the first controller which is the Torque Controller, then we have the Speed controller and then finally the Position controller. So depending on the need of the user, you might not use, some of these controllers, for example, if you only want to control the Torque of your motor, you need to only use the Torque Controller, and you need to only tune that controller, but if you want to control the Speed, you need to tune both the Speed and Torque controller. Obviously, if you go for Position Controlling, you need to tune all these 3 controllers once.
The process of tuning of the whole system will be always like the follow one.
Start from the Closest controller to the Motor and Tune backward!
Step by Step guide on How to Tune your Motor in Motion Terminal
1. Connect your Motor and Supply power to SOLO
For this part you can check SOLO’s datasheet to learn how to properly connect your Motor to SOLO.
2. Apply Propper Configurations
Here you need to first select the Type of your Motor, The maximum Current Limit that it can support, and more importantly, the PWM Frequency that you prefer SOLO appling on your Motor which is also known as switching frequency. As a rule of thumb, the lower the inductance of your motor, the higher should be the switching frequency. SOLO supports switching frequencies from 8 to 80kHz and you have a wide range of selections. To start, you can leave the switching frequency as it is and later you might need to come back and change it.
3.Put SOLO into Close-Loop
Closed-Loop or Open-Loop configuration of SOLO is done just at hardware level, by pressing the Piano Switch Pin No#5 Down you can go to Closed-Loop configuration as seen in Figure below:
Figure 3 – Closed-Loop Configuration on SOLO
If you leave SOLO in Open-Loop mode, none of the mentioned control loops above will be functional, instead you can drive your motor with some basic controls, but of course the best quality of control is when you put SOLO into Closed-Loop Mode.
4. Put SOLO into Digital Mode
Within Motion Terminal, select the “Command Mode” on Digital Mode, so every command can be set digitally from Motion Terminal through USB or UART communication. Remember, some of the motion terminal functionalities like Monitoring or setting the Configuration or Identification parameters will be also valid in Analogue Mode, so you can change the parameters like Speed, Current Limit, Kp and Ki for Speed controller using the potentiometers in Analogue mode and keep Monitoring or tuning other parameters in Motion Terminal. ( some sort of a hybrid Mode)
5. Do the “Motor Identification”
Once you press the “Motor Identification” Button, while SOLO is powered, it will automatically identify a lot of parameters of your Motor, and among them, you will have your Torque controller tuned Automatically as you will see some values will appear for “Current Controller Kp” and “Curren Controller Ki”, This means the first control loop is ready and you can test it, be careful that the Identification will be dependent on the Motor type you select in Step 2 mentioned above, so always select the Motor type before Identification ( also in Analogue Mode).
You can also see the identified Inductance and resistance of your Motor, these values might be different with what you see on datasheet of your motor, and the main reason is, Normally what is on the Datasheets is measured in ideal condition, specially the inductance of the Motors, this means if you measure the inductance of your motor with a RLC meter, you might witness a different value than what SOLO Identifies( normally smaller values ), The main reason for this comes from the fact that SOLO measures the Active Inductance of your Motor while there is a considerable current in it with propper switching on it, because the Inductance will drop once you apply a certain current to a coil due to saturations and switching frequencies. In nutshell an RLC meter that injects 100mA into a motor coil with current rating of 30Amps, can not give you a clear idea of the real inductance of your motor, this phenomenon becomes very bold for poorly manufactured Motors, that the real inductance of the Motor’s coils can drop significantly when they go near their nominal Current rating.
6. Select the Control Mode
You might want to use SOLO in sensorless mode or in sensor-based mode using Encoders or Hall-Sensors, so you can set this parameter inside the Motion Terminal on “Speed/Torque Control Mode”. Be careful that you need to properly set up the connections of Encoders or Hall sensor outputs to SOLO before.
7. Check the Torque Loop
Now you have all the necessary things to start checking the first Loop. At this stage we will trust the automatically identified Motor parameters by SOLO immediately after running the Motor Identification. So All the parameters are tuned automatically till this part.
8A. If you are using SOLO in Sensorless Mode
Now you can give a Torque Reference to your Motor, depending on your motor you can start from low values like 1A or 2A and see if the motor starts to rotate(in general you can think like 20% to 30% of the peak current that your motor supports, should be sufficient for your motor to start rotating in no-Load condition) , if the Motor rotates with an accelerating speed, or if it rotates with nominal speed of the Motor, that means the Torque loop is well tuned.
Keep in mind, the best check for validation of good Torque controller quality is by fixing the shaft of the Motor, and after giving the Torque reference, Checking In Motion Terminal how stable is the current in the Motor using Monitoring Mode ( Iq for Brushless motors).
If the Motor Keeps jogging or it doesn’t start rotating or it vibrates alot, you can start tuning the following gains:
There are basically 3 observer gains now available in Motion Terminal to be tuned depending on the motor type you have, all of these gains are related to “N.L. Speed / Angle Observer (sensorless)” block shown above in Figure 1. This is actually a non-linear closed-loop observer that tries to estimate the Angle and Speed of your Motor based on the Electrical characteristics of your motor like Currents and Voltages. This block substitutes the need for Sensors like Encoders or Hall sensors and that’s why it’s called an Estimator.
There is a default value for the Observer gains, and for instance, if you selected the motor type as “BLDC-PMSM” which is known also as Normal Brushless, you only need to tune the “Normal Brushless Observer Gain” in Motion Terminal.
This Observer Gain basically deals with the Motor Back EMF Estimation, and in case of Brushless Motors ( fast or Normal ) it can have a value from 0.01 to 1 and in case of DC brushed Motors it can be from 0.01 to 100 in general.
In General, the Motors with higher Electrical time constant need less values for this observer gain, Electrical Time constant can be driven from division of Inductance / Resistance of the Motor’s phases.
For example if we imagine that the motor you’ve selected is a Normal Brushless or PMSM motor and you want to enhance it’s behaviour, you can reduce the “Normal Brushless Observer gain”to lower values like 0.3 from the default value of 0.9 and see if the behaviour of Torque Controller changes for good. You need to finally find the best gains for your system tweaking these values.
Current Controller Kp and Ki Gains
8B. If You are using SOLO in Encoder or Hall Mode
In this case there will be no necessity to tune any specific gain, and you just need to make sure the Control Mode is selected on “Using Encoders” or “Using Hall Sensors” and right after the Motor Identification, if the setup of the senros to SOLO is correct, you should be able to give some Torque References (20% to 30% of max current of your motor in No-Load condition) to the motor and see how the motor accelerated to it’s nominal speed in this condition. Of course, in this case, you might want to enhance the Current Controller Kp and Ki gains, to achieve better performance.
9. Tune the Speed Controller
If you want to control the speed of your Motor, now is the time to start tuning the speed controller, so after making sure the Torque loop works in an acceptable manner, you can give two gains to “Speed controller Kp” and “Speed Controller Ki” following by giving a speed reference to SOLO.
For example it’s always good to start with small gains and increase them slowly, for instance you can put 0.04 for Speed Controller Kp and a much smaller gain for Speed controller Ki, something like 0.002 as the value. Once you set these two gains, you can put an arbitrary Speed Reference for your Motor depending on the Maximum speed it supports, for example for a Motor with nominal Speed of 6000RPM, you can put a speed reference of 2000 RPM and see how good the Motor moves ( around 30-40% of Nominal Speed)
If you see the Motor has some vibrations, you can start tweaking the Speed controller Kp gain till the motor starts rotating and then tuning the Speed controller Ki gain. Remember that Ki gain is a very sensitive gain as it’s an integrator that accumulates during time, so putting big values for it might make your system unstable. In some Motors, you can put the Speed controller Ki equal to zero and rely only on the Speed controller Kp, but in this case you can’t expect the controller to reach a Zero steady state error, meaning the Ki gain, plays a role in reaching the goal and maintaining it over time.
Note: if you are in Sensorless Mode, and you want to further enhance the speed controller behaviour, you can tune the Observer and Filter Gains while you are in Speed mode further as mentioned above in Torque Controller tuning. Normally you can find their best values while you set them in Torque mode and then later you optimize them in Speed Mode.
Note: If you are using the ACIM types of Motors, you need to give a reference to Magnetizing Current which is also known as “Id”, to learn how it works, you can refer to this article.
10. Tune the Position Controller
If you want to use the Position Controller on SOLO, once you made sure the whole loops of Torque and Speed are working as expected, you should firstly make sure the Control Mode is selected on “Using Encoders”, after this stage you need to tune 3 parameters, Position Controller Kp, Position Controller Ki and the Speed Limit. Position Controller Kp and Ki, are the Position controller gains that are similar to Speed and Torque controller and the Turning is also similar, so you start with small Kp and Ki values like 0.3 for Position Controller Kp and a much smaller value for Position Controller Ki like 0.03. The Speed Limit will define with what speed the position Trajectory should be followed, for example you can put this value as 80% of your Motor max speed value and see how is the behaviour. Now after setting the mentioned three values, you can put a value in Desired Position[Quad_pulses] which defines the position Goal for your system, this value can be Positive or Negative and it’s equal to all the quad pulses that you like your motor to traverse ( each encoder line, will represent 4 pulses), and once you set it SOLO will start moving your Motor toward this desired value in the correct direction. For example if you put here a value like 100000, SOLO will count around 100000 quad pulses (10000/4 physical Lines of encoder) and once it’s near the goal it will keep the Motor in Position.You can give other values like -80000 and see how the rotation will change and the Motor goes into a different direction following the reference. You can always check the actual position of your motor by reading the Position[Quad_pulses] in Motion Terminal in the “Information” section, to see how well tuned your gains are.
So here in this article, the goal was to deepen the knowledge of the whole process of dealing with SOLO in all the possible controlling modes, from Torque control to Speed and finally the position, we hope after reading this article you are having a better understanding of what’s really happening behind the scene, if you have any question regarding this article or any other technical questions, you can ask us on our Forum.
How to Drive Fast Drone or RC car Brushless Motors using ARDUINO and SOLO in Sensorless Mode up to 30,000 RPM
In this article, we are going to demonstrate how you can use SOLO’s ARDUINO Library to control the speed of a BLDC motor with 4150KV which will reach up to 30000RPM by applying 10V as the Battery or BUS voltage. In this example Closed-loop sensorless control will be...
Sensorless Speed Control of a Brushless Motor with ARDUINO and SOLO in Digital Mode using UART Communication
In this article, we are going to demonstrate how you can use SOLO’s ARDUINO Library to control the speed of a brushless motor using only UART communication in sensorless mode.THE WIRINGHere, the only wiring you need to apply will be only the connection of the Motor to...
Nothing is better than awareness when someone wants to solve a problem! It might be very costly to become aware of the main issues, and the more you know, the better you can dig down to the roots and causes of problems and eventually solve them. That's the purpose of...