This paper develops a mathematical model of an inverted wheeled robot and uses it to simulate and animate the robot dynamics. The robot is modeled as a three-body system consisting of a pendulum and two wheels where the Newtonian mechanics is employed to derive the dynamical equations. The proposed model, in its current configuration, is designed to simulate and animate the controlled robot for forming a virtual controller-testing setup. The open-loop system is simulated by solving the nonlinear dynamic equations recursively within an animation loop by using the Runge-Kutta 4 (RK4) method. The nonlinear model is linearized for designing a PID controller to stabilize the closed-loop system of the robot. The animation process is conducted by creating two graphical objects that resemble the wheel and pendulum in a graphical user interface window. The keyboard arrows are used to interactively input the horizontal motion of the robot cart to the animation process where there is also an option to switch the controller off. Simulation results are provided for both the open-loop and closed-loop cases to illustrate the effectiveness of the results.