A medicament delivery device includes a housing configured to receive a container of medicament and a piston rod moveable within the housing and configured to engage a container of medicament when received within the housing. The medicament delivery device further includes a position-sensing mechanism configured to detect the position of the piston rod within the housing. The position-sensing mechanism includes a first light source configured to emit light, a first sensor disposed proximate the first light source and configured to receive light emitted by the first light source, and a blocking member moveable between the first light source and the first sensor. The first sensor is configured to detect the light pattern received to determine the position of the piston rod within the housing.