How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode 1
Written by Staff
03/06/2020
How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode
In this tutorial we are going to have our hands on SOLO controlling the speed of a DC motor using ARDUINO as the commanding unit. SOLO, here, controls the speed of the DC brushed motor in a closed-loop sensorless manner with nested Torque-Speed loops. If you are not familiar with the mentioned terms like closed-loop control, sensorless control or nested torque-speed terms, don’t worry, you actually don’t need to know them to be able to use SOLO, and you can skip the next explanations directly to the tutorial itself.

What is a Closed-loop control?

A closed loop control comes in contrast with open loop control, and what it truly means, is a controller which commands and checks later the behaviour of the system under control based on the command sent. In another word a closed-loop controller keeps monitoring the system all the time and tries to force the system ( here an electrical motor ) to follow what it has been asked, the engineering terms for each of these actions are:
The reference or the set-point: This is our desired goal, the actual value that we hope our system reaches into, you can put it like your desired speed of the rotation of your motor, or the desired temperature of a room or even the desired position of a robot arm.
The Feedback: this is what comes back from the system under control as a measurement to the controller, it can be the real measured speed or torque value of a motor, and this parameter tells to the controller how far the controller needs to push the system to reach the desired value known as the reference.
The Error: this is the difference between the feedback and the reference. This shows how good the feedback is following the reference or in another word how far they are from each other, in an ideal controller, after a finite time the Error should become ZERO!

How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode 2

What is Sensorless Control?

This term despite looking self-explanatory might be a little bit hard to grasp, so we’ll put it in this way:
The sensorless speed or Torque control refers to those type of controls in which they don’t require the user to use Encoders or other types of position sensors like Hall-Effect or Tactile sensors, so these controllers are able to detect and calculate the position and the speed of the rotor of the motors and subsequently eliminating the need for having any other kinds of sensors, but this is not their biggest advantage, their main advantages could be considered as:

1- Reduction of the components used, like sensors or the electronics used to run and condition the sensors outputs ( like the supplies, level shifters , … ) , which will reduce the probability of failure of the whole system due to having less components involved.

2- Reduction of Wiring in a system, so by using sensors of any kind, you’ll need to wire the sensors all the way from the position of fixation of the electrical motor to the control unit, this will make the assembly of the system harder plus bringing all the issues with wiring like limitation of distance, possibility of failure of the wire, bad junctions and so on.

3- Reduction of the Cost, it’s very apparent from the above mentioned reasons, how one can reduce the final cost of their system by eliminating the whole costs of sensors and wiring.
Of course like any other solutions, there will be pros and cons using sensorless methods, their main drawback can be considered as:

– Having a Minimum Speed restriction, these methods mostly rely on the feedbacks of voltage, current or BEMF coming back from the Motor, so if the motor doesn’t generate sufficient values the sensorless methods will have hard time to start their operation, as a result there’s a limit in minimum rotational speed defied, meaning that the sensorless controls can only start from a certain minimum speed in range of tens of RPM ( like 100 RPM ), so you can’t expect them to be very accurate in low speeds.
But altogether, the sensorless methods are very popular and desired in lots of systems like traction units and all the applications that the extreme precision of speed control is not a matter.

What is nested torque-speed loops control methodology?

This term stands for those methodologies of control in which they control both torque and speed together. The torque loop which in practice controls the current, comes as the inner loop with a very fast sampling rate ( normally above 10kHz), to keep track of the current of the motor and controlling it.The speed loop though, comes behind the torque loop and it’s a much slower loop (sampling rate normally around 1-2kHz) controlling the speed of the motor. These types of control methods are rather advanced and using these methods enables the motor controllers to avoid any unwanted inrush current in the beginning of the operation of the Motors plus numerous other advantages like better performance, safety of the whole system and so on.

How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode 3

The steps of setting up and using SOLO alongside with ARDUINO

0) Turn off the system

Make sure you have disconnected the power supply connected to SOLO or any other peripheral which is in contact with SOLO.

1) Apply the Wiring

To start with SOLO first you need to provide the Wiring of SOLO to ARDUINO as following:

How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode 4

As you can see SOLO is also capable of supplying ARDUINO Directly through its 5V output and as a result you will not need to have ARDUINO connected to any other devices like a PC to provide you the power.

s
Warning: make sure you don’t supply the ARDUINO  both from your PC using USB or any other supply and Then the  5V from SOLO at the same time, you should use only one of the supplies especially in ARDUINO  UNO models where they can’t switch the supplies and this might cause issue for the system

2) Select the Motor type using Piano Switch

Here we are using a DC brushed Motor, so we should put PIN 1 and 2 of the piano switch into ON position (Down) SOLO will be set on DC motor configuration with 20kHz of switching frequency at its output ( this switching frequency is suitable for lots of DC motors and if you are not familiar with this, you can leave it as default)
How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode 5

3) Reset the Kp and Ki potentiometers

Just rotate the two blue potentiometers shown below all the way in Clockwise direction into the blocking point ( please treat them gently! ) , so their value becomes zero.

How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode 6

4) Turn On the system

JNow you can turn on the main supply connected to SOLO’s power input (8-58V) and SOLO will immediately boot up with a blinking “E2” LED while “E1” LED is off which is the indication of a safe startup with no errors or malfunctions ( like over current, over voltage, … )

5) Put SOLO into speed control Mode

How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode 7
Just put the piano switch number 4 in ON position by pushing it down.

6) Put SOLO into closed-loop mode

since the control type we are using here is among the closed-loop controls, you need to push the Piano switch number 5 down, when you do that, SOLO in less than a second will identify your motor parameters and it will store them on it’s non-volatile memory, during this time if the shaft of the motor is free, you might witness some little vibrations which are totally normal. So as long as the Piano Switch number X is down, the last saved parameters will be used, even if you turn off the whole system and turn it back on again, the parameters will remain safe until re-identify them by pushing down and pulling up the same pin in the piano switch. In General Under the following conditions you need to pull up and pull down again the piano switch number X :

  • In case of changing the Motor
  • In case of changing the wiring of the motor ( not mandatory but better to be done)
  • The very first time you run SOLO and you put it into closed-loop ( after receiving the factory made module )
How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode 8

7) Tune The Kp and Ki gains

Turn a little bit the “Kp” potentiometer( like 5 degrees in counter clockwise direction ) and for a very small amount “Ki” ( much less than Kp, around 1 or 2 degrees), the best is you watch the video up there to master this. In general these two potentiometer are like some gains and in a simple language they can be defined as:

Kp: defines for you how fast your motor should react and reach the speed you asked, so if you increase this value, your motor will be more reactive, but too much of this gain might make vibrations, so you need to tune it enough. Also another effect of this gain will be how “harshly” the controller ( here SOLO ) should react to the variation of the load on the shaft of the motor to keep the speed constant, so in case of using this functionality in a mobile robot as an instance, if you increase Kp of SOLO, and the robot reaches to some ramps, it will adjust it’s speed faster but also it might make your robot too fast. So it’s not always good to increase this gain, it totally depends on your system.

Ki: defines how good your motor during time should reach the goal, so by increasing this value your motor might reach the goal slower but more consistent. Also by increasing this gain too much your motor might get unstable. So you need to tune this similar to Kp with patience and accuracy.

In general the first time you tune these two gains, as long as you are using the same Motor in the same system you won’t need to touch them, it’s only the matter of the first time.

7) Send PWM pulses from ARDUINO to SOLO

one of the methods of commanding SOLO is using pulse width modulation ( PWM) method, in this method you will send some digital pulses whose high-state is 5V and their low-state is 0V. These pulses should have any frequency above 5kHz ( the higher the frequency the better the resolution). Now by varying the duty cycle of these pulses you can increase or decrease the torque of your motor from No torque ( 0% duty cycle ) to maximum allowable torque ( 100% duty cycle).
How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode 9

Results

As you can see in the image below which is a real time plot of Torque-Speed of a DC brushed motor controlled by SOLO in closed-loop sensorless speed control mode. As you can see, the speed of the DC motor ( green plot) remained constant even at those moments where a load applied to the shaft of the motor, you can find the moments that the load has been applied from the Torque ( red plot) , because whenever a load has been applied on the motor, SOLO automatically increases the Torque of the DC motor to overcome the load and keep the speed constant.
How to control the speed of DC motor using ARDUINO and SOLO in closed loop sensorless mode 10

Related Articles

Boosting your electric scooter with SOLO

Boosting your electric scooter with SOLO

We have just finished the latest prototype of SOLO and now its time to put it into action. And guess what! We choose to test it with a real product: an Electric Scooter. We just bought a second-hand TAKIRA scooter right from Amazon and try to boost it by using SOLO...

0 Comments

Submit a Comment

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

Share This

Share This

Share this post with your friends!