Bukit Mertajam, Penang

Water level measurement

Cytron received an inquiry from our precious customer today. The question is about measuring water level using Analog Distance Sensor (SN-GP2Y0A21). He (i think is a ‘he’) asked whether the infrared beam will penetrate the water, or instead, reflect by the water surface. That’s an interesting question which has never come over my mind. So I decided to conduct a quick experiment after my lunch.

This is the hardware settings. I’m running the test in our pantry. You can see the water dispensers at the two sides of the photos and that’s my water bottle with IFC cards standing next to it. I’m using IFC-MB00 (main board), CP04 (for analog display), AI08 (to read analog value from the sensor) and EB02 (frankly speaking, it’s for the sensor to reach the opening of the bottle). Analog Distance Sensor is hanging at the opening of the bottle.

For the software part, I download the sample code provided in IFC-AI08 product page, include some necessary files required by IFC system and that’s it!

Photos are snapped while adding filtered drinking water to the bottle. The photos below show the analog reading and the water level of the bottle. Yes, it can detect the water level! The values show that the sensitivity is not high because the sensor’s detecting distance is ranged from 10cm to 80cm and I didn’t rescale the analog value in this experiment.

HOWEVER, this sensor is not designed for this purpose. I guess it’ll be interfered by surroundings condition like brightness, light reflection…So I’m not saying that this i’s the correct method to detect water level. Remember to do your own verification before you claim that it works =p


Related Posts

Comments (8)

wow.. nice work.!

Good testing and I agree that this is not exactly sensor to detect water level.

thanks for the experiment.it help us a lot.so can i ask one question. If i use an IR distance sensor with longer range, is it the sensitivity is high?how about use a ultrasonic sensor.is it suitable for detect level of water?

I think ultrasonic should have no problem to detect the water level. For IR distance sensor with longer range, the sensitivity will be lower.

so, it means that the ir is refracting on the water surface.

can u please tell me, how you handle the non-linear behavior of the sensor in controller programming?
can i get the source code for this please?

Hi Nouman,

Actually this is just a very simple experiment utilizing IFC cards (MB00, AI08, CP04, PC00 & EB02) and the programming part is using AI08’s sample source code provided by Cytron.
Since the measuring distance in this case is only ranging from around 10 to 25cm, the non-linearity of the output is still not very obvious. Besides, i just want to test whether the sensor can detect water surface, so i didn’t ponder the linearity as long as its value changes respectively with the water depth =P
However, you may refer to this article: http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html


Leave a comment