# DC Motor Implementation in Simulink MATLAB

In this tutorial, we will discuss the workings and implementation of a simple DC motor using MATLAB Simulink. At the start, we provide a comprehensive and concise introduction along with a physical overview. After that, we will explain the implementation of a DC motor using the Simulink model.

## Introduction to DC Motor

DC means “Direct Current”, and due to the preexisting power distribution system, these motors could easily be controlled. The current flow in the wiring controls the speed of the motor. It has a direct relationship. A DC motor is a device or machine that converts DC power into mechanical energy. Its operation follows the principle that when a conductor carrying current is placed in a magnetic field, the conductor experiences a mechanical force. Fleming’s left-hand rule gives the direction of force.

Let’s now implement a simple DC motor using MATLAB’s Simulink. First, open and create a Simulink model in MATLAB, as we have been doing in all these previous tutorials. Open MATLAB and then Simulink, and after that, create a blank Simulink model. After the creation, before jumping into the designing, it is important to discuss that, in Simulink, a simple DC motor can be designed using two completely different methodologies. The first is to design a DC motor using a DC motor block from a power system block, as shown in the figure below.

And the other method to implement a DC motor is to construct it using gain and sum blocks. In this tutorial, we will implement the later method. So, now let’s jump to the implementation portion, and from the library browser, first of all, place the input block with the name step. Select sources, then select step blocks and add them to the model as shown in the figure below.

#### Sum Block

Now we will need a sum block to add the feedback from the motor to the main input. In the library browser, go to the sub-block with the name Math operations, select the sum block, and add it to the model. Refer to the figure below.

In the same math operation subsection, select the gain block and also add it to the model, as we can see in the figure below.

We will need multiple sum and gain blocks, so remember the path for future placement of these blocks. Now, from the commonly used blocks section, select and add the block named integral to the model. Refer to the figure below.

#### Scope Block

Also, we need to display the output of the motor on an oscilloscope. To make it easier, select a scope for the sinks subsection of the library browser and add it to the model as shown in the figure below.

Here we are done with adding blocks to the model. We will now move towards designing the block diagram. On the input side, place the step input block and a sum block. Double-click on the sum block to change its number of inputs and update it to +–, as shown in the figure below.

#### Input Blocks

At the sum terminal of the sum block, connect the input step, and at one of the subtract terminals, connect the gain block, as shown in the figure below.

In the parameters block of this gain block, write Ra in place of gain (which we will update later), as shown in the figure below.

At the output of the sum block, connect another gain block and change its gain to 1/L (inductance), as shown in the figure below.

At the output of this gain block, connect an integral block, the output of which will be connected to another gain block and also to the input of the Ra gain block, as shown in the figure below.

This will end the 1st stage, and now we will design the second stage, which will be the same as the first stage, except that the output from the integral of the second stage will be sent back to the subtract terminal in the sum block of 1st stage through a gain block. At the output of the Km gain block, connect a sum block with two input terminals (one + and one -), the output of which is connected to another gain block 1/J, the output of which is connected to an integral block, whose output will be provided to both the sum blocks as feedback, as shown in the figure below.

We will connect a scope at the output of the second integral block, as shown in the figure below.

Figure 13: Complete diagram

Now we need to set the parameters of the gain block according to our needs. In this example, we will set the parameters as shown in the figure below.

Figure 14: Parameters

#### Simulation

So, now run the model and observe the output on the scope by double-clicking on it. The output of the motor is critically damped, which we can adjust by changing the gain Kb according to our needs. The output of the motor is shown in the figure below.

Figure 15: Output

## Conclusion

In conclusion, this tutorial provides an in-depth overview of implementing DC motors in Simulink. It covers step-by-step procedures along with an explanation of an example to help us better understand the concept. Hence, you can utilize this to design and implement more advanced DC motor circuits. Hopefully, this tutorial was helpful in expanding your knowledge of Simulink.

You may also like to read:

This concludes today’s article. If you face any issues or difficulties, let us know in the comment section below.