With the increasing environmental problems, two-wheeled balanced car will be widely used in urban traffic in the future due to its excellent performance and low carbon environmental protection. From the analysis of the control system of the whole two-wheeled self-balancing car, it has instability and multiple control variables, so it has high academic research value.Based on the design scheme of two-wheeled self-balancing car, this paper abstracts it into a first-order inverted pendulum, carries out force analysis and establishes a mathematical model. Secondly, considering the function of the self-balancing car, this paper completes the hardware construction of the system. STM32F103C8T6 is selected as the controller, and MPU6050 with integrated gyroscope and accelerometer is used to realize vehicle attitude detection. On the basis of hardware design, this paper adopts PID control to realize the upright, forward and backward motion and steering functions of the two-wheeled self-balancing car. Finally, the system debugging of the two-wheeled self-balancing car is carried out. The car can be upright on power without external force, and it can quickly adjust its posture and restore to the balanced upright position when moderate external force disturbance is added. When the corresponding instructions are issued, the car can complete a series of actions such as forward, backward and steering.