In recent years, Photonic Crystal (PhC) has attracted a lot of attention because of its more important properties for controlling and manipulating light through crystal . Based on this characteristic, many scientists are finding designs and applications for various optical devices, such as optical decoders , logic gates [3,4], sensors , etc.
Due to their several advantages such as bandwidth properties and the flexibility of miniaturization, PhC-based devices are now playing a very important role in new fields such as optical sensing .
Recently, optical sensors have attracted the attention of researchers because of their advantage over electronic sensors, which are limited in transferring large data at a very higher speed, which can be solved by all-optical sensors, optical switches, and the tunable filter [7–11]. Optical sensors have been used effectively in many applications to detect various parameters such as pressure , biochemical sensors , gas , electric field , and temperature . Temperature measurements are very important and are widely used in the risk control application of the petrochemical industry, automotive industry, avionics, industrial safety, biomedicine [17–20], and in many other applications.
Different optical temperature sensors based on 2D-PhC can be realized by ring resonators  and waveguides structure . Although nanosensors based on ring resonators offer high normalized transmission efficiency, high sensitivity, and high-quality factor . PhC waveguide-based nano-sensors have a good standardized transmission efficiency but a very low- quality factor .
In the present work, we have proposed a new hexagonal nanosensor based on a resonant cavity to detect the temperature in the range of 0°C to 500°C. The proposed temperature sensor has a wide range of applications in the defense, chemical, civil, metal production, semiconductor industry, and other fields. Temperature monitoring is also important for estimating the structural health of the device. The proposed design is more compact and simpler. Also, it offers a very high-quality factor and high sensitivity.