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 Wiring

Here, the only wiring you need to apply will be only the connection of the Motor to SOLO and by just connecting UART_TX, UART_RX and GND lines between SOLO and ARDUINO.




The UART_TX and UART_RX Lines of SOLO BETA are 3.3V, so if you are going to use it with ARDUINO boards with 5V level UART lines (like Arduino UNO), you need to use circuitry similar to image above, otherwise, if your ARDUINO has 3.3V UART lines (TX and RX) you can connect them directly to SOLO.

arduino uno and solo beta wiring

SOLO Setup

In This example make sure you put SOLO into Closed-Loop control mode by pressing the Piano Switch PIN NO# 5 DOWN similar to image below:

Sensorless Speed Control of a Brushless Motor with ARDUINO and SOLO in Digital Mode using UART Communication 1

The Motor

The Motor used in this example is “teknic m-2310P-LN-04K” and you can download its datasheet from here. Practically this motor is a brushless motor with sinusoidal shape BEMF and they are known also as Brushless AC or PMSM motors.

Sensorless Speed Control of a Brushless Motor with ARDUINO and SOLO in Digital Mode using UART Communication 2

The Code

Code Explanation

Now we will try to explain the most important parts of the code given above, although the code is self-explanatory, but it will be helpful if you also have a deeper look on the detailed explanations below:

Important Note for ARDUINO UNO users

In ARDUINO UNO , there is only 1 line of UART which is shared between the UART to USB convertor of ARDUINO board itself which is also used for flashing the ARDUINO UNO board as well, so whenever you want to program your ARDUINO UNO board through the ARDUINO IDE, YOU need to disconnect the UART_TX of SOLO from being connected to RX of ARDUINO UNO, by not doing this, you might get some errors in ARDUINO IDE during uploading the code.
To know more, read this post on ARDUINO website.

Lines 15 to 42

Definition of some variables that are being used within the code

Lines 48 to 56

Defining the data rate baudrate of UART between SOLO and Arduino, by default the UART baudrate of SOLO is 937500 bits/s or 921600 bits/s if you want to go with PC standards, but there is a possibility to have a different baudrate of 115200 [bits/s] for legacy devices like old version of ARDUINO that they don’t support higher baudrates with acceptable error margin.

However, we strongly recommend to use SOLO with its standard baudrate of 937500 [bits/s] as it offers the best performance and minimum data transmission delay which is critical for high speed operations that SOLO deals with, to control brushless motors.

You can select different baudrates for SOLO using SOLO Motion Terminal.

Line 59

Here we are initializing the instance of SOLO object that we made previously, using such a way of instantiation, you’d be able to create multiple SOLO objects and deal with lots of SOLO’s connected in a network based on their device address up to 254 units.

Line 66 to 72

In this part, we have a loop-wait till we receive a positive return over the serial communication.
Like this, we are trying to make sure the correct connection between SOLO and ARDUINO is established and working. If the connection line is not in place, the program will wait before starting to communicate with SOLO.

Lines 97 to 98

Here we are tuning the speed controller Kp and Ki gains, please remember, the Current controller gains are automatically tuned after the Motor Identification, so the only gains that you will need to tune are the Speed Controller gains. To know more you can visit here.

Lines 102 TO 137

This is the looping part of the code that firstly tries to ask SOLO to spin the Motor with 5000RPM in Clockwise direction and stay in this condition for a while, then by changing the direction and reducing the speed to 1500 RPM and then finally stopping the motor for a short time.

You can read more about our SOLO Motor Controller ARDUINO Library here.

Share This

Share This

Share this post with your friends!