A new imidazole derivative of 1,2-diaminoanthraquinone and fluorene-2-carboxaldehyde was designed as a sensor B2 to selectively detect the cyanide (CN−) ion through colorimetric and/or fluorometric methods. The photochemical characterizations of sensor B2 were tested using absorption and emission spectral studies in CH3CN-H2O (8:2) semi-aqueous medium. An excited state proton transfer process (ESIPT) was proved by theoretical and spectral studies. The colorimetric and fluorescence detection limit of CN− ion was found to be 5.3 × 10− 6 M and 4.11 × 10−8 M, respectively. 1H NMR titration, electrochemical and DFT studies were supported the removal of –NH proton from B2. In order to utilize this sensor in real-time applications, we developed a test cassette which is coated with sensor B2 detected the presence of CN− ion in the food sample with endogenous cyanide ion. © 2018 Elsevier B.V.