A sensor device for detecting a substance contained in a fluid comprises
first and second photonic crystal regions, first and second flow
channels, an optical waveguide connected to the first and second photonic
crystal regions and an optical detector for detecting the lights
transmitted through the first photonic crystal region and the waveguide
and transmitted through or reflected by the second photonic crystal
region.