Optical Sensor Based on a Mesoscopic Photonic Crystal Microcavity