A sensor for the detection or measurement of carbohydrate analyte (such as glucose) in fluid comprises components of a competitive binding assay the readout of which is a detectable or measurable optical signal (such as FRET assay) retained by a material that permits diffusion of analyte but not the assay components, the assay components comprising: an animal lectin and an analyte analogue capable of competing with analyte for binding to the lectin.