You are on page 1of 3

52429

test and measurement

Wideband Lambda Probe


Interface (2)
measure, control and diagnose
using the PC serial
interface
By Sebastian Knödler (Germany)

In the last issue we described the interface board for a wideband lambda probe. This versatile board can
be used in stand-alone mode or more conveniently from the comfort of a PC or laptop using its serial
interface port. When used together with a computer the interface has access to the diagnostic features of
the CJ125 lambda probe interface chip and allows measured values and operating conditions to be stored
for analysis later on. The interface board is set-up and controlled using a simple set of commands.

Last month we took a look at the operating be changed to once per second and the data tor (8 for rich and 17 for lean mixtures) and
principle and circuit of this lambda probe can be sent in an Excel compatible ‘.csv’ for- Rshunt is the 61.9 Ω shunt resistor. Plugging
interface design [1] and its operation in mat. The data packets have the following in some typical values (Lambda: 250) and
stand-alone mode. Included in the circuit simple format, for example: Ap = 8 the pump cell current equates to:
is a TTL/RS232 interface chip giving it the
capability of communication with a PC fit- Lambda: 250 250 × 5
Ip = = 0.0025 A = 2.5mA
ted with this type of serial port. The com- Ref: 252 8 × 61.9 × 1023
munication protocol does not use any hand- Bat: 505
shake signals so only three wires are needed Status: 32 The second value in the data packet ‘Ref’ is
(TXD, RXD and GND), connecting to the CJ: 255 a correction value as already mentioned in
three pins of X1 (see Figure 1). Should your the first article, for the 5 V reference voltage
PC not have an RS232 port then a stand- In MS Excel compatible mode the same val- used by the D/A converters. The value of Ref
ard USB/RS232 adapter cable can be used, ues are output as: is derived from the equation:
allowing communication via one of your 250;252;505;32;255
PC’s spare USB ports. 1.22 × 1023
Ref =
The first line or value in each data packet 5
Data ‘Lambda’ contains the digital value pro-
Before the serial interface can be used it will duced from the 10-bit A/D conversion of the 1.22 V (±1 %) is a precise reference voltage
be necessary to set up the PC’s COM port UA voltage from the CJ125. Using this value on ADC3 (Pin 26) of the ATmega8. Any devi-
(or virtual COM port). The configuration we can determine the pump cell current to ation of Ref from its optimal value of 250
data is 115,200 baud, 8 data-bits, 1 stop- calculate the exact value of lambda: indicates that of the 5 V reference used by
bit, no parity, no handshake. the A/D converters is inaccurate.
Once communication is established the Lambda × 5
Ip =
lambda interface board sends data packets Ap × Rshunt × 1023 It’s probably no surprise that ‘Batt’ is the
containing lambda measurement informa- digital value of the supply voltage Ubatt or
tion at a rate of five per second. The rate can Ap is the pump current amplification fac- Ub. The voltage divider formed by R23/R24

32 02-2012 elektor
52429

test and measurement

reduces its value so that it can be meas-


ured by the A/D converter (ADC2, pin 25)

DIAHG
of the ATmega8. If the value falls below

MOSI
MISO
SCK
UR

SS

UA
UA
440 (=10.5 V) or rises above 670 (=16.0 V)
+Ub +5V
the ATmega8 stops measurements and
X2
switches to standby mode. R23 R1 R22 L1
R21
4k7
1
UA
C22

C2 C18 R20 2 +5V


1k 100n
39k

10k

39k
R16 3 2
1k
Status and CJ are values representing the 47uH 100n
4 6
100n
C19
1
C1+
V+
VCC
16

IC6
microcontroller status register and the VCC VCC
100n
3
C1–
X1
18 30 12 13 1
CJ125 diagnostics register. The status reg- 29
AVCC
PC6(RESET)
PD0(RXD)
PD1(TXD)
31 11
R1OUT
T1IN
R1IN
T1OUT
14 2
TXD
RXD
28 32 10 7 3
ister bit definition is given in Table 1. The 27
PC5(ADC5/SCL)
PC4(ADC4/SDA)
PD2(INT0)
PD3(INT1)
1 9
T2IN
R2OUT
T2OUT
R2IN
8 C24
GND

‘Watchdog’ bit indicates that a program 26


25
PC3(ADC3)
IC1
PD4(XCK/TO)
2
9
C21
4
C2+
100n
PC2(ADC2) PD5(T1) SP3232EB
failure has been detected and the program 24
23
PC1(ADC1) PD6(AIN0)
10
11 SS
100n 5
C2–
V-
GND
15

PC0(ADC0) PD7(AIN1)
needs a clean restart. The CJ error bit indi- ATMEGA8-AI
6
C23
19 12 MOSI
cates an error in the CJ125 which is specified 22
ADC6
ADC7
PB0(ICP)
PB1(OC1A)
13 DIAHG
100n

in the CJ value byte. 20


PB2(SS/OC1B)
14
15
AREF PB3(MOSI/OC2) +5V
The CJ byte is the binary value of the 8-bit 21
PB4(MISO)
16
17
MISO
SCK
GND PB5(SCK) C26
CJ125 diagnostics register. Table 2 indicates PB6 PB7
GND XTAL1 XTAL2 GND 100n
their bit assignments and Table 3 interprets IC4
3 7 8 5
R19 R18 R6
X4
R24 5
1 R15 1
the detected failure codes. When no errors Q1 10k 1k
470R

470R

4 R9 2
IC5
10k

1k UL

are detected the CJ byte has the value of C25


3
2
3

14MHz74
255 i.e. all bits have the value ‘1’. C1 C4 C3 C8 C7 LED2 LED1
100n LMV321M7

100n 100n 100n 22p 22p

When an error is detected the output X2/ LM4041 110728 - 11

Pin2 is driven high and the probe heater


turned off to prevent over heating. The
probe pump current is also turned off and
measurement of the Nearn cell Ri is not Figure 1. An external computer can send commands to the unit and receive λ
valid so that the values of UR und UA are not measurements and probe status information via the RS232 interface.
usable.
As the probe ages it tends to produce errors
especially during the warm-up phase. The
Table 1. Status register bit definition
condition will generally resolve as the probe
reaches operating temperature but an IntF.7 IntF.0
increasing occurrence of errors indicates Probe
Calibration System Ubatt Ubatt
that the probe is ready to be replaced. Watchdog SPI error over- CJ error
mode ready high low
temperature
Commands
The serial interface supports eight com-
mands (Table 4) from an external PC and
these are sent as a single character. The Table 2. CJ125 diagnostic register
character’s ASCII code is sent so it’s impor- CJF.7 CJF.0
tant to make sure that only upper case char-
DIAHG DIAHD IA/IP IA/IP UN UN VM VM
acters are input. A command is terminated
with a CR (carriage return, ASCII code 13)
and only becomes active once the carriage
return is received. A short description of
Table 3. Interpretation of failure bits
each of the commands follows:
Failure bits DIAHG/DIAHD IA/IP, UN, VM
C (Calibration Mode): The CJ125 is switched 00 Short circuit to ground Short circuit to ground
to calibration mode (see paragraph below). 01 Heater not connected Low battery voltage
10 Short circuit to UBatt Short circuit to UBatt
N (Normal Mode): The CJ125 supplies actual
11 No error No error
lambda readings (see paragraph above).

elektor 02-2012 33
52429

test and measurement

Table 4. Table of commands Calibration


The command ‘C’ puts the CJ125 in cali-
Command Function
bration mode. The has the same effect as
C Calibration Mode pulling pin 1 of connector X4 to ground
N Normal Mode when the unit is used in stand-alone mode
H Start measurements (described in the first instalment of this pro-
ject). The circuit automatically performs a
D End measurements
self calibration at switch on (when power is
F Fast transfer (5 Hz) applied). A (re)calibration is only necessary
S Slow transfer (1 Hz) if an extended period (> 24 h) of continuous
T Clear text mode measurement is underway.
E .csv mode (Excel compatible)
Accuracy
The wideband lambda sensor type LSU4.2
Table 5. Percentage O2 concentration versus pump cell current together with the CJ125 interface chip
achieve maximum accuracy when measur-
O2 concentration 0.0 % 3.0 % 6.0 % 8.29 % 12.0 % 20.9 %
ing lambda values close to λ = 1. At more
Pump cell current 0.00 mA 0.34 mA 0.68 mA 0.95 mA 1.40 mA 2.55 mA extreme values i.e. lambda values around
λ = 1.7 accuracy can be expected to be
within ±0.05, drifting by ±0.15 over the
probe’s lifetime. At λ = 1.009 the error is
H (Start measurements): Turn on probe S (Slow): Data packets sent at a rate of 1 per much smaller quoted at ±0.006 increasing
heater. The system will be ready to start second (the standard setting). to just ±0.008 after 2000 operational hours.
measurements in approximately 30 s. In order to accurately calculate the oxygen
T (Text): Data packets sent in text format content of the exhaust gases it is necessary
D (End measurements): Turn off probe (see paragraph above). to establish a calibration curve (Figure 2)
heater. using the values given in the lambda probe
E (Excel): Data packets sent in Excel format data sheet (see Table 5). It is evident that
F (Fast): Data packets sent at a rate of 5 per (see paragraph above). the oxygen concentration shows a close
second. linear relationship to the value of pump
current Ip.
From this we derived in last month’s
article the equation giving the oxygen
concentration:
I P [mA]
3 I p + 0.035
O2 =
0.1221
2.5
The calculation requires oxygen to be pre-
2 sent in the exhaust which implies a lean
y = 0.1221x - 0.035
burn i.e. when there is excess air in the mix-
1.5
ture. Different calibration data is required
for accurate measurement of combustion
1
produced by a rich mixture and also if the
0.5 LSU4.9 type lambda probe is used.
A more accurate calibration can be made by
O 2 [%]
0 probe immersion in a specialist calibration
0 5 10 15 20 25 gas (e.g. from the gas supplier BOC).
- 0.5 (110728)
110728 - 12

Figure 2. The relationship between oxygen concentration and pump cell current
Internet Link
shows good linearity. [1] www.elektor.com/110363

34 02-2012 elektor

You might also like