Purpose This study aims to develop a quadrotor with a robust control system against weight variations. A Proportional-Integral-Derivative (PID) controller based on Particle Swarm Optimization and Differential Evaluation to tune the parameters of PID has been implemented with real-time simulations of the quadrotor. Design/methodology/approach The optimization algorithms are combined with the PID control mechanism of the quadrotor to increase the performance of the trajectory tracking for a quadrotor. The dynamical model of the quadrotor is derived by using Newton-Euler equations. Findings In this study, the most efficient control parameters of the quadrotor are selected using evolutionary optimization algorithms in real-time simulations. The control parameters of PID directly affect the controller's performance that position error and stability improved by tuning the parameters. Therefore, the optimization algorithms can be used to improve the trajectory tracking performance of the quadrotor. Practical implications The online optimization result showed that evolutionary algorithms improve the performance of the trajectory tracking of the quadrotor. Originality/value This study states the design of an optimized controller compared with manually tuned controller methods. Fitness functions are defined as a custom fitness function (overshoot, rise-time, settling-time and steady-state error), mean-square-error, root-mean-square-error and sum-square-error. In addition, all the simulations are performed based on a realistic simulation environment. Furthermore, the optimization process of the parameters is implemented in real-time that the proposed controller searches better parameters with real-time simulations and finds the optimal parameter online.