Best simple sensor to detect fog on glass?

Hi all.

I'm trying to hook the rear demister for my car into the arduino, relay triggered when it's foggy, relay off when its not. Should be simple enough.

But does anybody have any ideas about what sort of sensor to buy? The glass is also tinted, so that might make it trickier.

Thanks.

Maybe just 2 wires, when there is moisture they will be shorted out some. Measure the voltage on one pin with analog pin with internal pullup enabled, and the other pin to arduino gnd.

What crossroads said, but use A0 and A1 as comparator. So you can adjust a threshold to trigger the relais.

Thanks for the advice. Sounds like a cheap sensor too.

I've got some fiddling to do now.

Build some hysteresis into the system also. If the relay just switches on when the input level is above the threshold and off when the level is below the threshold, you will get a "jittering" effect on the relay as the input varies above and below this level. So switch the relay on when the input rises (or falls depending on how everything is wired) above an upper threshold and switch it off when it falls below a lower threshold.

you could use a dht11 sensor and determine the dew point - Arduino Playground - DHT11Lib -