Can an infrared sensor detects water ?

Discussion in 'General Electronics Chat' started by Ahmed Adel Hosni, Jul 5, 2012.

  1. Ahmed Adel Hosni

    Thread Starter Active Member

    Aug 16, 2010
  2. wmodavis

    Well-Known Member

    Oct 23, 2010
    Maybe hot water.
  3. #12


    Nov 30, 2010
    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.
  4. Sensacell

    Well-Known Member

    Jun 19, 2012
    The answer is *maybe*

    Provide more information about the application?
  5. dataman19


    Dec 26, 2009
    Maybe is the best answer...
    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.
  6. dataman19


    Dec 26, 2009
    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).
  7. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    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;

    Code ( (Unknown Language)):
    2. void calc_distance(void)
    3. {
    4.   // from the Sharp datasheet the analog voltage is
    5.   // the inverse of distance, so distance can be calculated
    6.   // d = (1 / volts) then just scaled to suit the sensor
    8.   // load ADC value in 16bit math var
    9.   math = ADRESH;
    10.   math = (math * 256);
    11.   math += ADRESL;
    13.   // now invert it; (1 / volts) use (6050 / volts) for scaling
    14.   math = (6050 / math);
    15.   if(math >= 2) math -=2;     // fix linear error
    16.   if(math > 99) math = 99;    // max limit at 99cm
    18.   // convert from 0-99 to 2 decimal digits, 0-99cm
    19.   cm10=0;
    20.   while(math >= 10)
    21.   {
    22.     cm10++;
    23.     math -= 10;
    24.   }
    25.   cm = math;
    26. }
    Sharp GP2 project is shown at the bottom of this page;