The problem of self-stabilization of a bicycle has been a research area for more than a century. However, many researchers have confined their study in self stabilization of bicycles at constant velocities. In this paper, we utilized the precession effect of the gyroscope to stabilize the bicycle both at zero forward velocity and varying velocities. Equation of motion of a bicycle with a flywheel mounted on its bottom is derived and a first order observer-based sliding mode controller is designed. The performance of the controller is simulated on different road structures. It is shown that the designed controller succeeded to stabilize the bicycle throughout the trajectory.