A drug delivery device comprising a piston rod adapted to engage and axially move a cartridge piston to thereby expel an amount of drug from a loaded cartridge corresponding to a set dose amount, the device comprising a motor for moving the drive member from an initial position, through a start-of-dose position, to an end-of-dose position, as well as position detection means adapted to generate output data indicative of the drive members position relative to the piston of a loaded cartridge. An electronic controller adapted is adapted operate the motor to continuously move the drive member from the initial position, based on output data from the position detection means determine that the drive member is in engagement with the cartridge piston corresponding to the start-of-dose position, and operate the motor to move the drive member from the start-of-dose position to the an end-of-dose position corresponding to the set dose.