Abstract: A method and sensor are provided for monitoring the quality of yarn by an electronic cleaner of yarn by means of an optical detector having a sensor with one or two rows of individual optical elements that are rectangular-shaped and have analog outputs. Each of the optical elements has a photodiode and an amplifier of its output signal. The amplifier has a variable amplification, whose size is modified according to the required sensitivity of a respective optical element to light.