Tool-origin compensation is important in high-precision micro-machining, as the tool-origin can become changed by the tool replacement. It is desirable to use a simple system, preferably consisting of a single light source and a single detector. To date, such systems have been restricted to measuring the tool position in two dimensions. We describe a measurement system that uses a single laser diode and a single photodetector that can measure change in the tool displacement in three dimensions. The sensor apparatus uses the principle of occlusion to measure the tool location, based on a modified version of Shin's measurement models. The resolution and repeatability were evaluated and the tool-origin compensation ability of the optical sensor was demonstrated by characterizing the machining error.