The big picture is that I want to construct a sensor that detects of mail has arrived in my mailbox.
It is a small metal box with a slot in for mail, and I wanted something with a low profile to not take away from the space available for the mail. This was the part where I wished the sensor be as low profile in height as possible. For example some ultrasonic sensors are very tall.
This also explains why the sensor doesn't really need to give an exact measurement of how far away the object is, just that there is an object between 0 to around 30mm.
I thought about this, but if the object that is to be detected is flush with the sensor I don't see this working as the light would be blocked and could not bounce of the object to be detected at the receiver.
Previously I have tested a solution in where the diodes are in the bottom and the receivers at the top, but that meant too much wiring. I would prefer for the entire sensor to be housed at the bottom.
Wow that was a really cool sensor in a easy to use package!
The only thing is that I don't think it works if something is 0mm from the sensor, so touching it so to say. Then the light can't bounce of the object and into the light detector =\
Detecting mail coming through the slot may be another approach. Presumably the slot is some distance above the bottom and below the top.
Or, why not mount an ultrasonic sensor so the business end is flush with (or even below) the bottom of the box. Provided the box is tall enough, the sensor will return the height of the box when there is no mail, and if it is the venerable HC-SR04, it will timeout if there is mail (echo not received).
The same concept may also work with the VL6180X: no mail = returns box height; mail = returns zero...
Unfortunately mail usually don't arrive in the slot, rather the mailman opens the entire door to get access to all the mailboxes at once.
But I think I spoke too soon about the 0mm problem, and I think this ToF sensor will indeed work very well : )
As you said, it will either return the height of the box, and all other values means there is mail, more or less.
Ultrasonic sensors are too large, at least from what I have seen. Nothing can be mounted outside of the box, as the walls are shared with the other mailboxes.