Calculating voltage thresholds