Page 1 of 1

Reading temperature of sensor

Posted: 18 Jul 2020 16:39
by spfautsch
Christian_Bylund wrote:
24 Jun 2020 01:20
Are you trying to map the sensor temperature?
Sorry to hijack this support thread, but it directly relates to something I'm interested in. Curious if you have any info on how to build a lookup table to do this (convert the UR adc value to temp). I've been searching but find nothing really useful except this: https://www.pi-innovo.com/lambda-measur ... d-lsu-4-9/

Code: Select all

Note: The sensor temperature transfer function is nonlinear from room temp to ~650oC and linear from 650 oC and above.
So I suppose a simple linear equation would give a relatively accurate conversion down to 650C if we had another point of reference. You mention in your initial reply that 176 on the UR adc equates to roughly 780c - how did you determine this?

I'd very much like to have this and the heater duty cycle pumped out the uart along with lambda so I can log it with a simple shell script.

Re: UR analog value does not change with temperature

Posted: 19 Jul 2020 13:07
by Christian_Bylund
Hi Scott! I am glad to see you found your way to the forum.
spfautsch wrote:
18 Jul 2020 16:39
So I suppose a simple linear equation would give a relatively accurate conversion down to 650C if we had another point of reference.
Image
The Bosch Technical Product Information Y 258 E00 015e shows us the temperature profile of the Nernst cell resistance in Ohm. It isn't really linear but it could be simplified as linear.

We alos get some information on the cold resistance at room temperature.
Image
spfautsch wrote:
18 Jul 2020 16:39
You mention in your initial reply that 176 on the UR adc equates to roughly 780c - how did you determine this?
By setting the CJ125 in calibration mode it will give the UR output corresponding to 780°C. Ee set it as target value for the heater. Typically 173-176 ADC.

Furthermore the Mini LSU 4.9 data sheet have some more information on the operating points.

Image

I will try to figure out how to convert OHM to ADC for the UR signal. Note that in most cases the heater regulation is spot on to 780°C, the sensor should not be placed so close to he exhaust port that the heater will remain at off. We could detect this by setting an alarm at UR values below 170.

Re: UR analog value does not change with temperature

Posted: 20 Jul 2020 21:57
by spfautsch
Thanks Christian - I hadn't seen the 4.9 "mini" datasheet you mentioned. That's somewhat helpful though it still doesn't quite help finding a correlation to the ADC value.

Simply logging the UR adc value would be sufficient, but I thought it would be nice to be able to represent sensor temperature in thermal units.

I suppose another possibility would be controlling the sensor heating in a process control oven or kiln and mapping the ADC value that way. Though I'm not excited to remove the sensor from my exhaust. I suppose I could use one of my fouled sensors as long as the nernst cell hasn't been fractured.

If that would be plausible, could I just bypass the warmup routine and let the oven handle that?

Re: UR analog value does not change with temperature

Posted: 20 Jul 2020 22:06
by Christian_Bylund
Hi Scott.

My current idea is to increment the heater control in steps. Monitor the current and voltage of the Nernst-cell and by that map the UR ADC value with the temperature based on the table from the Mini LSU datasheet for each point. With that we could generate a lookup table based on the UR value.

What do you think?

Re: UR analog value does not change with temperature

Posted: 23 Jul 2020 03:23
by spfautsch
Can the pump current and voltage be monitored by reading the registers of the CJ125? I apologize for not having researched this to answer my own question, but I've been experiencing some exceptional life events the past 10 days or so and haven't been able to perform the required research.

If the target for the PID controller can be ramped up gradually (i.e. a controlled sweep), and the above question is true I can handle figuring out the details.

Unfortunately it may be several weeks away before things are back to normal (new rescue dog in the house, among other things).

Re: UR analog value does not change with temperature

Posted: 05 Aug 2020 22:22
by Christian_Bylund
spfautsch wrote:
23 Jul 2020 03:23
Can the pump current and voltage be monitored by reading the registers of the CJ125?
Unfortunately not, the later versions of the CJ-series have this but Bosch do not offer these components for DIY projects.
spfautsch wrote:
23 Jul 2020 03:23
If the target for the PID controller can be ramped up gradually (i.e. a controlled sweep), and the above question is true I can handle figuring out the details.
I have been totally consumed by moving in the past couple of weeks but I am starting to get settled and I did have a quick look at the temperature function.

Image

Box 8a generates the constant 450mV for the Nernst cell. But more interestingly box 8b muxes between the 300 OHM resistor and the Nernst cell, controlled by the SPI registers. In theory, I can replace this 300 / 301 ohm (Rical) calibration resistor with each of the known values and get the corresponding UR. One would be enough to see if the UR signal is linear with the current, if not we make a lookup table.

Image

The contradiction is that the LSU 4.9 data sheet claims the maximum Nernst cell current to be 250 µA. Possibly a misstake?

To be continued...

Read exhaust temperature

Posted: 06 Aug 2020 18:47
by Liuyanting
Is there a way to know the exhaust temperature through an oxygen sensor?
If so, how can I read it?

Re: Read exhaust temperature

Posted: 07 Aug 2020 09:28
by Christian_Bylund
Liuyanting wrote:
06 Aug 2020 18:47
Is there a way to know the exhaust temperature through an oxygen sensor?
If so, how can I read it?
Moved to existing thread.

Re: Reading temperature of sensor

Posted: 07 Aug 2020 20:30
by Christian_Bylund
I did as described above, I swapped out the Rical resistors for know values and converted some of the temperatures to UR values.

UR 110 = 888°C
UR 174 = 780°C
UR 461 = 642°C
UR 540 = 628°C
UR 868 = 25°C

I need to get an 80 Ohm resistor to make it go up to 1000°C accurately.

The sensor will always regulate towards 780°C, but the below conceptual code can be used to estimate the temperature. If the sensor is exposed to temperatures over 780°C it will drift faster in my experience.

Code: Select all

/*
    Example code to estimate sensor temperature of the Bosch LSU 4.9
    
    Copyright (C) 2020 Bylund Automotive AB.
    
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    Contact information of author:
    http://www.bylund-automotive.com/
    
    info@bylund-automotive.com
*/

//Sensor Temperature Conversion Lookup Table. (ADC 100-870).
const PROGMEM int Temp_Conversion[771] {
  909, 907, 905, 903, 900, 898, 896, 894, 892, 890, 888, 886, 884, 882, 880, 878, 876, 874, 872, 870, 868, 866, 864, 862, 861, 859, 857, 855, 
  853, 851, 849, 848, 846, 844, 842, 841, 839, 837, 835, 834, 832, 830, 829, 827, 825, 824, 822, 820, 819, 817, 815, 814, 812, 811, 809, 808, 
  806, 804, 803, 801, 800, 798, 797, 796, 794, 793, 791, 790, 788, 787, 786, 784, 783, 781, 780, 779, 777, 776, 775, 773, 772, 771, 769, 768, 
  767, 766, 764, 763, 762, 761, 759, 758, 757, 756, 755, 754, 752, 751, 750, 749, 748, 747, 746, 745, 743, 742, 741, 740, 739, 738, 737, 736, 
  735, 734, 733, 732, 731, 730, 729, 728, 727, 726, 725, 724, 723, 722, 721, 721, 720, 719, 718, 717, 716, 715, 714, 714, 713, 712, 711, 710, 
  710, 709, 708, 707, 706, 706, 705, 704, 703, 703, 702, 701, 700, 700, 699, 698, 698, 697, 696, 695, 695, 694, 693, 693, 692, 692, 691, 690, 
  690, 689, 688, 688, 687, 687, 686, 685, 685, 684, 684, 683, 683, 682, 682, 681, 681, 680, 679, 679, 678, 678, 677, 677, 676, 676, 676, 675, 
  675, 674, 674, 673, 673, 672, 672, 672, 671, 671, 670, 670, 669, 669, 669, 668, 668, 668, 667, 667, 666, 666, 666, 665, 665, 665, 664, 664, 
  664, 663, 663, 663, 662, 662, 662, 661, 661, 661, 661, 660, 660, 660, 659, 659, 659, 659, 658, 658, 658, 658, 657, 657, 657, 657, 656, 656, 
  656, 656, 655, 655, 655, 655, 655, 654, 654, 654, 654, 654, 653, 653, 653, 653, 653, 652, 652, 652, 652, 652, 652, 651, 651, 651, 651, 651, 
  651, 650, 650, 650, 650, 650, 650, 650, 649, 649, 649, 649, 649, 649, 649, 649, 648, 648, 648, 648, 648, 648, 648, 648, 647, 647, 647, 647, 
  647, 647, 647, 647, 647, 647, 646, 646, 646, 646, 646, 646, 646, 646, 646, 646, 645, 645, 645, 645, 645, 645, 645, 645, 645, 645, 645, 644, 
  644, 644, 644, 644, 644, 644, 644, 644, 644, 644, 643, 643, 643, 643, 643, 643, 643, 643, 643, 643, 642, 642, 642, 642, 642, 642, 642, 642, 
  642, 642, 641, 641, 641, 641, 641, 641, 641, 641, 641, 641, 640, 640, 640, 640, 640, 640, 640, 640, 639, 639, 639, 639, 639, 639, 639, 638, 
  638, 638, 638, 638, 638, 638, 637, 637, 637, 637, 637, 637, 636, 636, 636, 636, 636, 636, 635, 635, 635, 635, 635, 634, 634, 634, 634, 633, 
  633, 633, 633, 633, 632, 632, 632, 632, 631, 631, 631, 631, 630, 630, 630, 629, 629, 629, 629, 628, 628, 628, 627, 627, 627, 626, 626, 626, 
  625, 625, 625, 624, 624, 624, 623, 623, 623, 622, 622, 621, 621, 621, 620, 620, 619, 619, 619, 618, 618, 617, 617, 616, 616, 615, 615, 614, 
  614, 613, 613, 612, 612, 611, 611, 610, 610, 609, 609, 608, 608, 607, 606, 606, 605, 605, 604, 603, 603, 602, 602, 601, 600, 600, 599, 598, 
  598, 597, 596, 596, 595, 594, 593, 593, 592, 591, 591, 590, 589, 588, 587, 587, 586, 585, 584, 583, 583, 582, 581, 580, 579, 578, 577, 577, 
  576, 575, 574, 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, 553, 552, 550, 549, 548, 
  547, 546, 545, 543, 542, 541, 540, 539, 537, 536, 535, 534, 532, 531, 530, 528, 527, 526, 525, 523, 522, 520, 519, 518, 516, 515, 513, 512, 
  511, 509, 508, 506, 505, 503, 502, 500, 499, 497, 495, 494, 492, 491, 489, 488, 486, 484, 483, 481, 479, 478, 476, 474, 472, 471, 469, 467, 
  465, 464, 462, 460, 458, 456, 455, 453, 451, 449, 447, 445, 443, 441, 439, 437, 435, 433, 431, 429, 427, 425, 423, 421, 419, 417, 415, 413, 
  411, 408, 406, 404, 402, 400, 397, 395, 393, 391, 388, 386, 384, 382, 379, 377, 374, 372, 370, 367, 365, 362, 360, 358, 355, 353, 350, 348, 
  345, 342, 340, 337, 335, 332, 329, 327, 324, 321, 319, 316, 313, 311, 308, 305, 302, 300, 297, 294, 291, 288, 285, 282, 279, 277, 274, 271, 
  268, 265, 262, 259, 256, 253, 249, 246, 243, 240, 237, 234, 231, 228, 224, 221, 218, 215, 211, 208, 205, 201, 198, 195, 191, 188, 185, 181, 
  178, 174, 171, 167, 164, 160, 157, 153, 149, 146, 142, 139, 135, 131, 128, 124, 120, 116, 113, 109, 105, 101, 97, 93, 90, 86, 82, 78, 74, 70, 
  66, 62, 58, 54, 50, 46, 42, 37, 33, 29, 25, 21, 17
};

//Lookup Sensor Temperature.
int Lookup_Temperature(int Input_ADC) {
  
    //Declare and set default return value.
    int SENSOR_TEMPERATURE = 0;

    //Validate ADC range for lookup table.
    if (Input_ADC > 870) Input_ADC = 870;
    if (Input_ADC < 100) Input_ADC = 100;
    
    SENSOR_TEMPERATURE = pgm_read_word(Temp_Conversion + (Input_ADC - 100));
    
    //Return value.
    return SENSOR_TEMPERATURE;
    
}
Note that this is to be considered experimental.