A drug delivery device (100) comprising; a housing (102); a cylindrical member (406) configured to be rotatably supported inside the housing, wherein the outer surface of the cylindrical member is provided with a track (110) comprising a sequence of encoded images; and a sensor (112) directed at the track of the cylindrical member and configured to detect features of the encoded images.L'invention concerne un dispositif d'administration de médicament qui comporte : un boîtier; un élément cylindrique configuré pour être porté de manière rotative à l'intérieur du boîtier, la surface externe de l'élément cylindrique étant pourvu d'une piste comportant une séquence d'images codées, et un capteur dirigé vers la piste de l'élément cylindrique et configuré pour détecter des caractéristiques des images codées.