A sensor comprising: a sensor element; and sensor circuitry coupled to the sensor element, the sensor element configured to sense rotation of a target wheel comprising a plurality of target elements and provide an output signal comprising a maximum and a minimum for each of the plurality of target elements, the sensor circuitry configured to use at least one maximum and at least one minimum related to one of the plurality of target elements to predict an optimal switching threshold for a future instance of that one of the plurality of target elements, wherein the sensor circuitry is configured to predict the optimal switching threshold for at least the next instance of that one of the plurality of target elements by at least one of: - using the maximum for the one of the plurality of target elements and an average of the minima for the plurality of target elements in one rotation, - using the maximum for the one of the plurality of target elements, a minimum immediately preceding the maximum and a minimum immediately following the maximum, - using the minimum for the one of the plurality of target elements and an average of the maxima for the plurality of target elements in one rotation; and - using the minimum for the one of the plurality of target elements, a maximum immediately preceding the minimum and a maximum immediately following the minimum. a sensor element; and sensor circuitry coupled to the sensor element, the sensor element configured to sense rotation of a target wheel comprising a plurality of target elements and provide an output signal comprising a maximum and a minimum for each of the plurality of target elements, the sensor circuitry configured to use at least one maximum and at least one minimum related to one of the plurality of target elements to predict an optimal switching threshold for a future instance of that one of the plurality of target elements, wherein the sensor circuitry is configured to predict the optimal switching threshold for at least the next instance of that one of the plurality of target elements by at least one of: - using the maximum for the one of the plurality of target elements and an average of the minima for the plurality of target elements in one rotation, - using the maximum for the one of the plurality of target elements, a minimum immediately preceding the maximum and a minimum immediately following the maximum, - using the minimum for the one of the plurality of target elements and an average of the maxima for the plurality of target elements in one rotation; and - using the minimum for the one of the plurality of target elements, a maximum immediately preceding the minimum and a maximum immediately following the minimum. - using the maximum for the one of the plurality of target elements and an average of the minima for the plurality of target elements in one rotation, - using the maximum for the one of the plurality of target elements, a minimum immediately preceding the maximum and a minimum immediately following the maximum, - using the minimum for the one of the plurality of target elements and an average of the maxima for the plurality of target elements in one rotation; and - using the minimum for the one of the plurality of target elements, a maximum immediately preceding the minimum and a maximum immediately following the minimum. <EOS>