In an electrochemical sensor, a peak is detected by grouping data points in windows and detecting two or three windows between which the slope of the data changes sign. The peak can be more precisely detected by detecting the highest data point in the two or three windows.