We propose a temperature sensor design based on the two-dimensional (2-D) photonic crystals (PhCs) microcavity coupled to two waveguides. We consider a Si 2-D PhC, and the refractive index (RI) of distilled water in holes has been taken as temperature dependent. The resonant wavelength will shift when temperature variation induces change in the RIs of the distilled water. The temperature variation causes the shifting of defect modes. The transmission characteristics of light in the sensor under different RIs that correspond to the change in temperatures are simulated by using the finite-difference time-domain method. A sensitivity of was achieved with the structure proposed. This property can be exploited in the design of a temperature sensor.