There is provided a distance measuring apparatus, which can attain a distance compensation of a high precision and can be stably operated by using a cheap circuit, without any arrival at a supersaturated state for a great reflected light intensity, while a gain of an amplifying circuit is made higher, in order to accurately detect even a weak reflected light. The cooling tube has a serpentine configuration and the heat storing element includes longitudinal slots starting from both longitudinal ends of the heat storing element. A wheel gear, which is in engagement with the worm gear, is formed on an outer surface of the gear portion. Alternatively, the system can comprise separate sensor and transmitter components, in communication with one another. The wall and the at least one retention element may be configured so as to hold product substantially within the cavity. When there is a high correlation between the failure test pattern and the ranks of the switching activities, it is determined that the circuit likely contains a power defect.