We were inspired by the buzzer that you find in mobile and laptop showrooms – the ones that produce this annoying high frequency tone if you fiddle a ‘little too much’ with the displayed product.
We use a 555 timer in its Astable mode to produce the frequency tone and couple it with a digital IR sensor module. We do this by connecting the output pin and the ground parallel to R2 in the figure.
And as a result when there are no objects in the vicinity, the system produces a high frequency tone, but when an object is introduced the sound dies out. This is attributed to the change in resistance value.
Here is another variation of the same: