This paper aims to design a controller based on the Total Energy Control System (TECS) method, to solve the attitude trajectory tracking problem for rigid spacecraft. TECS objective is to command the total energy rate using a proportional-integral (PI) controller. The attitude control objective fixes the total energy rate objective. The spacecraft attitude is represented directly in the manifold of the Special Orthogonal Group SO(3). Ultimate boundedness of the closed-loop trajectories is concluded using Lyapunov theory. The second objective of this paper is to test the attitude controller through real-time experiments, employing a testbed based on an underwater prototype with neutral buoyancy that can rotate unrestricted around the three axes.INDEX TERMS Attitude control, Hamiltonian dynamics, Lyapunov theory, real-time control.