If you have to drill a certain depth for a project, you need a bench drill with depth display. Most bench drills have a ruler with an arrow for reading. The success of the drilling depends on how accurately you can read the desired position. In this Arduino project I present an alternative proposal: A drilling depth display with a gyro sensor and 7-segment display with Arduino support.
The machine I use most frequently in my workshop is not a saw or a grinding machine. It is by far the bench drill. Regardless of the project, it is actually always used. If I need a certain drilling depth, I can use the built-in ruler on the machine. And remember the depth to which I have to drill. It actually works well.