An auto-regulating circuit to auto-regulate the oscillation frequency of an oscillating mechanical system, wherein the mechanical system includes a piezoelectric or electroactive polymer element configured to generate an alternating voltage following the oscillation of the mechanical system, the auto-regulating circuit being connected to the piezoelectric or electroactive polymer element to adapt the oscillation frequency of the oscillating mechanical system, and the auto-regulating circuit comprising:
- a rectifier configured to rectify the alternating voltage generated by the piezoelectric or electroactive polymer element and to store the rectified voltage in at least one capacitor in order to supply the auto-regulating circuit with electricity,
- an oscillator stage, which includes an oscillating circuit connected to a MEMS resonator, to supply a reference signal,
- a comparison circuit configured to compare the frequency of the alternating voltage to the frequency of the reference signal,
- a frequency adaptor connected to the piezoelectric or electroactive polymer element and configured to supply a frequency adaptation signal to the piezoelectric or electroactive polymer element on the basis of the result of the comparison in the comparison circuit in order to regulate the oscillation frequency of the oscillating mechanical system, and
- all electronic components of the auto-regulating circuit being grouped together to form a single electronic module,
- wherein the comparison circuit includes a first alternation counter configured to count a first number of alternations of the alternating voltage of the piezoelectric or electroactive polymer element in a first determined time period and to supply a first counting signal to a processor, a second alternation counter and measuring window arranged between the first alternation counter and the second alternation counter, in which said measuring window is configured by configuration parameters supplied by the processor by taking into account the first counting signal relating to the first number of counted alternations of alternating voltage in the first determined time period, the second alternation counter being configured to count a second number of alternations of the reference signal supplied by the oscillator stage in a second determined time period determined by the measuring window on the basis of the first determined time period proportionately to the counting time of the number of alternations counted by the first alternation counter in the first counting signal, and to supply a second counting signal to the processor, for which the processor is configured to compare the first counting signal to the second counting signal so as to control the frequency adaptor on the basis of the result of the comparison.