A cantilever unit comprising a first substrate, a second substrate mounted on said first substrate, a cantilever having a fixed end and a free end, said fixed end being supported by said second substrate and said free end being displaceable due to elastic distortion of said cantilever by application of a force thereto, said cantilever being kept apart from said first substrate in the direction of the elastic distortion, an optical waveguide provided on said first substrate, a light source for introducing a light beam into said optical waveguide, a first coupler provide in the optical waveguide for capturing the light beam transmitted through the optical waveguide and projecting the captured light beam against the cantilever, a second coupler provided in the optical waveguide for reintroducing the light beam reflected from the cantilever, and means for detecting a change of the optical path of the light beam due to elastic distortion of said cantilever.