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.