Skip to main content

AN-CM-219 IR Windshield Rain Sensor


Terms and Definitions

IC Integrated circuit
IR Infrared
LED Light-emitting diode


For related documents and software, please visit:

Download our free GreenPAK Designer software [1] to open the .gp files [2] and view the proposed circuit design. Use the GreenPAK development tools [3] to freeze the design into your own customized IC in a matter of minutes. Dialog Semiconductor provides a complete library of application notes [4] featuring design examples as well as explanations of features and blocks within the Dialog IC.

  1. GreenPAK Designer Software, Software Download and User Guide, Dialog Semiconductor
  2. AN-CM-219 IR Windshield Rain, GreenPAK Design File, Dialog Semiconductor
  3. GreenPAK Development Tools, GreenPAK Development Tools Webpage, Dialog Semiconductor
  4. GreenPAK Application Notes, GreenPAK Application Notes Webpage, Dialog Semiconductor
  5. Rain Sensor, Article, Wikipedia
  6. IR928-6C-F, Datasheet, Everlight Electronics
  7. CNY70, Datasheet, Vishay Semiconductors


In this application note a rain and ice sensor is implemented by analyzing the reflection of an infrared (IR) light source.

This project will use proven techniques based on multiple reflections of IR light in the internal walls of the target glass. It will aim to increase the capabilities of standard components by adding technical advantages offered by the LED device, such as increasing the power emission using pulsed energy applied ten times using high current strikes at one percent duty cycle.


The most common practice in the detection of raindrops on a windshield involves sensing infrared light conducted through the internal walls of the windshield glass, and in some cases enhancing these reflections by adding other physical components to the glass.

When raindrops are present on the external surface of the glass, a refraction of light happens and takes away part of the initial light stream. This results in an attenuated beam of IR light as compared to the original conditions (without the presence of water).

In order to acquire the majority of the luminous emissions, the light beam is injected to the glass at a 45° angle. The receiver at the other end of the glass also has a 45° angle. This technique depends on the statistical probability that when it is raining, the surface of the glass will have raindrops in the path of reflection. The longer the distance between emitter and receiver, the more effective this detection method will be.

As the distance between emitter and receiver gets bigger, the light’s power loss increases as the light travels through the glass. For the best detection given increasing distance, either a more efficient sensing/light emission device must be developed, or more power must be obtained from the current IR light source.

Figure 1: Internal Reflection Principle Used in the Most Common Rain Sensors [5]

This application suggests a method to get the most out of the LED. A constant light could be used for measuring, but this is not mandatory as the time constant is not the priority (measuring the intensity of the beam is). LED manufacturers supply the Peak Forward Current [6] (IFP) or the Forward Surge Current [7] (IFSM) of the LED in their datasheets.

GreenPAK Design: Block Diagram

Figure 2: General Block Diagram

Pulse Generator for IR Emitter

For the pulse generator, the case of a 10 μs with a one percent duty cycle will be taken. The complete period is given by:

Which results in a maximum frequency of:

Thus, a high pulse is set for 10 μs with the complementary low level to achieve a 1 ms total period.

To generate this pulse, CNT5/DLY5 and CNT2/DLY2 are used.

CNT5/DLY5 provides the complete period of 1 ms. It is set as a counter using the internal clock at 25 kHz (configured in OSC). CNT2 provides the 10 μs high level pulse.

IR LED Emitter Driver

A basic configuration (Figure 3) is used to drive the IR LED, using TIP121 transistors and considering the power supply conditions of a car where we have +12 V as our main voltage source.

Based on experience, the TIP121 Darlington transistor is a good option for this application. This device will allow us to drive a high current load with a low base current.

Figure 3: Circuit 1. IR LED Driving Circuit

Therefore, R1 can be calculated from:

The average power calculation for R1 is calculated as follows:

In order to be aware of the worst-case conditions, there is a possibility that the signal in the base of Q1 could be a constant DC level. If so, the power dissipated by R1 is as follows:

The power dissipated by the Darlington transistor must be observed (to take care of the device’s life span) by calculating the device temperature through its thermal resistance parameters.

At 25 °C, with no additional heat sink:

This does not seem like a big issue. However, in the case when current driven is 100%:

This means it would be beneficial to avoid a constant level in the base of Q1.

One simple option is to have a series capacitor in the base (Figure 4):

Figure 4: Circuit 2. IR LED Driving Circuit with Decoupling Capacitor to Avoid DC Levels

IR Light Receiver

The receiver is configured as a common collector to simply convert the input light pulses into a voltage in R2.

The voltage drop in R2 will typically be pulses. For our purposes, these need to be translated into a DC level.

Figure 5: Circuit 3. IR Receiver Circuit + Low Pass Filter

The easiest way to do this is to filter the signal using an RC low pass filter, with a cut off frequency two decades before 1 kHz (therefore, 1 Hz) to ensure the 1 kHz rejection.

The cut-off frequency is calculated:

We can try for 1 μF, resulting in a cut-off frequency of:

Voltage Controlled PWM

The previous application note AN-1056 Macro circuit design ADC PWM is used to translate a DC level into a PWM signal.

Figure 6: Array to Create a PWM based in a DC Level


IR Light Emitter vs IR Receiver

The following oscilloscope screen captures depict the IR LED pulses (CH1) vs the voltage drop in R2 directly from the IR receiver (CH2). In Figure 8, one can see R2’s voltage (CH2) vs. the filtered DC level in C1 (CH1).

100% Light sensing
Figure 7: Capture 1a. Voltage Drop in R2: 3 V Peak, 2.05 V avg
Figure 8: Capture 1b. Filtered Voltage in C1: 2.00 V
75% Light Sensing
Figure 9: Scope Capture 2a
Figure 10: Scope Capture 2b (881 mV DC Level at CH1)
50% Light Sensing
Figure 11: Capture 3a. Voltage Drop in R2: 1.5 V Peak
Figure 12: Capture 3b. Filtered Voltage in C1: 653 mV
25% Light Sensing
Figure 13: Capture 4a. Voltage Drop in R2: 1 V Peak
Figure 14: Capture 4b. Filtered Voltage in C1: 434 mV
0% Light Sensing
Figure 15: Capture 5a. Voltage Drop in R2: 0 V Peak
Figure 16: Capture 5b. Voltage in C1: 164 mV

DC Level vs PWM

Figure 17: Capture 6. Duty Cycle 99.3 % at 1.95 V
Figure 18: Capture 7. Duty Cycle 77.1 % at 991 mV
Figure 19: Capture 8. Duty Cycle 58.4 % at 788 mV
Figure 20: Capture 9. Duty Cycle 29.1 % at 478 mV
Figure 21: Capture 10. Duty Cycle 2.91 % at 253 mV

Ice Sensing Applications

During this exercise, it was found that sensing ice is somewhat challenging using the techniques described so far. The changes in refraction due to the presence of ice are different than the changes due to the presence of water. However, it is possible to detect both.

Figure 22: Setup

We recommend that the emitter and receiver be immersed in a clear encapsulating material so that the light emitted and received is not lost due to material changes. This helps avoid unintended attenuation, and also helps prevent a false positive where condensation on the inside of the car sets off the rain sensor.

We can account for the added challenge of detecting ice by adding a barrier to the center and adjusting the angle of the emitter and receiver.

Circuit enhancement

This section will discuss how to enhance the receiver to deal with the challenge posed by an icy windshield.

The previous receiver design was shown in Figure 5. The low-pass filter with R3 and C1 was optimized for water only sensing.

To account for the change in the angle of reflection and the presence of encapsulating material, we can change the value of R2. The gain of the circuit is directly proportional to R2’s value. For practical purposes, a 500 kΩ potentiometer would be ideal to select the proper value for the circuit. Figure 23 shows an updated topology with the potentiometer included.

Figure 23: Circuit 4. Addition of R4 to Avoid High Current Drain from Q1

Figure 24, Figure 25, Figure 27 and Figure 29 show the different behavior of the circuit with varying conditions.

Figure 24: Capture 11. Duty Cycle 30.7 % at 715 mV in C1. Initial State
Figure 25: Capture 12. Duty Cycle 31.5 % at 585 mV
Figure 26: Water Applied to Glass
Figure 27: Capture 13. Duty Cycle 16.6 % at 585 mV
Figure 28: Ice Applied to Glass
Figure 29: Capture 14. Duty Cycle 53.3 % at 644 mV
Figure 30: Condensation after Ice
Figure 31: Test Setup


In this application note a rain and ice sensor has been created using a Dialog GreenPAK SLG46620V and a few external components. This system is able to monitor when a sheet of glass has either water or ice on its surface. The system can then generate a PWM signal to control a motor that can wipe away the liquid from the glass surface.

Tuning and Troubleshooting Notes:

If the output of the voltage in Figure 5 is low, increase R2.

If the light emitted by Figure 4 is not as powerful as expected, check the connections between R2, Led1, and Q2. You can verify the voltage drops for each component.