Linear displacement sensor is a component, which can convert the displacement into electrical signals, and is used to measure the relative motion between components. Because the relationship between output of sensor and stroke power is nonlinear and it may be affected by external factors, the circuit should be compensated and the sensor should be calibrated. In this research, the LED formed light knife in the mechanical slit, lighting on the sensitive CCD array, and the relationship between displacement and CCD photosensitive arrays can be founded. CCD is the discrete components, which has avoided the nonlinear problem. At the same time, because the CCD output is digital, it reduced the measurement time, so that linearity, accuracy, stability, greatly are improved greatly.