Method for light-to-frequency conversion, the method comprising: - illuminating a photodiode by a light source, - generating a photocurrent by means of the photodiode, - converting the photocurrent into a digital comparator output signal (LOUT) depending on a first clock signal, wherein converting the photocurrent comprises: - providing the photocurrent to an integrating capacitor for generating a voltage output during an integration time, - generating by means of a comparator a comparator output signal by comparing the voltage output to a reference voltage, the comparator output signal indicating whether a charge package has been detected, and - generating an output signal indicating a frequency (f) of a repeating pattern, such that - the frequency (f) of the repeating pattern in the output signal corresponds to the frequency of a repeating pattern in the intensity of electromagnetic radiation emitted by the light source and detected by the photodiode, characterised in that converting the photocurrent further comprises: - generating by means of a latch a digital comparator output signal (LOUT) from the comparator output signal based on a first clock signal, and in that the method further comprises: - generating by means of a first counter from the digital comparator output signal (LOUT) a first counter value indicating an integer number of charge packages detected during the integration time, - generating by means of a second counter from the digital comparator output signal (LOUT) and from a second clock signal a second counter value indicating a time interval between at least two increments of the first counter value, - determining by means of a logic calculation engine the repeating pattern in the first counter value and in the second counter value. - illuminating a photodiode by a light source, - generating a photocurrent by means of the photodiode, - converting the photocurrent into a digital comparator output signal (LOUT) depending on a first clock signal, wherein converting the photocurrent comprises: - providing the photocurrent to an integrating capacitor for generating a voltage output during an integration time, - generating by means of a comparator a comparator output signal by comparing the voltage output to a reference voltage, the comparator output signal indicating whether a charge package has been detected, and - generating an output signal indicating a frequency (f) of a repeating pattern, such that - the frequency (f) of the repeating pattern in the output signal corresponds to the frequency of a repeating pattern in the intensity of electromagnetic radiation emitted by the light source and detected by the photodiode, - providing the photocurrent to an integrating capacitor for generating a voltage output during an integration time, - generating by means of a comparator a comparator output signal by comparing the voltage output to a reference voltage, the comparator output signal indicating whether a charge package has been detected, and - generating an output signal indicating a frequency (f) of a repeating pattern, such that - the frequency (f) of the repeating pattern in the output signal corresponds to the frequency of a repeating pattern in the intensity of electromagnetic radiation emitted by the light source and detected by the photodiode, in that converting the photocurrent further comprises: - generating by means of a latch a digital comparator output signal (LOUT) from the comparator output signal based on a first clock signal, and - generating by means of a latch a digital comparator output signal (LOUT) from the comparator output signal based on a first clock signal, and in that the method further comprises: - generating by means of a first counter from the digital comparator output signal (LOUT) a first counter value indicating an integer number of charge packages detected during the integration time, - generating by means of a second counter from the digital comparator output signal (LOUT) and from a second clock signal a second counter value indicating a time interval between at least two increments of the first counter value, - determining by means of a logic calculation engine the repeating pattern in the first counter value and in the second counter value. - generating by means of a first counter from the digital comparator output signal (LOUT) a first counter value indicating an integer number of charge packages detected during the integration time, - generating by means of a second counter from the digital comparator output signal (LOUT) and from a second clock signal a second counter value indicating a time interval between at least two increments of the first counter value, - determining by means of a logic calculation engine the repeating pattern in the first counter value and in the second counter value.