A control-system design for a two-wheeled self-balancing vehicle is discussed in this paper. We have developed a low-cost hardware platform based on AVR MCU, accelerometer sensor and gyroscope sensor, for which the critical circuits, such as sensors and motor driver, are introduced. The control strategy operates by two steps: a) securing the real-time vehicle posture by integrating the data from accelerometer and gyroscope sensors; b) using a closed-loop PID controller to keep the vehicle balanced. This control system is applied to a prototype two-wheeled self-balancing vehicle, whose performance has turned out to be a satisfaction.