In this technology diffraction-based sensors made from porous materials are used for the detection of small molecules. The porous nature of the diffraction gratings that gives rise to an extremely large active sensing area enables a very high level of sensitivity. Specificity is achieved by functionalizing the porous gratings with selective binding species.