In this study, the authors introduce a novel approach that leverages the tunicate swarm algorithm (TSA) to optimize proportional-integral-derivative (PID) controller based on a back propagation (BP) neural network. The core objective of the approach is to manage and counteract uncertainties and disturbance that may jeopardize the balance and stability of self-driving bicycles in operation. By using the self-learning capabilities of BP neural networks, the controller can dynamically adjust PID parameters in real time. This enables an enhanced robustness and reliability during operation. Further bolstering the efficiency of our controller, the authors use the TSA to optimize the initial weights of a neural network. This effectively mitigates the commonly associated with slow convergence and being entrapped in local minima. Through simulation and experimentation, the findings reveal that the TSA-optimized BP neural network PID controller dramatically improves dynamic performance and robustness. It also proficiently manages changes in the environment such as wind and ground bumps. Therefore, the proposed controller design offers an effective solution to the balancing problem of self-driving bicycles and paves the way for a promising future in designing versatile controllers with broad application potential.