Electronic – Detect presence of solid object

microcontrollersensor

I have a microcontroller-based project (using an Atmega328) that needs to detect the presence of a solid object placed on the project box. What would be the best way to achieve this? I've thought about using a photosensitive resistor in a voltage divider configuration, but the issue I have with this is that if the project box is in a dark room it may not detect any light when the object is removed.

Any and all input on this would be appreciated as I'm not sure how reliable my voltage divider solution is. The objects placed on the project box will be solid and made of glass or plastic. And the only output needed from whatever sensor I use is a logical zero or one to signify if an object is there or not there. Note the objects may have concave bottoms, so the sensor would need to be able to identify it even if it's up to 1-2 cm away from the sensor.

Best Answer

A couple options come to mind.

Range finder

Use an ultrasonic range finder or, if you think the object would be opaque enough, an infrared proximity sensor. Put the sensor in the top of the box, pointing up and out of a hole you've cut there and poll it occasionally. When the measured distance decreases rapidly, and as a method of noise filtering stays low for a set number of samples, you've got an object in the way.

Properly placed load sensor

Another way is to put the load sensors on the bottom of the box. Assuming the object is actually placed on the box, the detected load will increase and can signify the presence of an object.

Strain gauge

Make the top of the box springy, that is, it's lifted slightly from a solid resting point. Now place a strain gauge in the gap. When an object is placed on the top it is depressed and bends the strain gauge. This signifies the presence of an object.

The above options don't necessarily give you a logical one/zero for presence, but neither would a optical sensor.

Momentary push buttons

If you're mechanically savvy, you could even use one or more push button switches. For instance, on the lid of your project box place three/four push button switches and attach (glue) a platform for the object on top of them. This method might not be terribly reliable though. I'd try to avoid too many moving parts.

Personally, I'd go with the optical range/proximity sensor.