Lookup table for CJ125 in V=8 amplification.

Support forum for the Lambda Shield designed to connect Bosch LSU 4.9 wideband oxygen sensors to Arduino projects.
Post Reply
User avatar
Christian_Bylund
Posts: 270
Joined: 07 Mar 2015 18:09

Lookup table for CJ125 in V=8 amplification.

Post by Christian_Bylund » 01 Sep 2019 22:29

I got a request for a lookup table when the CJ125 is in amplification V=8 compared to the standard code V=17.

The V=8 mode is more useful for rich applications, the V=17 mode is more useful for lean applications.

Here is a conversion table made from the LSU 4.9 data sheet for the V=8 mode:

Code: Select all

//Lambda Conversion Lookup Table, V8. (ADC 104-535).
const PROGMEM float Lambda_Conversion[432] {
    0.650, 0.651, 0.652, 0.653, 0.655, 0.656, 0.657, 0.658, 0.659, 0.660, 0.662, 0.663, 0.664, 0.665, 0.666, 0.668, 0.669, 0.670, 0.671, 0.672,
    0.674, 0.675, 0.676, 0.677, 0.678, 0.680, 0.681, 0.682, 0.683, 0.685, 0.686, 0.687, 0.688, 0.690, 0.691, 0.692, 0.694, 0.695, 0.696, 0.697,
    0.699, 0.700, 0.701, 0.703, 0.704, 0.705, 0.707, 0.708, 0.709, 0.711, 0.712, 0.713, 0.715, 0.716, 0.717, 0.719, 0.720, 0.721, 0.723, 0.724,
    0.726, 0.727, 0.728, 0.730, 0.731, 0.733, 0.734, 0.735, 0.737, 0.738, 0.740, 0.741, 0.743, 0.744, 0.746, 0.747, 0.749, 0.750, 0.751, 0.753,
    0.754, 0.756, 0.757, 0.759, 0.761, 0.762, 0.764, 0.765, 0.767, 0.768, 0.770, 0.771, 0.773, 0.774, 0.776, 0.778, 0.779, 0.781, 0.782, 0.784,
    0.785, 0.787, 0.789, 0.790, 0.792, 0.793, 0.795, 0.797, 0.798, 0.800, 0.802, 0.803, 0.805, 0.807, 0.808, 0.810, 0.812, 0.813, 0.815, 0.817,
    0.818, 0.820, 0.822, 0.824, 0.826, 0.827, 0.829, 0.831, 0.833, 0.835, 0.837, 0.839, 0.840, 0.842, 0.844, 0.846, 0.848, 0.850, 0.852, 0.854,
    0.856, 0.858, 0.860, 0.862, 0.863, 0.865, 0.867, 0.869, 0.871, 0.873, 0.875, 0.877, 0.879, 0.881, 0.883, 0.885, 0.887, 0.889, 0.892, 0.894,
    0.896, 0.898, 0.900, 0.902, 0.904, 0.907, 0.909, 0.911, 0.913, 0.916, 0.918, 0.920, 0.922, 0.925, 0.927, 0.929, 0.932, 0.934, 0.936, 0.938,
    0.941, 0.943, 0.945, 0.948, 0.950, 0.952, 0.955, 0.957, 0.959, 0.962, 0.964, 0.967, 0.970, 0.973, 0.976, 0.979, 0.982, 0.985, 0.988, 0.990,
    0.992, 0.994, 0.998, 1.003, 1.010, 1.017, 1.022, 1.027, 1.032, 1.036, 1.039, 1.043, 1.046, 1.050, 1.054, 1.058, 1.062, 1.067, 1.072, 1.077,
    1.082, 1.088, 1.094, 1.100, 1.106, 1.113, 1.119, 1.126, 1.132, 1.138, 1.144, 1.150, 1.156, 1.162, 1.167, 1.173, 1.179, 1.185, 1.191, 1.197,
    1.203, 1.209, 1.215, 1.221, 1.228, 1.234, 1.241, 1.247, 1.254, 1.261, 1.268, 1.274, 1.281, 1.288, 1.296, 1.303, 1.310, 1.317, 1.325, 1.332,
    1.340, 1.348, 1.355, 1.363, 1.371, 1.379, 1.387, 1.395, 1.404, 1.412, 1.420, 1.429, 1.438, 1.446, 1.455, 1.464, 1.473, 1.482, 1.491, 1.501,
    1.510, 1.519, 1.529, 1.539, 1.549, 1.559, 1.569, 1.579, 1.589, 1.600, 1.611, 1.621, 1.632, 1.643, 1.655, 1.666, 1.677, 1.689, 1.701, 1.713,
    1.725, 1.737, 1.750, 1.763, 1.775, 1.788, 1.802, 1.815, 1.829, 1.842, 1.856, 1.870, 1.885, 1.899, 1.914, 1.929, 1.944, 1.959, 1.974, 1.990,
    2.006, 2.022, 2.038, 2.055, 2.071, 2.088, 2.106, 2.123, 2.140, 2.158, 2.176, 2.195, 2.213, 2.232, 2.251, 2.270, 2.290, 2.310, 2.330, 2.350,
    2.371, 2.392, 2.413, 2.434, 2.456, 2.478, 2.500, 2.523, 2.546, 2.569, 2.593, 2.617, 2.642, 2.668, 2.693, 2.720, 2.747, 2.775, 2.803, 2.832,
    2.862, 2.893, 2.924, 2.956, 2.989, 3.023, 3.057, 3.093, 3.129, 3.167, 3.205, 3.245, 3.285, 3.327, 3.369, 3.413, 3.458, 3.504, 3.551, 3.600,
    3.650, 3.701, 3.753, 3.807, 3.862, 3.919, 3.977, 4.036, 4.097, 4.160, 4.224, 4.289, 4.356, 4.425, 4.496, 4.568, 4.642, 4.718, 4.796, 4.875,
    4.956, 5.039, 5.124, 5.211, 5.300, 5.391, 5.484, 5.580, 5.678, 5.781, 5.888, 5.999, 6.116, 6.239, 6.369, 6.505, 6.650, 6.802, 6.964, 7.134,
    7.315, 7.506, 7.708, 7.922, 8.148, 8.387, 8.639, 8.905, 9.185, 9.481, 9.792, 10.119
};
Best Regards,
Christian Bylund
Bylund Automotive AB

huangxiqing
Posts: 5
Joined: 02 Mar 2021 21:02

Re: Lookup table for CJ125 in V=8 amplification.

Post by huangxiqing » 02 Mar 2021 21:11

Hello! Use CJ125 with V = 8 to zoom in on what needs to be changed in the table code. Excuse my translator

User avatar
Christian_Bylund
Posts: 270
Joined: 07 Mar 2015 18:09

Re: Lookup table for CJ125 in V=8 amplification.

Post by Christian_Bylund » 10 Mar 2021 11:12

huangxiqing wrote:
02 Mar 2021 21:11
Hello! Use CJ125 with V = 8 to zoom in on what needs to be changed in the table code. Excuse my translator
Hello Huangxiqing,

Using the Lambda Shield 2 Example code below changes are required.

1. Conversion table need to be changed to handle course mode:

Code: Select all

//Lambda Conversion Lookup Table, V8. (ADC 104-535).
const PROGMEM float Lambda_Conversion[432] {
    0.650, 0.651, 0.652, 0.653, 0.655, 0.656, 0.657, 0.658, 0.659, 0.660, 0.662, 0.663, 0.664, 0.665, 0.666, 0.668, 0.669, 0.670, 0.671, 0.672,
    0.674, 0.675, 0.676, 0.677, 0.678, 0.680, 0.681, 0.682, 0.683, 0.685, 0.686, 0.687, 0.688, 0.690, 0.691, 0.692, 0.694, 0.695, 0.696, 0.697,
    0.699, 0.700, 0.701, 0.703, 0.704, 0.705, 0.707, 0.708, 0.709, 0.711, 0.712, 0.713, 0.715, 0.716, 0.717, 0.719, 0.720, 0.721, 0.723, 0.724,
    0.726, 0.727, 0.728, 0.730, 0.731, 0.733, 0.734, 0.735, 0.737, 0.738, 0.740, 0.741, 0.743, 0.744, 0.746, 0.747, 0.749, 0.750, 0.751, 0.753,
    0.754, 0.756, 0.757, 0.759, 0.761, 0.762, 0.764, 0.765, 0.767, 0.768, 0.770, 0.771, 0.773, 0.774, 0.776, 0.778, 0.779, 0.781, 0.782, 0.784,
    0.785, 0.787, 0.789, 0.790, 0.792, 0.793, 0.795, 0.797, 0.798, 0.800, 0.802, 0.803, 0.805, 0.807, 0.808, 0.810, 0.812, 0.813, 0.815, 0.817,
    0.818, 0.820, 0.822, 0.824, 0.826, 0.827, 0.829, 0.831, 0.833, 0.835, 0.837, 0.839, 0.840, 0.842, 0.844, 0.846, 0.848, 0.850, 0.852, 0.854,
    0.856, 0.858, 0.860, 0.862, 0.863, 0.865, 0.867, 0.869, 0.871, 0.873, 0.875, 0.877, 0.879, 0.881, 0.883, 0.885, 0.887, 0.889, 0.892, 0.894,
    0.896, 0.898, 0.900, 0.902, 0.904, 0.907, 0.909, 0.911, 0.913, 0.916, 0.918, 0.920, 0.922, 0.925, 0.927, 0.929, 0.932, 0.934, 0.936, 0.938,
    0.941, 0.943, 0.945, 0.948, 0.950, 0.952, 0.955, 0.957, 0.959, 0.962, 0.964, 0.967, 0.970, 0.973, 0.976, 0.979, 0.982, 0.985, 0.988, 0.990,
    0.992, 0.994, 0.998, 1.003, 1.010, 1.017, 1.022, 1.027, 1.032, 1.036, 1.039, 1.043, 1.046, 1.050, 1.054, 1.058, 1.062, 1.067, 1.072, 1.077,
    1.082, 1.088, 1.094, 1.100, 1.106, 1.113, 1.119, 1.126, 1.132, 1.138, 1.144, 1.150, 1.156, 1.162, 1.167, 1.173, 1.179, 1.185, 1.191, 1.197,
    1.203, 1.209, 1.215, 1.221, 1.228, 1.234, 1.241, 1.247, 1.254, 1.261, 1.268, 1.274, 1.281, 1.288, 1.296, 1.303, 1.310, 1.317, 1.325, 1.332,
    1.340, 1.348, 1.355, 1.363, 1.371, 1.379, 1.387, 1.395, 1.404, 1.412, 1.420, 1.429, 1.438, 1.446, 1.455, 1.464, 1.473, 1.482, 1.491, 1.501,
    1.510, 1.519, 1.529, 1.539, 1.549, 1.559, 1.569, 1.579, 1.589, 1.600, 1.611, 1.621, 1.632, 1.643, 1.655, 1.666, 1.677, 1.689, 1.701, 1.713,
    1.725, 1.737, 1.750, 1.763, 1.775, 1.788, 1.802, 1.815, 1.829, 1.842, 1.856, 1.870, 1.885, 1.899, 1.914, 1.929, 1.944, 1.959, 1.974, 1.990,
    2.006, 2.022, 2.038, 2.055, 2.071, 2.088, 2.106, 2.123, 2.140, 2.158, 2.176, 2.195, 2.213, 2.232, 2.251, 2.270, 2.290, 2.310, 2.330, 2.350,
    2.371, 2.392, 2.413, 2.434, 2.456, 2.478, 2.500, 2.523, 2.546, 2.569, 2.593, 2.617, 2.642, 2.668, 2.693, 2.720, 2.747, 2.775, 2.803, 2.832,
    2.862, 2.893, 2.924, 2.956, 2.989, 3.023, 3.057, 3.093, 3.129, 3.167, 3.205, 3.245, 3.285, 3.327, 3.369, 3.413, 3.458, 3.504, 3.551, 3.600,
    3.650, 3.701, 3.753, 3.807, 3.862, 3.919, 3.977, 4.036, 4.097, 4.160, 4.224, 4.289, 4.356, 4.425, 4.496, 4.568, 4.642, 4.718, 4.796, 4.875,
    4.956, 5.039, 5.124, 5.211, 5.300, 5.391, 5.484, 5.580, 5.678, 5.781, 5.888, 5.999, 6.116, 6.239, 6.369, 6.505, 6.650, 6.802, 6.964, 7.134,
    7.315, 7.506, 7.708, 7.922, 8.148, 8.387, 8.639, 8.905, 9.185, 9.481, 9.792, 10.119
};
2. The CJ125 controller need to be set to course mode V=8 instead of V=17:

Code: Select all

//Set CJ125 in normal operation mode.
COM_SPI(CJ125_INIT_REG1_MODE_NORMAL_V8);  /* V=0 */
//COM_SPI(CJ125_INIT_REG1_MODE_NORMAL_V17);  /* V=1 */
3. Handle the conversion properly:

Code: Select all

//Lookup Lambda Value.
float Lookup_Lambda(int Input_ADC) {
  
    //Declare and set default return value.
    float LAMBDA_VALUE = 0;

    //Validate ADC range for lookup table.
    if (Input_ADC >= 104 && Input_ADC <= 535) {
      LAMBDA_VALUE = pgm_read_float_near(Lambda_Conversion + (Input_ADC-104));
    }
    
    if (Input_ADC > 535) {
      LAMBDA_VALUE = 10.119;
    }

    if (Input_ADC < 104) {
      LAMBDA_VALUE = 0.650;
    }
    
    //Return value.
    return LAMBDA_VALUE;
    
}
4. Handle output properly:

Code: Select all

//Display lambda value unless out of range.
if (adcValue_UA >= 104 && adcValue_UA <= 535) {
	txString += ", Lambda: ";
        txString += String(LAMBDA_VALUE, 2);
} else {
        txString += ", Lambda: -";
}

//Display oxygen unless out of range.
txString += ", Oxygen: -";
Hope it helps.
Best Regards,
Christian Bylund
Bylund Automotive AB

huangxiqing
Posts: 5
Joined: 02 Mar 2021 21:02

Re: Lookup table for CJ125 in V=8 amplification.

Post by huangxiqing » 10 Mar 2021 17:01

Thank you let me test

huangxiqing
Posts: 5
Joined: 02 Mar 2021 21:02

Re: Lookup table for CJ125 in V=8 amplification.

Post by huangxiqing » 10 Mar 2021 22:17

I want to change v8 in shield 2 GUI code

User avatar
Christian_Bylund
Posts: 270
Joined: 07 Mar 2015 18:09

Re: Lookup table for CJ125 in V=8 amplification.

Post by Christian_Bylund » 10 Mar 2021 22:41

huangxiqing wrote:
10 Mar 2021 22:17
I want to change v8 in shield 2 GUI code
Sorry, the GUI code will only support the V17 mode.
Best Regards,
Christian Bylund
Bylund Automotive AB

huangxiqing
Posts: 5
Joined: 02 Mar 2021 21:02

Re: Lookup table for CJ125 in V=8 amplification.

Post by huangxiqing » 11 Mar 2021 02:22

Serial output 2,1,10495,593,176,209,11476

Post Reply