This paper presents a gray box modeling of a Two-Wheeled Inverted Pendulum robot TWIP from LaGrange equation with a closed loop parameter identification method, the design and the implementation of a Single Input, Single Output SISO and a Multiple Input, Multiple Output MIMO controllers for the robot balance. The research issue is to compare PID and LQR controllers for different references to balance the TWIP robot via it's on-board sensor equipment. Both controllers were compared based on responses for disturbance rejection in simulation and a setpoint variation on a prototype to validate the theoretical results.