Abstract. The smart car is designed based on Freescale's MC9S12XS128 and a linear CCD camera. The linear CCD collects the road information and sends it to MCU through the operational amplifier. The PID control algorithm, the proportional-integral-derivative control algorithm, is adopted synthetically to control the smart car. First, the smart car's inclination and angular velocity are detect through the accelerometers and gyro sensors, then the PD control algorithm, the proportional-derivative control algorithm, is employed to make the smart car have the ability of twowheeled self-balancing. Second, the speed of wheel obtained by the encoder is fed back to the MCU by way of pulse signal, then the PI control algorithm, the proportional-integral control algorithm, is employed to make the speed of smart car reach the set point in the shortest possible time and stabilize at the set point. Finally, the PD control algorithm is used to regulate the smart car's turning angle to make the smart car respond quickly while the smart car is passing the curve path. The smart car can realize the self-balancing control of two wheels and track automatically the black and while lines to march.