# Can an infrared sensor detects water ?

#### wmodavis

Joined Oct 23, 2010
739
Maybe hot water.

#### #12

Joined Nov 30, 2010
18,223
The circuit provided will not work, but I believe you can pulse the infrared like you would pulse a visible light or ultrasound and get a bounce measurement to the surface of a water level. Problems:
1) Measuring short distance with light is very fast electronics.
2) I personally don't know how to do this job.
3) You did not say you wanted to find the level (or the surface)of the water.

#### Sensacell

Joined Jun 19, 2012
3,011

#### dataman19

Joined Dec 26, 2009
135
Infrared is good at detecting a thermal difference, the trouble with water is that it "masks" everything immersed in it (to some extent).
But should you use a float that would reflect infrared (tinfoil works, but doesn't float very well) - you could use an IR LED and detect the reflection and use it as a difference in the ambient temp of the surrounding water.
...

#### dataman19

Joined Dec 26, 2009
135
Oh yea, I forgot to mention. Water absorbs infrared energy, so you would have to have a lot to raise the water temp, which would still result in even temp dispersal... back to square one. Or the idea of a float.
...
In reality, you could adjust the sensitivity and trigger with a small reflection, so the float's position on the water surface wouldn't matter that much, just make sure the beam width on the IF emitter is wide enough (or that you use more than one IR LED).

#### THE_RB

Joined Feb 11, 2008
5,438
I did some tests in a thread on this forum or the other forum using one of the Sharp "GP2" infrared distance sensors, like they use in hobby robotics.

It was able to detect the top surface of the water sometimes, but other times would get the bottom of the bucket. It could see the water, but was not really reliable and was very sensitive to angle and slosh.

This was fixable by floating a flat piece of foam on top of the water or a heap of styrofoam balls or packing chips etc.

As for calibration the Sharp GP2 sensors have datasheets with the calibration curve, or you can use software calibration like the simple PIC one in C here;

Rich (BB code):
void calc_distance(void)
{
// from the Sharp datasheet the analog voltage is
// the inverse of distance, so distance can be calculated
// d = (1 / volts) then just scaled to suit the sensor

math = (math * 256);

// now invert it; (1 / volts) use (6050 / volts) for scaling
math = (6050 / math);
if(math >= 2) math -=2;     // fix linear error
if(math > 99) math = 99;    // max limit at 99cm

// convert from 0-99 to 2 decimal digits, 0-99cm
cm10=0;
while(math >= 10)
{
cm10++;
math -= 10;
}
cm = math;
}