1 Introduction

Developing a prototype of a PMDC motor makes the control process easier. Due to their efficiency, low cost and simplicity, DC motors are considered as valuable component in many areas of research, laboratory experiments and industrial applications [1]. Many industrial applications are expected from PMDCs due to their big thrust force, high speed and high precision [2,3,4,5]. Ease of controller design and implementation makes DC motors preferable over AC motors [6]. Permanent Magnetic DC (PMDC) motors are small in size and do not have exiting circuit resulting in copper loss reduction. PMDC motors have several applications including, but not limited to, drives in computer, toy industries, automobiles, drilling machines and robotics [7,8,9]. The possibility of developing universal motor drives is enabled by digital current regulation and used software control technologies.

1.1 Related work

Research work includes a variety of methods for using PMDC motors in control systems for speed control, and for this purpose, a computer controlled simulator is designed [10] for real time experiments. To design appropriate controller of a given motor, precise parameters estimation is required, both standard and dynamic particle swarm optimization (PSO), ant colony optimization (ACO), and artificial bee colony (ABC) are used in order to estimate PMDC motor parameters [5]. Direct measurements of armature current, voltage and rotor speed are used to identify the PMDC parameters [6]. A Multi-Objective Optimization (EMOO) algorithm to tune the Proportional Integral (PI) speed regulator in the Permanent Magnet DC (PMDC) motor drive system is used [11]. A fuzzy logic speed controller is employed to a PMDC motor [12]. In some control strategies the mathematical model of the system is not required [13]. The PIC16F877 microcontroller is used to implement the controller algorithm [14], and a similar microcontroller is used for computer communication purpose. From previous mentioned related work and as per our knowledge, there is no detail explanation regarding the used PMDC motor prototype which is used as an actuator in this work. Another important point is that: either the work includes PMDC parameters estimation or PMDC motor speed controller design. This motivates us to carry out an integrated work. Current work includes integrated procedure starting with detailed explanation of developing a speed control prototype for a PMDC motor then performing its open loop test, system identification and finally PI speed controller design. A microprocessor (with 8 bit resolution and high performance RISC CPU) based control circuit is designed to receive two types of input signals, i.e. either analog input or pulse width modulation (PWM) input and accordingly gives an analog output in terms of DC voltage through programmed frequency to voltage (F/V) converter. The PIC16F876SP microcontroller is the brain of the previous mentioned circuit, it is programmed in such a way to convert the frequency of coming pulses from the IR sensor to analog DC voltage. This developed prototype enables the process of system identification of the PMDC motor to be easier and makes controller algorithm implementation to be simpler and more efficient.

2 Proposed block diagram of the developed module

Figure 1 illustrates the block diagram of the designed PMDC motor prototype. Front panel acts as the user interface through which the user can give input or take output to/from the PMDC motor. The input is of two types either analog input in the range of 0–4.5 VDC or pulse width modulation (PWM) input, for this case the real front panel is provided with a switch enables the user to select the input type. If the user selects analog input, then he can vary the input voltage in the previous mentioned rang by using a potentiometer provided in the real front panel, also. Selecting analog input operating situation gives the input voltage to the PIC 16F876SP microcontroller which in its turn converting the analog input to a pulse width modulation signal programmatically. In the case the user selects pulse width modulation input (PWM) operating situation, then the PIC 16F876SP microcontroller gives a logic high (or 1) to an AND gate with two inputs where the other input is the pulse width modulation (PWM) signal from the front panel itself. However, in both cases, i.e. analog input or pulse width modulation input (PWM) the resulted pulse width modulation (PWM) signals will be provided to the gate pin of the IRF 1540 MOSFET transistor, taking into consideration two important points: (1) giving a logic one of an AND gate with any other input will result the other input only as output of this gate, (2) the mentioned MOSFET transistor will accordingly convert the pule width modulation (PWM) signals having range of 0–4.5 VDC on its gate to PWM signals that applied to the PMDC motor armature in the range 0–12 VDC.

Fig. 1
figure 1

PMDC motor prototype proposed block diagram

Once the PMDC motor starts rotating the IR sensor takes the task of providing the pulses as an input to the PIC 16F876SP microcontroller then the microcontroller performs an important function of converting the frequency of coming pulses into an analog output in the range of 0–4 VDC, so in this case the microcontroller acts as a frequency to voltage (F/V) converter.

From this PMDC motor prototype developed module, the user has a benefit of the possibility of interfacing any other microprocessor (or microcontroller) or programmable logic controller (PLC) with this module and a benefit of measuring the speed of the PMDC motor by that PIC or PLC by simply making calculation of scale speed from the resulted output analog voltage. Figure 2 shows the real front panel of the described PMDC motor prototype module.

Fig. 2
figure 2

PMDC motor developed prototype front panel

Additional components can be recognized from the figure of the real front panel such as ON/OFF switch which used to connect or disconnect the power to the module. And a fuse which will protect the module from any dangerous situation such as high current consumption in the case of short circuit for example. Reference analog input pins are used to supply a voltage of value 4.5 VDC to the analog input pins and with the help of a potentiometer, this analog input can vary between 0 and 4.5 VDC. In addition to that there are two LEDs, the red one is used to indicate the power ON, and the green one is used to indicate the PWM input mode.

3 PMDC motor prototype design: development procedure

Development procedure includes: main circuit design, feedback mechanism design, and magnetic load mechanism design. The PMDC motor kit has the following specification: the speed range is between 0 and 1500 RPM, the input Voltage is between 0 and 12 VDC, and the input current is 1.5 Amp. All mechanical parts are mounted on the top of a metal box and the electrical circuit is fixed inside this box. This will ensure a stable work of the designed prototype. The following paragraphs explain in details the work procedure to integrate them together to come out with the prototype kit.

3.1 Main circuit design

This stage of the work includes the procedure of simulation test of the proposed block diagram using PROTUS program where the code of the PIC 16F876SP microcontroller is written in BASCOM software and the resulted (.exe) file is uploaded inside the microcontroller in PROTUS program. Once satisfying simulation results are obtained the procedure of real circuit design takes place. Figure 3 shows the fabricated real circuit which gives the intelligence to the developed prototype as the PIC 16F876SP microcontroller acts as a core of this smart circuit.

Fig. 3
figure 3

Fabricated real circuit

This fabricated circuit is connected with the previous mentioned real front panel from one side and with the IR sensor from the top side. Figure 4 illustrates its connections with the real front panel from inside.

Fig. 4
figure 4

Fabricated real circuit connections with the front panel

There is a bulky transformer as shown from Fig. 4. It is used to get a 12 VDC from 220 VDC and can provide up to 3 VDC after rectifying. That means the real circuit receives 12 VDC from the secondary coil of the transformer and then rectifying it to get two values in terms of VDC. One value is 5 VDC, this value is used to power the microcontroller side, and the other value is 12 VDC which is used to power the PMDC motor through the MOSFET source pin.

3.2 Feedback mechanism design

The PMDC motor shaft is elongated to be occupied with two mechanisms, one mechanism is the load mechanism (will be explained in the next section), and the other one is the feedback mechanism. A/U/shape IR sensor, with infrared light source from one side and an infrared light detector from the other side, is fixed to allow a slotted disk, with 12 holes, mounted on the shaft to run freely. This will result in 12 pulses per one full rotation to be provided to the microcontroller side which will take the task of F/V converter. Figure 5 depicts the designed feedback mechanism.

Fig. 5
figure 5

Designed feedback mechanism

3.3 Magnetic load mechanism design

A circular metal plate is mounted on the PMDC shaft as shown in Fig. 6. Circular to linear motion conversion function is developed and fixed on the top of the box; variable number of magnetic pieces can be put in a rectangular metal plate that can be moved linearly opposite of previous mentioned circular metal plate. As the circular metal plate is rotated along with PMDC motor shaft rotation and the rectangular metal plate is moved in a linear way, once the rectangular metal plate reaches against the circular one the magnetic load is applied to the PMDC motor shaft. This load is proportional to the magnetic piece number which fixed on the rectangular plate. This is considered as a kind of speed disturbance and will cause speed reduction of the PMDC motor shaft.

Fig. 6
figure 6

Designed magnetic load mechanism

Four load stages are recognized with the above mentioned load mechanism and they are illustrated in Fig. 7. A load stage is nothing but one magnet piece in front of the rotating metal plate which is fixed to the motor shaft, i.e. as the number of the magnetic pieces increase, another load stage comes into consideration.

Fig. 7
figure 7

Load mechanism stages

Each load stage will cause a reduced speed of nearly 150 RPM as it is shown in graphical view (Fig. 8).

Fig. 8
figure 8

Load stages in graphical view

4 Test procedure for the designed PMDC motor prototype

The experimental setup is shown in Fig. 9. The Arduino Mega development board is used after installing its MATLAB support package. This board will read the analog output of the designed prototype and it will provide the PWM signal to it.

Fig. 9
figure 9

Experimental setup

4.1 Open loop test

As the main goal of the developed prototype is to control the speed of the PMDC motor, it is helpful to find a methodology in such way that enable the user to give an input speed as a command to the PMDC motor and obtain its output speed. However, this designed module accepts inputs in terms of volts, i.e. 0–4.5 VDC and gives a response in terms of volts, i.e. 0–4 VDC also. In order to give an input in terms of speed, one important term is to be derived. This term is the process gain. The process gain is the ratio between the input voltage and the resulted output speed. If the process gain is known then the user will be able to provide an input speed to the PMDC motor. The output speed can be calculated simply by scaling the output voltage: the PMDC motor speed is between 0 and 1500 RPM for output volt between 0 and 4 VDC. For this purpose and with the help of MATLAB SIMULINK and ARDUINO support package for MATLAB SIMULINK, Table 1 is developed after interfacing the Designed PMDC motor Prototype with MATLAB program using ARDUINO mega board. Now the process gain can be computed and it is equal to 0.0028.

Table 1 Input and output data of the PMDC motor

The open loop circuit (as shown in Fig. 10) is developed in MATLAB SIMULINK, in this circuit: R (t): reference speed, U (t): input volt, and X (t): Output speed.

Fig. 10
figure 10

Open loop circuit diagram of the PMDC motor

Figure 11 shows the open loop output speed of the PMDC motor. This is obtained by providing the input speed followed by the process gain and measuring the output speed by scaling the output voltage.

Fig. 11
figure 11

PMDC motor open loop test

5 System identification and pi speed controller design

A Pseudo Random Binary Sequence (PRBS) test [15, 16] is used for the system identification process, and this will insure that: the obtained mathematical model of the PMDC motor is a result of random sets of PWM signals applied to the motor armature. During the operation conditions of the motor, it is expected to work with different speed trajectors and in other situations the load disturbance is to be rejected, for those work conditions the PWM signals applied on the motor armature will not be contant and they vary randomly. So the following input signals (as shown in Fig. 12) are applied by using PRBS signals generated in a developed matlab Simulink model and the resulted output signals are captured.

Fig. 12
figure 12

Pseudo random binary sequence (PRBS) test

The input PWM signals are given to the motor with the help of ARDUINO support package from MATLAB and the output is obtained using analog read block. Input and output data are imported to the system identification tool, then the following transfer function is obtained by using sampling time equal to 0.001 s:

$${\text{G}}_{\text{s}} = \frac{{92.46 {\text{s}} + 4.893}}{{{\text{s}}^{2} + 124.2 {\text{s}} + 4.173}} .$$
(1)

Then one of the performance indices, i.e. Integral Absolute Error (IAE) [16, 17] is used as an objective function of an optimization tuning algorithm for the PI speed controller design using MATLAB Optimization Tools. The Integral Absolute Error performance index is selected because it results the minimum error area. IAE is given mathematically by the following equation:

$${\text{IAE}} = \mathop \int \limits_{0}^{\infty } \left| {\text{e(t)}} \right|{\text{dt}} .$$
(2)

The reason of using PI controller instead of PID controller is that: on each evaluation of the objective function, the performance index is calculated based on the multiple-application Simpson’s 1/3 rule [18], which basically intended to calculate the integration numerically, so when the derivative term is included during the tuning procedure its value was negligible and therefore its effect on the motor speed. The equation of the PI controller is:

$$u(t) = k_{P} e(t) + k_{I} \int e(t)$$
(3)

where kP: is the proportional gain and kI: is the integral gain. Equation (3) can be written in equivalent form as:

$$u\left( t \right) = k_{c} \left( {e(t) + \frac{1}{{t_{i} }}\int e(t)} \right)$$
(4)

where

$$k_{P} = k_{c}$$
(5)

and

$$k_{I} = k_{c} *\frac{1}{{t_{i} }}$$
(6)

where kc and ti are the proportional gain and the integral time constant respectively. The following circuit diagram shown in Fig. 13 developed in MATLAB SIMULINK, it includes the PI controller along with the PMDC motor.

Fig. 13
figure 13

PI controller with the PMDC motor

The resulted proportional gain and integral time constant are kC = 0.1587, ti = 0.0037, respectively, i.e. kP = 1.1587 and kI = 42.8. Both disturbance rejection and set point tracking of a designed PI speed controller are shown in Fig. 14.

Fig. 14
figure 14

Disturbance rejection and set point tracking (simulation)

Both proportional gain kP and integral gain kI reduce the rise time of the motor speed response. However the integral gain kI keeps the motor speed to follow the new speed trajectory fastly. If the derivative term is included the overshoot will be reduced. For simulation test (Fig. 14), A set point equal to 900 RPM is given to the PMDC motor, then this reference speed is changed to become 1100 RPM at simulation time 5 s and the PMDC motor follows the new speed, after that the reference speed is changed to become 1300 RPM at simulation time equal to 10 s and the controller forces the motor model to run at the new speed. At simulation time equal to 21 s a positive disturbance is applied and the controller rejects this disturbance and comes back to the required speed, then a negative load is applied at simulation time equal to 24 s and the controller makes the motor model to return back to the required speed.

For practical (real time) test (Fig. 15), same above mentioned test sequence is applied practically to check the ability of the designed PI speed controller to make the PMDC motor to track the preferred speed and to reject any disturbance its shaft. Figure 14 shows the practical (real time) response of the designed PI speed controller.

Fig. 15
figure 15

Disturbance rejection and set point tracking (real time)

Controller response characteristics are illustrated in Table 2, where RT, ST, OSH and IAE are Rise time, Settling time, Overshoot and Integral Absolute Error performance index, respectively. The unit of Rise time and Settling time is in milliseconds (ms). As the simulation test tends to give ideal response, it is a normal situation to obtain the difference between simulation and real time results. The practical (real time) response is near to simulation response and, from Fig. 15, the controller behavior is acceptable.

Table 2 Controller response characteristics

6 Conclusion

A detailed explanation of a developed PMDC motor prototype is carried out through this paper. An open loop test, system identification and PI speed controller design are performed to ensure that the designed prototype is working properly and satisfying results are obtained. A PBRS test is used for system identification procedure as it gives the real behavior of the PMDC motor under different working conditions. An optimal controller tuning is performed based on the multiple-application Simpson’s 1/3 rule by using the Integral Absolute Error (IAE) performance index as an objective function of the tuning algorithm. Controller response characteristics for both simulation and real time tests are recorded and reseanable results are obtained. In simulation test, the characteristics is in its ideal case, i.e. smaller values of the characteristics are obtained. However, a larger characteristics values are resulted from real time test and this is expected and reasonable with the physical world. The developed prototype can be used for further research purposes. Multiple numbers of this developed prototype can be used for doing research related to industrial applications such as distributed motion control or any other aspects of the industry. Newly growing technologies such as Industrial Internet of things (IIoT) can be integrated with the industrial research included a multiple number of the PMDC motor prototypes.