GenBoard/Manual/Config/WBoxygen (2007-03-02 09:54:51)

Wideband Oxygen Sensor Configuration

This page describes how to configure GenBoard/VerThree LSU4 WideBand controller - please help in cleanup''

and keep the big smile on your face.

The incredible ego_controller will be used, and the l table will help you on your way to keep engine around desired lambda automatically, not just cruise, but also at high power.


[[Manual: Detailed.Sensor.Wide.Config]]


Info on why and how:


Some links, dealing with PID control:

( should this be a separate page? )


an old method for testing Ri measurement part of the firmware

This was used before one got a real sensor, or before one was confident to hook up a real sensor. Mostly history by now.

Simple way of testing the Ri (acdc() output) measurement:

It can be tested without a real WBO2 sensor and without an OPA amplifier:

Use a voltage divider, eg.: 470 Ohm to GND, 5k to VCC. This is effectively a Ri=430 Ohm on a 450mV (or so) DC: about similar as a 71 Ohm Ri would be with OPA 6x amplification.

You can use a 4k7 variable R, where the midpoint is the cheat-sensor nernst node, of course. The ultimate method is using a 2k2 NTC towards ground and a 4k7..10k towards 5V. Thermally close-wrap the NTC with a 47 Ohm 2W resistor which is connected to +12V, other end controlled (with NPN or FET) from the heater pin. This makes it possible to check the heater control as well as the Ri measurement. Make your cheat sensor on a DIN5 connector, the same which we use for real sensor in the lack of VW-connector socket.

The cheat-sensor is pulsed by the 220nF and 10k from OC2 (5V, 256usec cycle, 128 low, 128 high), as a real would be.

You can dump the wbo2 samples and results to RS232 via mde01 menucommand, see wbo2.c. The perl side is not written yet, but bin/prog.pl (GenBoard/Firmware/BootLoader) should help a lot for RS232 usage from perl.


Configuration

WBO2 Heater

Warmup ramp speed [3f=0.2V/sec] 0.2 V/sec wbo2, warmup ramp speed [1.51 mV/sec]

wbo2_warmup_ramp=0xA0(160)

Warmup target

wbo2_warmup_target=0xFF(255)

Heater absolute limit [2a=12V ff=30V] wbo2, heater absolute limit [?](DA)

wbo2_abs_limit=0xE4(228)

Max time spent at abs_limit [262msec] wbo2, max time spent at abs_limit [262msec] (50)

wbo2_limit_maxt=0xA0(160)

Fallback V after maxt [1c=10V ff=30V] wbo2, fallback V after maxt [?]

wbo2_fallback=0x60(96)

Retry control after [4sec] wbo2, retry control after [4sec]

wbo2_retry_t=0x06(6)

WB02 Measurement and Control.

Edgetime correction constant C/R

wbo2_edgetime_corr=0xBA(186)

Smaller edgetimes are neglected [0.5usec]

wbo2_edgetime_min=0x50(80)

Target Ri (pulse amplitude:C3)[5V/4096] wbo2, target Ri (pulse amplitude) [5V/8192]

wbo2_ri_target=0x96(150)

Target nernstDC [5V/256]

wbo2_nernstdc_target=0x8D(141)

After warmup, measure nernst, we want voltage ~ 4 + 0.45V (4V on the yellow sensor-wire, and 0.45V higher, thus 4.45 on the black sensor wire.) Q: is this done only at free air or stoich on running engine, exhaling does make this go higher for a while. Note: the 20mV/step is after the OPA (on the AVR ADC input), before the OPA the resolution is about 5mV/step.

Pump zero dutycycle (default: 66) [5V/256]

wbo2_pump_pw_zero=0x66(102)

The easiest way to measure this is to match OC3A (shotly after powerup) to the 2V reference. Let's say I measure 1.96V instead of 2V (pin14 of the OPA closest to AVR). If I measure 2.04 V on OC3A (as the result of wbo2_pump_pw_zero=0x66 setting), I know that I must decrease wbo2_pump_pw_zero by 4 (to 62) to decrease the 2.04V to the required 1.96V (by 2.04-1.96V=80mV = 4*20mV since each step is 5V/256 = 20mV )

Calibration Constant

wbo2_calibration=0xF8(248)

The wbo2_calibration must be configured to read good values on LCD, or to use for EGO control. Starting values can be in function of RCal in the LSU4 sensor housing:

RCal (Ohm) = 30 50 70 90 110 130 200 300

wbo2_calibration = 0 60 102 133 157 176 220 252

Note that these are decimal values!

Free air calibration

The calibration parameter above should be fine tuned in free air without the sensor installed. In free air the LCD(or terminal Manmde02mll)O2% should read 2095 which is 20.95%. After the sensor is warmed up you can adjust the wbo2_calibration parameter up or down to increase or decrease the reading being displayed. For a sanity check it is good to let the sensor cool down and warm back up to make sure the reading is still at 2095.

Breath Test

After configuring the above free air reading, you can breath on the sensor and see the 02% go down 100-200 counts(1-2%) to varify that all is working well

PIDs - who knows???

wbo2_heater_pid_kp=0x46(70)

wbo2_heater_pid_ki=0x10(16)

wbo2_heater_pid_kd=0x1A(26)

wbo2_heater_pid_ilimit=0x80(128)

wbo2_pump_pid_kp=0x2E(46)

wbo2_pump_pid_ki=0x1D(29)

wbo2_pump_pid_kd=0x08()

wbo2_pump_pid_ilimit=0x84(132)


Detailed logging of sampling and acdc()

This should not be needed for the average user, but interesting for the curious.

MembersPage/DaveBrul fabricated some code to log the WBO2 samples from AVR to PC and print some simple statistics. \n

perl bin/wbo2log.pl :COM5 mde02

command tells GenBoard/VerThree (that has WBO2 enabled in firmware and completed WBO2 hardware) to turn on the WBO2 even if the engine is not running, and print out some samples and WBO2 internal variables.

As you probably know, we (I :-) decided not to synchronize the ADC to pulsing, it would be an ugly thing to always - even in the worst case - get precise. Instead we just let ADC freerunning and read (in 1/2 usec units) from TCNT2 in the ADC interrupt how much time the pulse (on the OC2 output) happened before the interrupt (~sampling): I called this edgetime.

A pulse happens between most consequtive samples (since sampling is somewhat more frequent than pulsing: not always, but 104/128 of the pairs: there is a 24 usec edgetime-range without any jumps ).

Half of the pulses are upjumps, half are downjumps we just ignore the direction for now (they are handled separately inside acdc() in wbo2.c in AVR), used abs() value.

If the pulse happens close after the first sampling (big edgetime), we see smaller jump on ADC.

If the pulse happens right before the latter sampling (small edgetime) we see higher jump on ADC.

This is because of the exponential discharge of the 220nF capacitor via the 10k+Ri resistor. This cries for correction: linear (instead of exp) correction being well enough here.

Let's see how the samples plot in gnuplot:

wbo2jump.png

http://www.squirrelpf.com/msavr/files/gnuplot2.txt

Without doing linear regression (bin/linreg.pl), I'd say from the picture:

edgetime_corr = (35,172) -> line -> (230,121) = 51/195

for Dave's 220nF * 10kOhm.

Note that this plot relates to a nernst measurement with slightly higher OPA amplification than what we use today. Also, the 220nF has it's tolerance. Fortunately it matters very little.

Therefore we set his config.edgetime_corr=0xBA, this ensures that edgetime_corr(195) returns 51 for our current Ri=180*8, see below.

At the same time the calculated Ri-related value can be seen as where the regression line intersects the edgetime=0 axis, appr. 180 ADC-count (multiplied by number of samples added inside AVR, IIRC currently 4).

(wbo2.Ri translates into real Ri using factors: OPA amplification, number of samples added==8, and 10kOhm's real value and a small additive constant).

The small jumps (value appr. 28) were measured when no pulses happened between the sampling. They are discarded, of course. Also the highest outliers are discarded from the calculation. Ri can be measured near 1-2% error (small systematic errors are not interesting here) with relatively small number of samples and little calculation (fast).

Logged Ri (over 15 sample-runs) = 1403 +/- 3 DC (over 15 sample runs) = 6486 +/- 2 These are Dave's measurements with edgetime_corr=0xba. The DC is the sum of 16 ADC reads, so average ADC read was 6486/16=appr.405, which is 1.98 V on the pin, verified, perfect.

I'd say the concept is proven to perform above expectations.

Thanx to all who contrubuted, most notably Mik and Dave, (and J�gen on the HW-front).

I always knew it works, but the above makes it obvious.


earlier notes before the values were tuned:

Ip measured 3.4 mA (and it lowered immediately when I exhaled on the sensor, it went back relatively slowly). That calculated to Rcal=147. I pulled apart the connector, and measured what Bosch applied. RCal was 149 Ohm. Fair enough, let's allow Bosch some sloppiness :-)

Below the PID values are very bad, some 10 lines should be applied to wbo2log.pl to write Ri,DC, the integrals and the command-values to a file, and call gnuplot to plot against time.

WBO2 Config.

Make the PID better, but still works:\nÿ2ÿ


WBO2 result logging

If you don't need detailed logging (like Ri and samples) just the Ip (nernstDC) you will see it in the detailed log of megatune at position 9:\nÿ3ÿ

Believed to be compatible with traditional transfer functions:

If we write the value to OC3C it makes an analog output. But beware of the analog transfer of wideband signal, it loses confidence data! I wouldn't use it for feedback, although some engine management systems like Motec must do this since they don't have a better way.

TODO: find a cleaner structure for the pages:

assembly, HW-testing, firmware-compile, configuration, firmware-testing, development and license could be subpages

TODO: someone please look up the transfer function for the Wideband analog output. Is there a standard (the same as in MegaManual)? 2.05V is what AFR? Slope? We can log the AFR in comm.c (for megatune) with this transfer function, and maybe use the current_afr input from an alien wbo2 controller. -> Found it: http://www.diy-wb.com/v_out.htm, Techedge seems to use the same ouput curve: http://techedge.com.au/vehicle/wbo2/wblambda.htm

The closest to a standard vout we can get is the ETAS ouput format, where you have the lambda value in volts. Lambda1=1v, lambda0.65=0.65v.

According to http://www.emd.horiba.com/engmeas/ld700/ the output is lambda0=0v, lambda5=5v, but measures 0.7 to 1.5. Assume linear?

Obviously ETAS and Horriba have the same output voltage function. I guess that can be considered the standard.

Autronic controllers have 0v output at AFR=10:1 and 1volt at AFR=30:1.

It's likely that we'll make logs where we compare ours with Etas LA2 and Autronic analyzers.


Does the GenBoard support 2 wbo2 sensors ?

Yes, the board HW supports it. I don't know anyone who actually used 2 sensors on 1 engine.

What it will do if it get different signals from them ? What do you want it to do ?

it will be on a twin turbo V8 engine so either I put a WBO2 in each downpipe or I will use a Y-pipe and mount only one sensor after the Y

I think that if I use 2 sensors( 1 sensor for each bank ) I will be able to detect problems easly


See also:


Back to GenBoard/Manual

Back to GenBoard/Manual/Config