In this paper we investigate the stability and the onset of chaotic oscillations around the pointing-up position for a simple inverted pendulum that is driven by a control torque and is harmonically excited in the vertical and horizontal directions. The driven control torque is defined as a proportional plus integral plus derivative (PID) control of the deviation angle with respect to the pointing-down equilibrium position.The parameters of the PID controller are tuned by using the Routh criterion to obtain a stable weak focus around the pointing-up position, whose stability is investigated by using the normal form theory. The normal form theory is also used to deduce a simplified mathematical model that can be resolved analytically and compared with the numerical simulation of the complete mathematical model. From the harmonic prescribed motions for the pendulum base, necessary conditions for chaotic motion are deduced by means of the Melnikov function. When the pendulum is close to the unstable pointing-up position, the PID parameters are changed and the chaotic motion is destroyed, which is achieved by employing very small control signals even in the presence of random noise. The results of the analytical calculations are verified by full numerical simulations.