The present invention relates to sensors for detecting moisture on a surface, such as an automobile windshield, by detecting modifications in light intensity caused by the presence of the moisture. 
Automatically detecting the presence of moisture on a surface has many applications.  In particular, the ability to detect moisture on an automotive vehicle windshield frees the vehicle operator from the distraction of having to locate controls, such as wipers and defoggers, when driving conditions change.  Windshield moisture can occur as rain, snow, ice, frost, fog, and the like on the windshield outer surface.  Moisture may also occur as frost or fog on the windshield inner surface. 
Many proposed systems for detecting moisture on a window are based on changes in the reflectivity or transmissivity of the window due to the presence of moisture.  Generally, one or more light emitters are aimed at the window inner surface.  One or more light sensors are positioned to receive light from the emitters reflected by the window.  In one design, emitted light passes through the window when moisture is not present, but is reflected to a light sensor when moisture exists on the inner or outer window surface.  In another design, emitted light is coupled into the window at an angle conducive to total internal reflectance when no moisture is present.  One or more light sensors are coupled to the window so as to extract light after several internal reflections.  The presence of moisture on a window surface degrades the internal reflection, decreasing the amount of light received by the light sensor.  In either design, ambient light presents a source of noise that must be compensated for or reduced. 
A key element in the design of such moisture detecting systems is the type of light sensor used.  This is particularly true in automotive vehicles where the operating environment is severe and cost is a limiting factor.  Light sensors must operate within the ranges of temperature, humidity, shock, and vibration experienced within a vehicle passenger compartment.  Sensors and support electronics must be inexpensive to allow the cost of automatic equipment, such as windshield wipers and defogger systems, to fall within the range deemed acceptable by an automobile purchaser.  The sensor should have sufficient sensitivity across a wide dynamic range.  Light transducers within the sensor should have good noise immunity or be compatible with noise compensation electronics within the sensor for sensitivity at low light levels.  As a final desirable characteristic, the sensor must be easily integratable into the types of digital control systems commonly found in automotive applications. 
One type of light transducer is the cadmium sulfide (CdS) cell.  CdS cells are photosensitive resistors exhibiting increasing conductance with increasing light levels.  CdS cells have the advantage of being low in cost and having good sensitivity to low light levels.  Disadvantages with CdS cells include a high degree of variance between cells, slow response at low light levels, poor environmental stability, and difficulty being assembled by automated electronic manufacturing equipment. 
Another type of light transducer used in moisture detecting systems is the discrete photodiode configured as a light-dependent current source.  Photodiodes have less variance between parts, better environmental stability, and are more easily adapted to automated manufacturing than are CdS cells.  However, photodiodes tend to be expensive and produce very low currents at low light levels.  These low currents require special amplification techniques to achieve a useful signal, increasing the cost of moisture detection. 
Yet another type of light sensor is the phototransistor.  The phototransistor functions as a light sensitive amplifier.  Light incident on the base generates current which regulates the flow of collector current.  Phototransistors are more sensitive than photodiodes but exhibit less stability. 
A relatively new type of light sensor incorporates a silicon-based light transducer and conditioning electronics on a single substrate.  The light transducer generates charge at a rate proportional to the amount of incident light.  This light-induced charge is collected over an integration period.  The resulting potential indicates the level of light to which the sensor is exposed over the integration period.  Light sensors with integral charge collection have many advantages.  By varying the integration time, the sensor dynamic range is greatly extended.  Also, the ability to incorporate additional electronics on the same substrate as the transducer increases noise immunity and permits the sensor output to be formatted for use by a digital circuit.  Component integration additionally reduces the system cost.  Silicon devices are more temperature invariant than CdS cells and can be packaged to provide the necessary protection from humidity, shock, and vibration.  Types of charge accumulating light transducers include photodiodes and photogate transistors.  A variety of charge integrating photodiode devices have been described including those in U.S. Pat.  No.  4,916,307 to Nishibe et al.;  U.S. Pat.  No.  5,214,274 to Yang; U.S. Pat.  No.  5,243,215 to Enomoto et al.;  U.S. Pat.  No.  5,338,691 to Enomoto et al.;  and U.S. Pat.  No.  5,789,737 to Street.  Photogate transistor devices are described in U.S. Pat.  No.  5,386,128 to Fossum et al.  and U.S. Pat.  No.  5,471,515 to Fossum et al.  Each of these patents is herein incorporated by reference. 
One difficulty with all types of light sensors is the occurrence of operating anomalies at high temperatures.  Some devices become extremely non-linear at high temperatures.  Some devices, such as CdS cells, may suffer a permanent change in operating characteristics.  Devices may even provide completely false readings such as indicating bright light in low light conditions due to excessive thermal noise.  Traditionally, the only way to deal with this problem has been to incorporate a temperature sensor and associated electronics into the moisture detecting system. 
What is needed is a moisture detecting system that derives the benefits provided by semiconductor light sensors with integral charge collection.  The moisture detecting system should be economical to produce, operate over a wide range of lighting conditions, and be less susceptible to temperature variations. 
It is an object of the present invention to detect moisture over a wide range of lighting conditions. 
Another object of the present invention is to detect moisture utilizing a charge integrating semiconductor light sensor. 
Still another object of the present invention is to detect moisture with less susceptibility to temperature variations. 
Yet another object of the present invention is to provide a moisture detector that is inexpensive to produce. 
A further object of the present invention is to provide a moisture detector capable of detecting a variety of moisture types. 
In carrying out the above objects and other objects and features of the present invention, a system for detecting moisture on a surface is provided.  A light emitter is directed at the surface.  Detecting the presence of moisture is based on the intensity of light from the emitter received by a light sensor.  The light sensor accumulates charge in response to incident light over a variable integration period. 
A system is also provided for detecting moisture on a window having an inner surface and an outer surface.  The system includes an emitter operative to emit light at the window.  A light sensor receives light reflected from the outer surface, the level of reflected light indicative of moisture on the outer surface.  The light sensor outputs a discrete light signal based on the level of incident light over an integration period.  Control logic receives a first light signal from the light sensor with the emitter turned off.  The emitter is turned on.  A second light signal is received from the light sensor.  The presence of moisture is determined based on the first light signal and the second light signal. 
In an embodiment of the present invention, the light sensor has an input for receiving a light integration period signal specifying the light integration period.  The control logic determines a light integration period based on at least one previously received first light signal and outputs the light integration period signal based on the determined light integration period.  In an alternative embodiment, each light signal is a pulse having a pulse width indicative of the incident light level.  The control logic generates a sequence of integration period signals, each integration period signal in the sequence specifying a different light integration period, and determines the light level based on a resulting light signal having a pulse width within at least one preset width threshold. 
In another embodiment of the present invention, the light sensor includes an exposed light transducer accumulating charge in proportion to light incident over the light integration period.  Sensor logic determines the light integration period prior to beginning integration.  The charge accumulated in the exposed light transducer is reset at the beginning of the light integration period.  The charge accumulated by the exposed light transducer over the light integration period is measured.  A pulse having a width based on the accumulated charge is then output. 
In still another embodiment of the present invention, the light sensor further includes a light transducer shielded from light which accumulates charge in proportion to noise over the integration period.  The sensor logic resets the charge accumulated in the shielded light transducer at the beginning of the light integration period, measures the charge accumulated by the shielded light transducer over the light integration period, and outputs a pulse having a width based on the difference between the accumulated exposed light transducer charge and the accumulated shielded light transducer charge. 
In yet another embodiment of the present invention, the light sensor receives an integration pulse, the width of the integration pulse determining the integration period, and generates the output pulse after the integration pulse.  The difference in time between the end of the integration pulse and the start of the output pulse indicates the amount of thermal noise in the light sensor.  In a refinement, the control logic determines the amount of time between the end of the integration pulse and the start of the output pulse and determines the light sensor temperature based on the determined time.  In yet a further refinement, the control logic disables moisture detection if the light sensor temperature exceeds a preset limit. 
In a further embodiment of the present invention, the light sensor includes an enclosure having a window for receiving light.  The enclosure admits a power pin, a ground pin, and a signal pin.  An exposed light transducer within the enclosure accumulates charge in proportion to incident light received through the window.  A light-to-pulse circuit within the enclosure outputs an output pulse having a width based on charge accumulated by the exposed light transducer over an integration period.  Sensor logic within the enclosure receives an integration pulse on the signal pin, determines the integration period based on the width of the integration pulse, and outputs the output pulse on the signal pin.  Control logic has a signal pin connected to the signal pin of the light sensor.  The control logic sets the control logic signal pin to output mode, determines an integration period, generates an integration pulse on the control logic signal pin having a width based on the integration period, sets the control logic signal pin to input mode, receives the light sensor output pulse, and determines a light level received by the light sensor based on the light sensor output pulse. 
In a still further embodiment of the present invention, the moisture detecting system includes a second light sensor receiving light reflected from the inner surface.  The control logic receives a third light signal from the second light sensor with the emitter turned off, turns on the emitter, receives a fourth light signal from the second light sensor, and determines the presence of moisture on the inner surface based on the third light signal and the fourth light signal. 
A method for determining the presence of moisture on a window is also provided.  A light emitter directed at the window is activated.  An integration period for a light sensor positioned to receive light from the emitter reflected off the window is determined.  The intensity of light incident on the light sensor over the integration period is determined.  The presence of moisture is determined based on the intensity of the incident light.  In refinements, determining the integration period for the light sensor and determining the presence of moisture are based on the ambient light level. 
In an embodiment of the present invention, the method includes determining the ambient light level by deactivating the light emitter, determining an ambient light integration period for the light sensor, determining the intensity of light incident on the light sensor over the ambient light integration period, and determining an ambient light level based on the intensity of incident light with the light emitter deactivated. 
The above objects and other objects, features, and advantages of the present invention are readily apparent from the following detailed description of the best mode for carrying H e invention when taken in connection with the accompanying drawings.