[00:05] That’s right, it’s got automatic windshield wipers. When they’re set to automatic, and the car gets wet, they wipe. If you look at the windshield, [00:19] And if you look closelier you’ll see the component the car uses to determine windshield wetness. No, it's not the camera - that’d be silly! [00:33] Then you’d have to devote some precious clock cycles away from the already wildly complicated computer vision tasks That seems like a weird decision and I don’t even know how well that could possibly work no matter how many software updates you throw at it. [00:48] Right above that camera which looks forward at the road you’ll see a little circular spot with some spots within the spot and that, viewers, Look, I get it wet - and the car wipes! [01:04] You may think this is wildly complicated and expensive technology but actually it’s just two of the simplest electronic components you can imagine working together in a very clever way. [01:18] Below the dark portions of the rain sensor are infrared LEDs shining light up into the glass, and adjacent to them are photodiodes which detect that light. That’s not actually part of the rain sensor. [01:33] It’s an ambient light sensor used to control the car’s headlights automatically. The parts that make up the rain sensor aren’t really visible because they’re below a filter which blocks visible light and thus it appears black to our eyes. [01:51] That’s strange, didn’t we just encounter that with stovetops? To demonstrate how that detects rain, I’ll use a piece of glass and a laser pointer. If I shine the laser up at the glass at about a 45 degree angle, [02:06] you’ll notice that a spot of laser light is reflected back down towards the table. Now watch what happens when I get the glass wet. [02:18] Ah, but this isn’t actually an accurate demonstration of the principles involved in the rain sensor. Rather than look at the light reflected back downward by the glass, [02:31] let’s look at the spot produced above the glass by  the laser light which makes it through. Did you see that? It moved. That happened because the water on top of the glass changed the angle of refraction as light left the glass. [02:48] Now, like some politicians, I’m really not really good at the whole optics thing But as light passes from one medium to another, its speed actually changes [03:01] and because of… reasons that means it appears to change direction. And the refraction index of water is different from that of air. That means the change in speed and thus change in refraction angle is different between light passing from glass into air and light passing from glass into water. [03:22] so it’s not as if it can directly detect that change. Instead, it leverages the effect of total internal reflection. [03:34] If you’ve ever gone swimming in a pool with goggles on and looked up at the surface of the water while submerged, you may have noticed that it looks like a mirror from shallow angles. That’s total internal reflection at work - the water directly above you transmits light just fine and you can see through it, [03:54] but there’s a critical angle at which the air-water interface will reflect all light back down and since it’s smooth like glass, it looks like a mirror. Well, first, since the module isn’t part of the glass, [04:11] we need an optical interface material to couple the sensor to the glass and remove the air-to-glass optical interface on the bottom. That takes the form of a sticky gel which, now that it’s in-place, you can’t see. [04:26] the sensor and the glass become one Now the key is that the infrared LEDs that we talked about earlier are shining up at the glass just shallow of the critical angle of total internal reflection. [04:44] So, all the light they produce will simply bounce off the top surface of the the glass and head back downward. And, at the other end of that beam of light, is a photodiode. That will then detect the light being generated by the LED. [04:59] And to make sure it’s detecting that light and not something else, the LEDs are actually rapidly blinking and the photodiode is looking for that pattern of blinks. That’s a simpler way of saying the LEDs are producing a specific modulated signal that the photodiode is tuned to detect. [05:16] But because the angle between the photodiode and  the LED is so close to the critical angle of total internal reflection, if conditions should change the intensity of that signal being received by the photodiode will also change. [05:33] Water on the glass, as we saw in the earlier demo, changes the refraction angle because its refractive index is different from air. And it will change it just enough to break the effect of total internal reflection. [05:50] Wet glass will allow some of the light produced by the LEDs  to actually escape and be transmitted through to the outside surface. Which in turn means there’s less light bouncing down to the photodiode to be detected, [06:03] And, with a little logic circuitry and programming, you can use that loss of signal as a measurement of windshield wetness. It’s that simple. [06:18] The sensor starts to see the signal from the LED drop out so it says to the windshield wiper motor - And the wetter the glass, the more the signal drops, so the more it wipes. And you’ll notice the sensor is deliberately placed in the path of the windshield wipers so they clear the glass with every wipe. [06:37] That allows the logic to get some sense of how hard it might be raining based on how quickly the signal drops out after every wiping event. Every time the sensor powers up, it’s got to pick a baseline  signal level which it deems “dry.” [06:55] Yet, if you are out and about in the rain and you turn your car on with the windshield already wet, it’s going to start out with some lower signal level than typical. So, somebody smarter than me probably established a minimum signal dropout level which always causes a wipe,   [07:12] and in fact I’m certain I’ve encountered the  car do a single wipe after turning it on But then it can reset its calibration after that wiping event. And, there’s another trick up its sleeve, and it's my very favorite one: [07:28] There are actually two sensor assemblies under here. You can barely make out the infrared light in this smartphone camera footage. If the windshield is dry, the two sensors should see very similar signals [07:44] but if there’s even just a tiny bit of water on top of one of them, or differing amounts between the two, then the two signals will be very different and it will know immediately that the windshield is wet. [07:56] I do not know. And if you’ve never lived with a car with automatic wipers, you may wish to know they are great but not exactly perfect. [08:09] You are afforded a sensitivity adjustment on the wiper stalk, so you can fine-tune its behavior to your liking. But while the wipers pretty much always come on when they need to, sometimes they go absolutely nuts when it’s barely raining or they get a little lazy in a sudden downpour. [08:27] Lucky for me, if that happens all I have to do is just slap this stalk which is right next to my hand on the steering wheel Handy user interface, those stalks. [08:39] I’m pro-stalks, is what I’m saying. It’s a good idea. What’s less of a good idea, though, is the Konami-code like trick I had to look up just to change my car’s wiper blades. [08:53] The hood blocks you from lifting the wiper arms so you need them to stop in the up position in order to change them. and despite digging through all the settings menus I couldn’t find a “change wipers” option. [09:06] So I tried just switching the car off with the wipers in the up position, y'know just time it right, using the power button, It turns out what you have to do is turn the car off and then hold the wiper stalk up in the mist position for a few moments [09:23] Is this procedure in the owner’s manual? I usually like to end my videos with something akin to a moral. [09:37] In that vein, the first lesson today is for me There’s even an index in here and finding the appropriate  information would have taken me mere moments. [09:49] People worked hard on this thing and I just… completely ignored it! And the second moral is… Software isn’t everything. [10:04] Just something to keep in mind. ♫ internally smooth jazz ♫ Thanks, by the way, to Jason, a supporter on Patreon, for recommending this video topic. [10:20] That happened a long time ago and I’m pretty certain at least one other person has suggested this in the meantime There’s just too many bimetallic strips getting in the way. [10:34] You’ll notice that the spot of laser light is re… oh. …conditions should change, the intensity of a- ...critical angle of total internal reflection [10:51] ...it’s got to pick a baseline signal lever. ...had to look, oh yeah I forgo ohyeahIgottagetthething! You mean to say all you need is an LED, a photodiode, and a bit of adhesive to take the task of detecting rain away from a sophisticated computer vision system? [11:05] That sounds unpossible, I mean if there were a better way to do things, surely it would only come from the halls of one particular company and not anyone else. Not directed at any particular organization, of course :)