This is only a preview of the May 2023 issue of Silicon Chip. You can view 57 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "Dual RF Amplifier":
Items relevant to "UVM-30A UV Light Sensor":
Articles in this series:
Items relevant to "GPS-Disciplined Oscillator":
Items relevant to "Wideband Fuel Mixture Display, Pt2":
Items relevant to "Songbird":
Purchase a printed copy of this issue for $11.50. |
Subscribe to
APRIL 2023
ISSN 1030-2662
04
9 771030 266001
$1150* NZ $1290
INC GST
INC GST
WIDEBAND
Fuel Mixture DISPLAY
Silicon chirp
Your own pet crick
et
Australia’s top electronics
500
cl
as
s
d
am
pl
ifier
magazine
use two inexpensive pre-b
uilt modules to make the
Silicon Chip is one of the best DIY electronics magazines in the
world. Each month is filled with a variety of projects that you can
build yourself, along with features on a wide range of topics from
in-depth electronics articles to general tech overviews.
W
A
T
T
Published in
Silicon Chip
If you have an active subscription you receive 10% OFF
orders from our Online Shop (siliconchip.com.au/Shop/)*
Rest of
World
New
Zealand
Australia
* does not include the cost of postage
Length
Print
Combined
Online
6 months
$65
$75
$50
1 year
$120
$140
$95
2 years
$230
$265
$185
6 months
$80
$90
1 year
$145
$165
2 years
$275
$310
6 months
$100
$110
1 year
$195
$215
2 years
$380
$415
All prices are
in Australian
dollars (AUD).
Combined
subscriptions
include both
the printed
magazine and
online access.
Try our Online Subscription – now with PDF downloads!
How We Communicate
Underground; April 2023
500W Class-D Amplifier;
April 2023
Silicon Chirp;
April 2023
Advanced SMD
Test Tweezers;
February & March 2023
An online issue is perfect for those who don’t want too much clutter around the house
and is the same price worldwide. Issues can be viewed online, or downloaded as a PDF.
To start your subscription go to
siliconchip.com.au/Shop/Subscribe
▶ Factory-calibrated oxygen sensor
▶ Compact size, fitting in a 120 x 70mm case
▶ Correct sensor heat-up procedure implemented
▶ Optional exhaust pressure correction for readings
▶ Several display options, including wireless via Bluetooth
▶ Wideband and narrowband O2 sensor compatible outputs
▶ Accurate air/fuel ratio and lambda measurement and display
▶ Switch between displaying air/fuel ratios for two different fuels
Part 2 of John Clarke’s
WIDEBAND
Fuel Mixture Display
Our new WFMD (for short) uses a Bosch LSU4.9 wideband sensor to show a running
engine’s live air:fuel ratio and/or lambda. It displays both on an LED panel display
or another device via Bluetooth, and it can be permanently installed in a vehicle
or temporarily inserted into the exhaust pipe for tuning. This second article in the
series mainly covers the circuit details.
L
ast month in the first article on the
new WFMD, we went into quite a bit
of detail on how a wideband oxygen
sensor works and how this particular
circuit functions. However, we ran
out of space in that issue, so we still
needed to show the complete circuit
diagram and explain how it works in
detail.
Due to the size of the circuit and
its description, we will have to end
it there, so the third and final article
next month will cover the construction, testing, calibration and operation
of the WFMD.
Circuit description
Fig.12 shows the entire circuit. It’s
based on a PIC16F18877-I/PT microcontroller (IC1) in a 44-pin TQFP SMD
package, running with an internal
32MHz clock oscillator.
siliconchip.com.au
The remainder of the circuit
includes a pressure sensor (connections at upper left), Mosfet Q1 (for the
sensor heater), some op amps and a
few other components. Each op amp
is a rail-to-rail type, meaning that the
input and output pins can swing to
within a few millivolts of the supply
rails. They run from different supplies,
so some can swing over 0-5V, some -3V
to +12V and some 0-33V.
We use the input and output pins on
microcontroller IC1 in a few different
ways. Its digital outputs can produce
either a low (0V) or a high (5V) voltage. That allows us to switch LEDs or
transistors on or off, or control anything that requires a digital signal.
With the digital inputs, for example,
we can detect if a jumper is connected
to ground or left open with an internal
pullup current to 5V from the micro.
Australia's electronics magazine
We can also set a pin to monitor a
voltage ranging from 0V to 5V, with
IC1 converting the voltage to a 10-bit
digital value ranging from 0 to 1023.
This is called an analog (AN) input. For
example, ANC4 is the analog input on
portC, bit 4, located at pin 42.
Some digital outputs can be used
for pulse width modulation (PWM),
producing a fixed-frequency rectangular wave with a varying duty cycle.
The duty cycle is the proportion of
time the output is high and can vary
from 0% through to 100%. When zero,
the output is always low. At 50%, the
waveform is square with equal periods at 0V and 5V. At 100% duty, the
output sits at 5V.
The PWM signal can be used
directly to drive a component such as
a Mosfet, or the waveform can be lowpass filtered to produce a varying DC
May 2023 73
Fig.12: the full circuit uses microcontroller IC1, several CMOS op amps (IC2-IC4) and a Mosfet (Q1) to control the heater
in the oxygen sensor, plus a pressure sensor. The microcontroller and op amps monitor and control the wideband
oxygen sensor and provide the narrowband output, air/fuel ratio voltage and lambda outputs for monitoring using a
multimeter, V/A panel meter or via Bluetooth.
74
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
siliconchip.com.au
Australia's electronics magazine
May 2023 75
voltage. The filtering converts a digital
value to an analog voltage, provided
the filter rolls off the AC signal amplitude well below the PWM frequency.
In our circuit, PWM outputs are
labelled from PWM0 to PWM6. PWM0
to PWM5 produce 31.25kHz waveforms, while PWM6 runs at around
122Hz.
Driving the oxygen sensor
Trimpot VR2 across the 5V rail
provides the 3.3V reference voltage,
which is buffered by op amp IC4c.
This op amp drives one side of the
pump cell, at the Vs/Ip connection, via
a 150W resistor which isolates the op
amp output to ensure stability.
The Vs/Ip voltage is measured at the
ANA4 input of the microcontroller to
ensure that the pump current can be
set to zero by applying the same voltage (from the PWM5 output) to pump
drive buffer stage IC3a.
IC3a is driven from the PWM5 output of IC1 (pin 27) via a 10kW resistor
and 100nF filter capacitor to produce
a steady DC voltage. The duty cycle
of the 31.25kHz PWM signal is varied
from 0-100% to produce a DC voltage
ranging over 0-5V.
IC1’s PWM2 and PWM1 outputs
(pins 35 & 36) provide the external
wideband and narrowband voltage
outputs, respectively, again using
PWM control. The narrowband output from PWM1 is filtered with a 1MW
resistor and 100nF capacitor before
being buffered by op amp IC2b. The
filter components give a relatively
slow response to PWM duty cycle
changes, like a narrowband sensor.
The 100kW resistor in series with
buffer IC2b gives a high output impedance to simulate a narrowband sensor.
For the air/fuel ratio output, the
PWM2 output is filtered via a 10kW
resistor and 100nF capacitor and
amplified by op amp IC2a. This provides a wideband output at MV+,
suitable for monitoring with a multimeter or a voltage and current (V/A)
panel meter.
The MV+ output is usually set to
show 14.7V for petrol and 15.5V for
LPG at lambda 1.0. Trimpots VR5
and VR6 set the gain of IC2a for the
required air/fuel ratios.
For the AF1 selection, the AND1/
RD1 output (pin 39) is set low (0V),
allowing the gain to be set by VR5.
The VR6 trimpot is connected to an
analog input (AND0) at pin 38, which
is effectively open-circuit.
If the AF2 output is selected, the
AND0 output is changed from an analog input to a low-level digital output.
VR6 then sets the gain, with VR5 now
connected to a high-impedance analog
input (AND1).
Jumper JP3 at the RC3 digital input
(pin 37) selects between AF1 and AF2.
When no shorting jumper is present,
AF2 is selected. AF1 is selected when
the jumper is shorted. Pin 37 has an
internal pullup current configured to
hold the input high when no jumper
is connected.
The AF1 and AF2 air/fuel ratios can
also be displayed on a computer, tablet or smartphone via Bluetooth. VR7
at pin 43 (ANC5) sets the coefficient
for AF1, while VR8 at pin 42 (ANC4)
sets it for AF2. VR7 is adjusted so
that the voltage at TP7 is one-tenth of
the desired air/fuel ratio for lambda
= 1.0 for AF1. So for a 14.7 stoichiometric air/fuel ratio, VR7 is adjusted
for 1.47V.
Similarly, VR8 is set for the AF2
air/fuel ratio value. For example, for a
15.5 air/fuel ratio for lambda = 1, VR8
is adjusted for 1.55V.
Screen 1 shows the display on a
computer via Bluetooth with a setting
of 15.5:1 and a lambda of 1.0. Screen
2 shows the Android version but with
at a lambda of 1.02 and 15.1:1 Air/
Fuel ratio. The VR7 and VR8 trimpots can be adjusted for different Air/
Fuel ratios.
The software can also display
lambda even if they are set for other
values. It can even display AFR and
lambda simultaneously. The lambda
display has the decimal point moved
left one digit compared to the air/fuel
display version.
These displays via Bluetooth work
on recent Windows versions on a PC
and run as a standalone executable
file. Our prototype is run using Windows 11. As Processing is supported
on macOS, the software should work
on a Mac too, although we have not
tested it.
For Android, Processing does not
Screen 1 (left): the
Processing app can
be made to run on
Windows, Linux or
Mac systems and
shows the AFR
and lambda values
simultaneously.
Screen 2 (right): the
Android version,
written in MIT App
Inventor, is similar.
You just have to
choose the Bluetooth
device and connect
to it, after which you
get live AFR and
lambda displays.
76
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
have the required Bluetooth serial support, but MIT AppInventor does. So we
have produced an app using AppInventor that mostly does the same job.
We will make an APK file available,
along with the source code.
Dual panel meter display
A multimeter output is also provided that shows the lambda value (as
a voltage) and a current flow that can
be displayed on a V/A panel meter.
For this output, filtered PWM signal
from the PWM2 output is buffered by
op amp IC3b. The multimeter output
is then taken via a voltage divider
comprising trimpot VR9 and the 10kW
resistor to ground. VR9 is adjusted for
an output of 1V for a lambda of 1.0.
For the current meter, IC3b sources
current through a 330W resistor and
trimpot VR10 (for calibration) to a
shunt resistor. This 1W shunt resistor
replaces the low-value shunt in the
panel meter so that we don’t have to
supply a huge current to get an appropriate reading. The meter can then
show the lambda value, reading 1.00
when the lambda value is 1.
This calibration is done with jumper
shunt JP2 at the RC6 digital input of
IC1 (pin 44). With JP2 shorted, the
software within IC1 sets its outputs to
show a lambda of 1 and a corresponding air/fuel ratio at a lambda of 1. The
air/fuel ratio values produced at MV+
are also set with this calibration shunt.
With JP2 in, the narrowband output produces 450mV (no adjustment
is necessary). For the MV+ output,
the voltage is adjusted to show the
required air/fuel ratio using VR5 for
the AF1 selection and VR6 for the
AF2 selection (with JP3 in or out). So
for a 14.7 air/fuel ratio at a lambda of
1, the voltage at MV+ is set to 14.7V,
while MV+ is set at 15.5V for an air/
fuel ratio of 15.5 at lambda = 1.
Sensor control
Op amp IC4d is connected as a differential amplifier to monitor the voltage across the paralleled 62W and Rcal
resistors. It operates with a gain of
25.45, as set by the 560kW and 22kW
feedback resistors. The 3.3nF feedback
capacitor rolls off high frequencies and
prevents amplifier instability.
IC4d’s output is referenced to the
Vs/Ip voltage (at +3.3V) by the 560kW
resistor between its pin 12 input and
the Vs/Ip line, via op amp IC4c. As a
result, when there is 0V across the
siliconchip.com.au
12 multi-turn trimpots allow adjustments
detailed in the text to be made with the case
lid removed.
62W resistor, IC4d’s output sits at 3.3V.
Sensor cell voltage
Op amp IC4a monitors the sensor
cell voltage (Vs). When Vs is at 450mV,
IC4a’s output is 2.5V. To achieve this,
trimpot VR4 provides an offset voltage
that’s buffered by op amp IC4b. The
result is that IC4a’s output can swing
symmetrically above and below 2.5V
to drive IC1’s ANA7 input (pin 30).
This voltage swing is an exaggerated (by 4.7 times) measurement of
any variation above or below 450mV
from the sensor cell.
The reference current applied to
the sensor cell is derived via a 62kW
resistor between the +5V supply rail
and the Vs terminal of the sensor cell.
When the controller is running and
measuring correctly, the Vs terminal
is at the Vs/Ip voltage of 3.3V plus the
450mV of the sensor cell, ie, 3.750V.
So there is 5V – 3.75V = 1.25V across
the 62kW resistor and 20.2μA flows
(1.25V ÷ 62kW).
The actual current does not affect
the accuracy of lambda measurement
unless the current is reduced to near
zero or is increased above 40μA.
Engine start detection
Trimpot VR13 sets the threshold
voltage for detecting when the engine
has started by monitoring the battery
voltage. It is measured at the AND4
analog input of IC1 (pin 2) via a 20kW
and 10kW voltage divider connected
between the +12V input rail and 0V.
This divider reduces the applied voltage by two-thirds and results in a
Australia's electronics magazine
maximum of +5V at the AND4 input
for a battery voltage of 15V.
Typically, a 12V lead acid battery
is below 12.9V when the engine is
off but rises above 12.9V when the
engine starts and the alternator begins
charging it. So the battery voltage is
compared with the threshold voltage
at TP17 (AND2 of IC1), as set by VR13.
This threshold voltage can be set anywhere from 0-5V, corresponding to a
battery voltage range of 0-15V.
The TP17 voltage is set to 1/3rd the
required engine-started battery voltage. For example, for a threshold of
13V, TP17 should be at 4.33V (13V ÷ 3).
When the wideband controller is
used as a portable air/fuel ratio measuring instrument, TP17 will need to
be adjusted to slightly less than 4V
so the controller will begin operation
with a 12V DC supply. This ensures
that the sensor is heated when power
is first applied. However, it also means
that the sensor must be protected from
moisture ingress and physical shock
when not in use.
Driving the heater
Mosfet Q1 drives the sensor’s heater
with a voltage derived from a 122Hz
PWM signal delivered from IC1’s
PCB Dimensions Error
The parts list last month stated the
PCB measures 160.5 × 98.5mm
and we priced it at $15 + postage
on the shop page. The PCB is
actually 103.5 × 63.5mm and as a
result, we have changed the price
to $10 + postage.
May 2023 77
The HC-05 Bluetooth
module shown enlarged for clarity.
Normally the module is supplied
with the heatshrink pre-attached.
PWM6 output (pin 5). The heater current flows through the Mosfet and is
monitored via the AND6 input at pin
4, ie, by monitoring the voltage across
the 0.1W 3W resistor that’s low-pass
filtered by the 22kW resistor and 10μF
capacitor.
The Mosfet current is measured
during the sensor heating period, to
detect if the sensor is connected and,
specifically, if the heater is connected.
It also checks for an over-current condition, such as a short circuit, although
the fuse would probably blow in that
case.
The heater is switched off under
fault conditions and the status LED
(LED1) shows the fault. It’s driven from
the RA3 digital output of IC1 (pin 22)
via a 470W current-limiting resistor. It
lights dimly when the sensor is heating
and then flashes rapidly once the operating temperature is reached. It flashes
more slowly if there is a sensor error.
Pressure sensing
The pressure sensing circuit comprises the pressure sensor plus trimpots VR11 and VR12. These trimpots
connect to analog inputs AND5 (pin
3) and AND3 (pin 41), respectively.
With a 5V supply and when there
is equal pressure on each input port,
the output from the sensor sits at
500mV. Its output rises when pressure
is applied to the positive pressure port
and varies by about 50mV/kPa. With
the available 4.5V output range from
500mV to 5V, the maximum pressure
measurement is 90kPa
(900hPa).
The Bosch
pressure sensor.
78
Silicon Chip
The pressure sensor we use is a
particulate filter differential sensor
designed to detect when the particulate filter for a diesel engine is clogged.
It detects the pressure differential
between the input and output of the
filter; the higher the pressure difference, the more the filter is clogged. As
we are using it to measure the exhaust
pressure, only one input is needed; the
other port is blocked off.
VR11 is used to adjust the pressure
sensor calibration to 25mV/kPa. For
the sensor used, this means setting
the trimpot to mid-way, reducing the
50mV/kPa output to 25mV/kPa. The
no-pressure output of 500mV is also
reduced to 250mV.
VR11 is included so that another
type of pressure sensor can be used,
provided it has no less than a 25mV/
kPa output. For outputs over 25mV/
kPa, such as the one we use, VR11
reduces the output level applied to
AND3 to set the correct calibration.
VR12 is to set the voltage offset from
the sensor, as measured at the AND5
input. That’s so that IC1 can calculate
the pressure based on the fact that the
voltage rises from the no-pressure
voltage at 25mV/kPa. IC1 then makes
the required compensation of Ip variation with pressure for up to 12% for
lean values and 9% for rich values.
These corrections are in accordance
with the graph shown in Fig.8 from
last month.
In practice, VR12 is set so that the
voltage at TP12 is the same as at TP11
with no pressure differential across the
sensor inputs.
The pressure sensor is set up by
plugging (blocking) one of its differential air inlets to allow the sensor to
work as an absolute pressure sensor
rather than as a differential sensor.
This is best done when the sensor is
at sea level, at the standard air pressure of 1013hPa.
If the input is plugged at higher
altitudes, the sensor output will be
referenced against the lower pressure in the plugged inlet, increasing
the effective sensor offset. VR12 can
also be used to counter this effect. Air
pressure reduces by 11kPa per 1000m
above sea level. Since the calibration
is for 25mV/kPa, reduce the voltage
by 27.5mV per 100m above sea level.
This is suitable for altitudes up to
about 900m, where the pressure versus
altitude becomes non-linear.
If the pressure sensor is not used,
Australia's electronics magazine
the AND5 input will be held low via
VR11, indicating to IC1 that the sensor
is not connected. No pressure corrections will then be made.
The Bluetooth module
The HC-05 Bluetooth module connects to the Tx (pin 10) and Rx (pin
11) of IC1 at the module’s serial Rx and
Tx pins, respectively. The Rx input to
the HC-05 module is supplied with
a reduced voltage from the Tx output of IC1 via a resistive attenuator.
This reduces the 5V output from the
Tx pin to 3.3V. Some HC-05 modules
are not 5V-tolerant and so require this
attenuation.
Data is sent to the Bluetooth module
using 8-bit data, no parity and one stop
bit at 9600 baud. The six data digits
for the air/fuel ratio and lambda are
sent in ASCII format with a line feed
character at the end.
Switch S1, connected to IC1’s RB1
digital input (pin 9), is included in
case the HC-05 module requires manual pairing. When held closed during
power-up, IC1’s RB4 digital output
(pin 14) drives the EN (enable) input
to the module low, allowing pairing
with a Bluetooth receiver. The module we used did not require this procedure.
Power supply
Power for the circuit comes from the
12V vehicle battery. The +12V rail is
fed via fuse F1 and applied directly to
one side of the oxygen sensor heater
(via H+ at Vbatt) and the input to REG2
(LM2940CT-12). REG2 can handle
a reversed supply without damage;
however, REG1 (the LM317T adjustable regulator) cannot, so power goes
to the latter via reverse polarity protection diode D1.
Fuse F1 will blow if the sensor is
connected and the supply polarity is
reversed. That’s because there would
be a low-resistance current path
through the heater element and the
body diode in Q1.
Trimpot VR1 allows REG1’s output
to be set to precisely 5.00V, as this
supply is used as an accurate reference voltage for the circuit. This rail
also supplies microcontroller IC1 and
dual op amp IC4.
In contrast, dual op amp IC3 runs
from +12V and -3V rails. That is
mainly so that the pump current op
amp (IC3a) can provide the required
current right up to the 0V and 5V
siliconchip.com.au
|