This study aims at designing an embedded controller that can stabilize custom designed self-balancing two-wheeled robot (TWSBR) using velocity feedback alone. A state-space model for the custom designed TWSBR is obtained through dynamic analysis using a Lagrangian method. System identification experiments are proposed and performed to identify the parameters of the model. Based on the identified model, an LQR controller, which is a combination of optimal estimation and optimal control, is designed and implemented that can successfully stabilize TWSBMR. At last, few tests are carried out to evaluate the performance of the controller, showing how the proposed LQR controller outperforms classical controller in many aspects.