A yarn sensor for optically scanning a yarn (3), traveling longitudinally
through a measurement gap (19), includes a light source (20) projecting a
beam of light into the measurement gap (19), at least one receiver (23)
for directly transmitted light, and light transmitting elements (24, 25,
26, 27) transmitting the light between the light source (20), measurement
gap (19), and receivers (21, 22, 23). The light source (20) is an emitter
with Lambert's emission characteristics. The light-transmitting element
(27) includes a diaphragm and a lens, and the diaphragm is projected
approximately into infinity. A diffusor (39) located between the light
source (20) and the diaphragm generates radiation that passes through the
diaphragm and is symmetrical to the optical axis of the lens. The yarn
sensor can be used in the textile industry in spinning or bobbin winding
machines with improved quality of the measurement results.