How to convert wideband afr:voltage points to an equation
If you programmed your wideband's afr:voltage points, you need an equation that maps voltage to afr before creating a calc pid.
Say the afr:voltage points are (AFR0, V0) and (AFR1, V1);
you want an equation that maps wideband voltage v to afr;
First calculate the slope:
slope = (AFR1 - AFR0)/(V1 - V0)
afr is related to v by this equation:
(afr - AFR0)/(v - V0) = slope
Rearranged this becomes:
afr = slope*(v - V0) + AFR0
The part to the right of the = is what goes into your calc pid.
Example 1:
(AFR 10, 0V), (AFR 20, 5V)
slope = (20 - 10)/(5 - 0) = 10/5 = 2
afr = 2*(v - 0) + 10 = 2*v + 10
Example 2:
(AFR 10, 1V), (AFR 18, 5V)
slope = (18 - 10)/(5 - 1) = 8/4 = 2
afr = 2*(v - 1) + 10 = 2*v + 8
Example 3:
(AFR 10, 1V), (AFR 17, 4.5V)
slope = (17 - 10)/(4.5 - 1) = 7/3.5 = 2
afr = 2*(v - 1) + 10 = 2*v + 8
Example 4:
(AFR 9, 1V), (AFR 18, 5V)
slope = (18 - 9)/(5 - 1) = 9/4 = 2.25
afr = 2.25*(v - 1) + 9 = 2.25*v + 6.75
Sanity check: plug each of the 2 voltages into the equation and see if the corresponding afr pops out.
:)