SN Applied Sciences

, 2:202 | Cite as

Fast response fuzzy logic controller optimized by bats sonar algorithm

  • Nurainaa EliasEmail author
  • Nafrizuan Mat Yahya
Research Article
Part of the following topical collections:
  1. Engineering: Advances in Mechatronics Engineering: Embracing Industry 4.0


This paper proposes a DC servo motor that is used for the crane system where the system is implemented by a controller that has been optimized by a bat sonar algorithm. With the new designed optimized controller, a faster angular position of the crane system can be generated. Unlike the normal approach, this method of an optimization technique is applied to the designed controller to tune the controller’s parameters can improve the stability and also the transportation time. The method involving the comparison between the system with and without the fuzzy logic controller. Besides, there are also comparisons of the fuzzy controller optimized by the bat sonar algorithm. This application is conducted in the real-time experiment setup. The system performance is evaluated based on the system responses such as rise time, settling time, steady-state error and percentage of overshoot. From the experiment, it found that designing fuzzy with optimizing algorithms gives a 20% faster response compared with the normal one. Looking into the future, this work will lead to faster dynamic response.


Fuzzy Optimization Bat algorithm Step response DC motor 

1 Introduction

In numerous heavy load transportation industries where the use of transportation for the loading and unloading materials is needed, the control of crane systems must be well-established in the research field [1]. The important of crane that has to transport components or materials horizontally and vertically is well known especially for the project in high-rise construction [2]. As nowadays, cranes are a central part of many construction functioning and running, the works cannot operate smoothly without the aid of a crane. However, failure to preserve safety while managing cranes can lead to damage to the equipment and building or even serious injuries and accidents to the workers [3]. Therefore, a DC motor is introduced so that cranes can be used automatically and also minimizing the cause of danger and also accidents.

DC motors are commonly used in industrial applications, robot manipulators and also home appliances where there are the needs of speed and position. The motor is used in a wide variety of crane systems including shore container cranes, shuttle conveyors and also pallet loaders because of the speed control since speed control is a crucial element in crane drives [4]. For getting smooth and faster starting and stopping of the travel motion, the use of DC motor is required. And also to acquire accurate positioning for load, DC motor is highly preferred to be used. Because of the precision during loading and unloading materials or components, the possibility of running at a very low speed and hold the load in the standstill is essential, without the use of mechanical brakes [5]. Of course, the use of a sensor also can contribute to the stability and accuracy of the loading and unloading process. However, for this research project, the main focus will be on the controller itself only. The torque and power are carried by the drive can be acquired from the torque versus speed characteristic from the load (so-called mechanical characteristics) and the differential equation of motion [6]. Hence, to achieve also both accuracy and stability, the controller will be implemented into the DC motor control system.

The controller gives great significance for the DC motor system where the position control can be attained through the position sensor that is coupled with the motor shaft for providing a feedback position signal. The most conventional controller that widely used in the industry nowadays is the fuzzy logic controller. Fuzzy logic required less complex mathematical operations make it unnecessary to use a very high-speed processor [7]. When comparing fuzzy with the traditional controller, fuzzy has many advantages such as the simplicity of design, good performance in terms of step response and also can be turned easily by using algorithm [7].

The turning of the algorithm also can be a way for giving great achievement in getting both motion and stabilization control of the DC motor. Controllers are generally tuned for obtaining the desired performance according to the specific criteria. Algorithms like particle swarm optimization (PSO), genetic algorithm (GA) and also bat algorithm (BA) use for the optimization method of the controller. Since BA is much superior to other algorithms in terms of accuracy and efficiency [8], BA will be implemented to this optimization problem.

Summarily this research is an adaptation of the crane system that used DC motor control by fuzzy logic controller optimized using BA to achieve both stability and accuracy. The proposed fuzzy with BA optimization will be then implemented through a real experiment where the prototype of the crane system will be done.

2 Methodology

2.1 Fuzzy logic controller

The first step is by designing the fuzzy logic controller. Matlab toolbox is used as the platform to simulate the controller. In the fuzzy toolbox, five main components need to be defined for generating the fuzzy controller which are fuzzy logic designer also known as FIS editor, membership function editor, rule editor, rule viewer and surface viewer. For declaring the input and output, a FIS editor is used. In this project, 2 inputs and 1 output are applying to get the variances in position. The inputs (error and change of error) and output (distance) required to be fuzzified by the membership function editor. Inputs and output variables will consist of seven fuzzy sets since 7 × 7 membership function is chosen for these cases.

After that rule editor will produce a set of predefined rule types that have been inserted in the membership function editor. 49 rules are applied to get a more accurate range of error and also give details based on the specification for each case in the membership function. When the rule editor ready declared, the rule viewer will display the outcome. The rule viewer allows the entire fuzzy inference process to be interpreted. Besides that, the rule viewer will display the shape of certain membership functions that can impact the overall result. While for surface viewer is to check out the output surface from the fuzzy inference system. Figure 1 shows the overall design for the fuzzy logic controller. As shown below, to design a fuzzy logic controller firstly there must be the FIS editor that consists of 2 inputs which are error and change of error and also output which is the distance. For the membership function editor and rule editor, 49 rules have been made starting from positive large until negative large.
Fig. 1

An overall overview of the designed fuzzy inference system

After designing the fuzzy logic controller, optimization by BA will be done. Membership function structure is chosen as a part that will be optimized since the membership function contain both inputs and output can be defined easily. BA will be run for 30 times and the iteration that nearer to zero is selected to be inserted into the membership function editor. The new design of fuzzy will be generated in the surface viewer and the FIS file of the controller will be produced in Matlab. The FIS file then will be converted into Arduino coding. The conversion process is known as Inference Arduino converter.

2.2 Experimental implementation

The designed fuzzy logic that has been optimized by BA is experimentally implemented using Arduino Mega 2560 through hardware. Two potentiometers will be used where one will be coupled with the DC motor shaft to sense the actual position of the motor while the other one used for set position.

For the hardware implementation, the power pin is connected directly to the Arduino 5 V for generating a + 5 V signal. In two analog inputs, one is for A0 that apply for set value while A1 for the actual value of the position. And also to obtain 360°, the output must be equivalent to a 5 V signal. The voltage can be varied from 0 V to 5 V so that the position also can be varied. When the angle is 0°, the motor will not rotate. When the value is positive, the motor rotates in forwarding direction else in a negative direction.

From the theory, fuzzy that has been optimized will be more accurate and reliable compared without using the controller and also only using the fuzzy logic without optimization. So, the hardware implementation is made up to prove the theory. Figure 2 shows the photo view of hardware implementation.
Fig. 2

Experimental setup photo view

3 Results and discussion

Several tests were carried out for analyzing the performance of the designed fuzzy logic controller. The first parameter that needs to evaluate is the performance of the prototype running without using the fuzzy logic controller and the second one is by using the fuzzy logic controller. The third one is by using the fuzzy logic controller that has been optimized by using BA.

Figure 3 shows the position versus time curve of the prototype of the crane system that uses DC motor under no load condition with an angle from 0° to 360°. From the response, it is comprehended that the position accelerates moderately at the beginning time and maintains constants when the final position is reached which is 360°. Input reference is used as the set to determine the reference point for each parameter. Fuzzy that has been optimized by BA settles the position faster than other parameters which are at 3.6 s. Besides that, newly designed fuzzy with BA has 20% more in terms of time to reach the position compared with the input reference one.
Fig. 3

Experiment response at position (0–360) in all parameters

From the above result, the fuzzy optimized by BA shows better dynamic response but the complete comparison will be shown in Table 1.
Table 1

Hardware results comparison




Without fuzzy controller

With fuzzy controller

With fuzzy controller optimized by BA

Rise time (s)




Settling time (s)




Overshoot (%)




From the experimental results, it shows that all parameters did not have overshot and also steady-state error. But in terms of rising time, a fuzzy controller with optimization is better since it response faster by 0.1 s compared to a system that uses the fuzzy controller only and also 0.4 s when compared with a system that did not the fuzzy controller. Fuzzy logic optimized by BA also can be settled faster compared to other parameters that were expected. Conclusively, the fuzzy controller optimized by BA can reduced the rise time and settling time without having any overshoot and also steady-state error although by a small amount.

4 Conclusion

This paper presented an adaptation of a crane system with the fuzzy logic controller based position control of the DC motor that has been carried out by the real experimental. Overall, the position of the DC motor can be tuned and changed accordingly to the required value easily. The output for motor position actuator with fuzzy logic optimized by BA obtained with better performance, stable and accurate as of the desired set point compared to the system that did not use fuzzy controller and system that only uses fuzzy without the optimization.

For the control system in the fuzzy controller, it is inessential for substituting the control parameter at any conditions compared to the classical controller like PID. Therefore, it is logical that the fuzzy controller has more beneficial compared to other classical controllers and also fuzzy optimized by BA can give a better dynamic response since the settling time is very low compared to using fuzzy only.

For the future works, the prototype will be design more accurately to the actual crane system. Since for this research, the load for hanging is ignored, hopefully for the next researcher can also experiment will multiple weight of load for more accuracy and for getting precision result.

Summarily, this proposed scheme can be used for the crane system application of position control drive since the crane system also has the feature that needs to move from one angle to other angles.


Compliance with ethical standards

Conflict of interest

On behalf of all authors, the corresponding author states that there is no conflict of interest.


  1. 1.
    He W, Zhang S, Ge SS (2013) Adaptive control of a flexible crane system with the boundary output constraint. IEEE Trans Industr Electron 61(8):4126–4133CrossRefGoogle Scholar
  2. 2.
    Won I, Hoang NQ, Lee S (2018) Comparative study of energy-based control design for overhead cranes. Int Robot Autom J 4(3):197–203Google Scholar
  3. 3.
    Kim JJ, Lee SG, Lim TG, Nho LC (2014) Second-order sliding mode control of a 3D overhead crane with uncertain system parameters. Int J Precis Eng Manuf 15(5):811–819CrossRefGoogle Scholar
  4. 4.
    Jaafar HI, Mohamed Z, Jamian JJ, Abidin AFZ, Kassim AM, Ab Ghani Z (2013) Dynamic behaviour of a nonlinear gantry crane system. In: 4th international conference on electrical engineering and informatics, ICEEI 2013. Science Direct, Malaysia, pp 419–425 (2013)CrossRefGoogle Scholar
  5. 5.
    Ahamad NBB, Su CL, Zhaoxia X, Vasquez JC, Guerrero JM (2018) Modeling and controls of flywheel energy storage systems for energy harvesting from harbor electrical cranes. In: 2018 IEEE industry applications society annual meeting (IAS), pp 1–8Google Scholar
  6. 6.
    Solihin MI, Wahyudi, Legowo A (2010) Fuzzy-tuned PID anti-swing control of automatic gantry crane. J Vib Control 16(1):127–145CrossRefGoogle Scholar
  7. 7.
    Espin-Andrade RA, Gonzalez E, Pedrycz W, Fernandez E (2016) An interpretable logical theory: the case of compensatory fuzzy logic. Int J Comput Intell Syst 9(4):612–626CrossRefGoogle Scholar
  8. 8.
    Gandomi AH, Yang XS, Alavi AH, Talatahari S (2013) Bat algorithm for constrained optimization tasks. Neural Comput Appl 22(6):1239–1255CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2020

Authors and Affiliations

  1. 1.University Malaysia PahangPahangMalaysia

Personalised recommendations