The invention relates to a device for detecting and identifying a peristaltic cassette which is provided with a rotary mechanism comprising rollers connected to a spacer (1) and which is intended to be rotated by a drive system connected to the device. Said device comprises a sensor arranged such as to detect the passage of at least one distinctive element (2) disposed on the spacer, by counting the number of distinctive elements detected during one cassette rotation.