An infusion pump for infusing fluid from a reservoir into a body of a user comprises a housing; a drive mechanism including a motor and one or more drive components contained within the housing and operatively coupled to the reservoir to deliver fluid from the reservoir through a fluid path into the body of the user. The pump further has one or more electronic components to take a series of measurements of a parameter associated with the motor or one of the drive train components; and there is provided a controller within the housing. The controller is configured such that after each measurement in the series of measurements is taken, the controller performs a comparison between the measurement taken and a predetermined threshold value before the next measurement in the series of measurements is taken. If the comparison indicates that the measurement taken is less than the predetermined threshold value, the controller determines that there is no occlusion. If, however, the comparison indicates that the measurement taken is greater than the predetermined threshold value, then an additional measurement of said parameter is taken. This is done up to a predetermined total number of measurements, and wherein, if the additional measurement is still greater than the predetermined threshold value and the predetermined total number of measurements has been reached, the controller: (a) calculates a weighted average of the total number of measurements, (b) compares the weighted average to a comparison value, and (c) determines whether an occlusion has occurred in the fluid path of the infusion pump by determining whether the weighted average is greater than the comparison value.