Infrared distance sensor through glass?


I’m building a table with 4 holes, that is covered with glass. Underneath the table is a camera, that captures a snapshot when all 4 holes are covered with paper. The idea is that it can only take a snap shot when there is paper covering the holes, so that it doesn’t capture the ceiling etc.

I’m thinking to use infrared distance sensors ( to check whether there is something placed on the glas, but I’m not sure if the glas itself would influence the distance so much, that I won’t be able to tell the difference with or without paper.

So my first question is: Do you think infrared distance sensors would work?

Secondly if it doesn’t, is there any better way to check for paper on top of the glas?

I hope it makes sense.

Kind regards,

The chart in figure 2 in the pdf file in your link shows that the reflectivitiy of the surface has little impact on the sensor. In other words, the glass is not transparent.

Doesn't placing the paper block light? Can't you sense when the light level has dropped enough?

I suspect that the glass will reflect the infrared so the sensor will always read the distance to the glass. This article agrees with my practical experience;

You are not really interested in "distance" though since paper on the table will always be at the same distance. As suggested by PaulS you might be better looking for a drop in light level. Can you not always have an external light source then have a light sensor under each hole.

You have my curiosity, why are you taking pictures inside a box when holes are covered in paper? ^_^

Thanks for the quick replies!

It's an installation for a museum. The idea of the box is to capture the content on the paper cards. As the camera is inside the box, we'll also have lights placed inside the box to light up the paper cards. That's why sensing the light, with for example the camera is more difficult, as there will always be light, with or without paper cards.

I'm considering testing the pixels where the cards would be placed with the webcam / software, but depending on whats drawn on the cards the pixel might be white or black, so also that isn't 100% waterproof.

You'd think there'd be an easy way to check :P Perhaps checking several pixels and taking an average, or comparing the values to the 'standard' pixel values.

Your help is much appreciated.

You may want to use a diffuse-reflective sensor such as

Assuming that you don't have a lid on the box then with a bright light inside there will be much more reflected light when there is paper covering the glass. If you put a LDR or photo-transistor at the bottom of a dark tube with the open end pointing upwards I would be very surprised if you could not detect the presence of a piece of paper covering your box.

Obviously, if you have a white lid on the box then it's more difficult!

If you have light outside the box then when the papers block that....

Alternatively perhaps the light in the box could be off and you sense the external light. If you cover the windows using card rather than paper you should be easily able to sense the loss of external light. Then you turn the light on inside the box, take your picture and turn the light off. This would have the advantage of saving energy if the box is sitting unused.


Sorry for the late reply.

That sounds like quite a nice solution actually! I could check the values of a few pixels with the web camera, then if they are black (darker then the standard value), I could enable the scanning button. Then after they push the button, turn on the lights with a relay, take a picture, turn the lights back off and start sensing pixel values again.

I'll see how it works and report back.



Getting back to the infrared, i just did a lot of experiments with a similar intent using infrared distance sensors (actually i just used an infrared LED and infrared detector led from radioshack wired like the second diagram, you can also wire it like the first pic and read it with a pulse signal). I was trying to detect a finger or a couple of fingers through a sheet of smoked glass. if you have the leds pointed at about a 60 degree angle toward the center of your rectangle with one led at one end of the rectangle and one at the other so it doesnt get in the way of the camera it detects a voltage, but if you make it darker with your finger or a piece of paper it will reflect more or less infrared light (i am guessing more because the paper will mostly be white), giving you a different voltage that can be read with the analogRead.

Pulse Infrared.png

Analog Infrared.png

If you do try to sense the loss of external light then you need to ensure you don’t take lots of photos at night (if the device is left switched on) or if somebody leaves cards over the windows for a long time. This can easily be done if your sketch checks that it does see external light between photographs. Personally I would use one or more photo-resistors to sense the light level as that sounds simpler to me, but if you are confident in your pixel sampling method go for it.