A drug delivery device (100) comprising a housing, a cylindrical dose setting and coding member (406) rotatably supported inside the housing, wherein the outer surface of the cylindrical member is provided with a track (110) comprising a sequence of encoded 2D images in the form of pixel maps representing a 7 bit dosage code. Each pixel map contains the same distinct geometric feature. A sensor (112) directed at the track of the cylindrical member captures an image, and a processor (202) receives the image data from the sensor and detects the geometric feature of the image in order to locate the area within the image which contains the data bits. The processor decodes the pixel map in order to determine the currently set dose and send the value to a display.