To control the Torque of a BLDC or PMSM motor that is equipped with HALL sensors, you need to have a Motor controller like SOLO, that has the capability of delivering High powers to the motor and at the same time, it’s smart enough to take care of stabilizing the Torque on the shaft of the Motor, in order to achieve that, SOLO is utilizing Field Oriented Control that is also abbreviated as FOC which enables it to explicitly control the Torque on the shaft of the Motor.
In this article we are going to use a Raspberry Pi to command SOLO through it’s UART line using our Python Library written for Raspberry Pi, in short the Raspberry Pi will be acting like a supervisory unit, sending high level commands like the Torque reference to SOLO, and once SOLO receives the command through its UART line from Raspberry Pi, it will do all the rest automatically by following the reference Torque.
In This article the Torque controlling of the BLDC motors is achieved by using the HALL sensors mounted on the BLDC motor so that using their outputs SOLO can estimate the mechanical position of the Rotor of the BLDC and subsequently measures the Electrical angle of the shaft which is used in FOC and finally controlling the Torque of the BLDC by measuring the propper current fed into the Motor, the current that acts in Torque generation in BLDC motors, if the Motor controller operates in FOC, is called “Quadrature Current” and it’s shown with “Iq”, the Iq although is fundamentally a component of AC current inside the BLDC but it has a linear relationship with the real torque of the Motor based on:
Brushless Motor’s Torque [N.m] = Iq Current [A] x Motor’s Torque Constant[N.m/A]
So basically the Torque is the Iq multiplied by a constant that is known as Torque constant and it can be found (or measured) on the datasheet of the BLDC used, in this article for the motor we are using the Torque Constant is 0.08 [N.m/A].
Now since in this tutorial, SOLO has to be connected to the HALL sensors output of the BLDC or PMSM, If you Monitor the HALL sensor outputs while a brushless motor is spinning in an arbitrary direction you will see the HALL Sensors output something similar to Figure 1 below, and as can be seen, the signals are having 120 degrees of phase shift with respect to each other, and these signals alongside with current measurements done internally in SOLO will eventually lead to control of the Torque on the shaft of BLDC commanded by Raspberry Pi.
Figure 1- A possible output for HALL sensors mounted on a BLDC Motor.
If you study FOC and how it works, you will see that the Torque loop ( current controlling loop) is the closest Loop to the Motor, this means it’s actually the fastest loop to run, but what does this actually mean?
This means the Torque loop has to run fast enough, much faster than the electrical time constant of the Motor (L / R) to be able to stabilize and properly follow the Torque references commanded by an external module ( here Raspberry Pi). In Modern Motor controllers this loop should be executed in matter of 50µs or less, and in SOLO thanks to its Dual-core architecture with parallel processing you would be able to execute this loop up to 7µs which is very fast for the price range of a product like SOLO and it’s comparable with FPGA-based solutions that are priced for much higher costs ( normally in range of 1-2k€).
In the following we will discuss more how to achieve the close-loop control of Torque in a BLDC motor with Raspberry Pi code written in Python using SOLO in HALL sensor mode.
SOLO UNO Data-line Wiring to Raspberry Pi
To proceed with this setup we are using a Brushless DC Motor with part number of “DB56C036030-A” and the technical datasheet that can be read here.
THE HALL SENSOR CALIBRATIONS AND MOTOR’S CONNECTION
If this is the first time you are connecting a motor to your SOLO, you need to make sure at least for one time, you have correctly calibrated the HALL sensors with correct connection of the Motor’s windings to ABC outputs of SOLO, to do that you need to read the article below and do the steps there at least one time, and as long as your Motor or the HALL sensors are the same or the HALL sensors mountings is not mechanically displaced with respect to the Motor, all the calibrated parameters will reside in long term memory of SOLO and they will be remembered after power recycling.
As can be seen in the Python code above, the Raspberry Pi initially sets the Iq Reference at 3.512 Amps which practically means 0.28 N.m of Torque (3.512 * 0.08) on our BLDC as can be seen in Figure 2 below, then Raspberry Pi commands SOLO to stop the motor for a while and this time changes the direction of Rotation and applies a new Iq reference of 2.225 Amps or around 0.178 N.m of Torque as can be seen in Figure 3, that’s why you see the sign of Iq is positive in case of 3.512A and it get negative for 2.225A reference as the direction has been changed.
Figure 2- Quadrature Current Step response of BLDC at 3.512A commanded by Raspberry Pi in CW direction.
Figure 3- Quadrature Current Step response of BLDC at 2.225A commanded by Raspberry Pi in CCW direction.
By looking at these plots you might notice that the references are not exactly placed at the absolute requested value, however you need to consider that as you see in Figure 2 as an instance, while the Motor is steady, it has an offset Iq of something around 0.4Amps that can be the result of many things including the physical characteristics of the Motor itself, the sensors accuracy ( current and Hall sensors) but this offset is pretty much stable within the operational thermal range of the Motor, so considering this offset, you see that once we asked the Motor to stabilize the Iq current at 2.225Amps the current is actually set at 1.86Amps which is shown in Figure 4 that is the zoomed version of Steady state of Figure 2, as mentioned by adding the offset to this value we will have our final reference of 2.225Amps tracked ( 1.86steady state feedback + 0.4offset ):
Figure 4 – Zoomed steady state response for Iq of 2.225A with 0.4A initial offset.
It worth mentioning that in Torque mode, you must make sure there is enough load on the shaft of the motor to resist the Torque applied by the Controller, otherwise for instance if the shaft of the Motor is not loaded, and you put SOLO in Torque mode and ask for a reference of Iq ( like 2.225A) to be tracked you will see that the motor will speed up to its nominal Speed and the Torque remains in far less values than requested torque during steady-state, the reason for this is since there are no Load on the shaft of the Motor, the Torque initially will result in acceleration of the motor and finally it will result that the Motor goes to it’s nominal speed as can be seen in Figure 5 below:
Figure 5 – The effect of No-load Torque test on the Speed on Torque of BLDC.
In our tests for this tutorial, to achieve the Figures 2 and 3, we just locked the shaft of the BLDC, and made sure the shaft doesn’t move at all, so in that case we could see the step response of the requested Iq ( Torques) sent from Raspberry Pi, finally if you have any questions or doubts regarding this article you can ask us in our Forum.
In this article we are going to demonstrate a practical method to correctly connect and setup your quadrature Encoder to SOLO for Torque, Speed and Position controlling purposes. To this end, based on the type of the motor you are using the tuning process will be...
In this article the goal is to set up and calibrate properly the Hall sensors to SOLO for controlling Speed or Torque of your 3-phase motors specially BLDC or PMSM motors. These types of sensors come with 3 wires as each of these wires are representing a digital...
To control the Speed of a BLDC motor with Raspberry Pi as you might know, you will need a Motor Controller that can manage enough electrical power to spin an electrical motor as well as being smart enough to control the motor and resist against the physical...