We analyze the dynamics of rotary biomotors within a simple nano-electromechanical model, consisting of a stator part and a ring-shaped rotor having twelve proton-binding sites. This model is closely related to the membrane-embedded F$_0$ motor of adenosine triphosphate (ATP) synthase, which converts the energy of the transmembrane electrochemical gradient of protons into mechanical motion of the rotor. It is shown that the Coulomb coupling between the negative charge of the empty rotor site and the positive stator charge, located near the periplasmic proton-conducting channel (proton source), plays a dominant role in the torque-generating process. When approaching the source outlet, the rotor site has a proton energy level higher than the energy level of the site, located near the cytoplasmic channel (proton drain). In the first stage of this torque-generating process, the energy of the electrochemical potential is converted into potential energy of the proton-binding sites on the rotor. Afterwards, the tangential component of the Coulomb force produces a mechanical torque. We demonstrate that, at low temperatures, the loaded motor works in the shuttling regime where the energy of the electrochemical potential is consumed without producing any unidirectional rotation. The motor switches to the torque-generating regime at high temperatures, when the Brownian ratchet mechanism turns on. In the presence of a significant external torque, created by ATP hydrolysis, the system operates as a proton pump, which translocates protons against the transmembrane potential gradient. Here we focus on the F$_0$ motor, even though our analysis is applicable to the bacterial flagellar motor.