A driving device for driving a rotating shaft is provided, which includes a frame, a pendulum assembly, an electromagnet assembly and a switch-on and switch-off sensor assembly. The frame has an annular partition arranged along a vertical direction and allows the rotating shaft to extend through a center of the frame along a horizontal direction. The pendulum assembly is disposed rotatably on the frame along the vertical direction and includes a lever and a magnetic bar having magnetic permeability. The switch-on and switch-off sensor assembly is configured to switch on and off the electromagnet assembly to generate a magnetic attractive force between the pendulum assembly and the electromagnet assembly for facilitating rotation of the pendulum assembly and allow the pendulum assembly to pass by the electromagnet assembly, respectively.