This is only a preview of the July 2022 issue of Silicon Chip. You can view 44 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 "Multimeter Calibrator & Checker":
Items relevant to "VGA PicoMite":
Items relevant to "0-110dB RF Attenuator":
Items relevant to "Secure Remote Mains Switch, Part 1":
Articles in this series:
Purchase a printed copy of this issue for $11.50. |
Using Cheap Asian Electronic Modules
By Jim Rowe
PAS CO2
Air Quality
Sensor Module
Continuing our series of articles describing low-cost air quality sensors
(LCAQS), this month, we take a close look at a sensor module based on photoacoustic spectroscopy or PAS. It’s the Infineon XENSIV PAS CO2 mini-board.
P
AS (photo-acoustic spectroscopy)
sensors take advantage of the way
molecules of a particular gas absorb
specific IR wavelengths according to
the Beer-Lambert law.
In PAS sensors, the degree of absorption is measured using a phenomenon Alexander Graham Bell discovered in 1880. When a thin metal disc
is exposed to pulses of sunlight (Bell
used a rotating slotted wheel), it emits
sound. Later, Bell showed that materials exposed to the non-visible wavelengths in sunlight (like infra-red/IR
and ultraviolet/UV) also emit sound.
The basic structure of a PAS sensor
is shown in Fig.1. On the left is the
pulsed IR light source (generally an
array of LEDs), with an optical filter
passing only the wavelengths absorbed
by the gas to be detected - in this example, 4.2μm for the detection of CO2.
At the far end of the chamber, there
is a MEMS microphone optimised to
detect low audio frequencies. When
the detected sound level is amplified, it can be converted into a figure
corresponding to the amount of CO2
present in the cell. The whole sensor
is enclosed in an acoustic insulation
layer, to reduce the influence of external sound.
LCAQS sensors using the PAS principle have only appeared in the last
couple of years because their development has depended on MEMS technology. The only one currently available seems to be the XENSIV PAS CO2
sensor from Infineon Technologies (an
offshoot of Siemens in Munich, Germany).
This comes on a very compact module measuring only 14 x 13.8 x 7.5mm,
combining the PAS sensor with a
Fig.1: the basic structure of a PAS sensor. A pulsed IR LED emits light through a
filter leaving only wavelengths of light that the gas to be detected can absorb. A
MEMS microphone then detects low-frequency audio that is emitted by the gas,
which can be measured to provide the amount of gas in the cell.
siliconchip.com.au
Australia's electronics magazine
dedicated microcontroller unit (MCU)
running advanced compensation algorithms and providing a choice of three
different data interface ports. It is currently available from suppliers like
element14 for around $50 or Mouser
Electronics for about $78.
Inside the module
Fig.2 shows a functional block diagram of the XENSIV PAS CO2 sensor
module. At the top is the PAS measurement cell, with its gas inlet pipe
on the right, the MEMS IR emitter in
the centre and the MEMS LF microphone on the left.
Then in the lower part of the diagram are the microcontroller and
memory, the light source driver and
the circuit that measures the voltage
of the external 12V DC supply used to
power the IR emitter.
Labels for the pin connections are
available on the module underside.
July 2022 83
but I suspect it is only functional
when the UART or PWM interfaces
are being used.
The actual pin connections for
the PAS CO2 mini-board are shown
in Fig.3, which is a simplified top
view of the module. There are six
pins on each side, but the two lowest pins, labelled SWD and SWCLK,
are for testing during manufacture
and should not be connected when
the module is being used. All of the
remaining pins correspond to those
shown in Fig.2.
Trying it out
Fig.2: a functional block diagram of the XENSIV PAS sensor module.
As mentioned above, the PAS CO2
sensor mini-board provides a choice of
three different data interfaces for communicating with an external MCU: I2C,
asynchronous serial (UART) and PWM
(pulse-width modulation). Which one
to be used is chosen by setting the logic
level on the PSEL and PWM_DIS control pins.
To use the I2C interface, the PWM_
DIS and PSEL pins must be pulled
down to GND. For the UART interface, PWM_DIS is pulled down while
PSEL is pulled up to logic high (3.3V)
instead. Finally, if you want to use the
PWM interface, the PWM_DIS pin is
pulled to logic high (3.3V).
When the I2C interface is selected,
the SDA/TX pin is used for the data
line and the SCL pin for the clock
line. When using this interface, both
the SDA/TX and SCL pins need to be
fitted with 10kW pull-up resistors to
the +3.3V supply.
When the UART interface is selected,
the SDA/TX line is used as the serial
data output and the RX pin for serial
data input. But when the PWM interface is selected, the width-modulated
pulses emerge from the PWM pin.
The INT pin is an output to allow
the internal MCU to indicate when it
has finished a measurement. I could
not find much information on this,
Once I had obtained a sample XENSIV PAS CO2 mini-board module, the
challenge was to discover how to connect it to a standard low-cost MCU like
an Arduino Uno. Luckily, I found this
information on the Infineon website.
Although Infineon only provides
specific information on connecting
the module to either a PSoC 6 WiFi-BT
Pioneer Kit or an up-market Arduino
Due, I was able to glean enough from
the latter option to work out how to
connect it to an Uno or similar.
This turned out to be relatively
straightforward, as you can see from
Fig.3, which shows how to connect
the module to an Arduino Uno via I2C.
The 3.3V logic supply comes from the
+3.3V output of the Uno, while the SCL
Fig.3: connecting the PAS sensor to an Arduino board is straightforward. Note
that we have tied the PWM_DIS and PSEL pins to GND so that the module is in
I2C mode.
Useful links
PAS modules:
• https://au.element14.com/3779651
• https://au.mouser.com/ProductDetail/726-PASCO2V01AUMA2
• www.infineon.com/cms/en/product/sensor/co2-sensors/#!products
Software libraries (or download through the Arduino IDE Library Manager):
• https://github.com/Infineon/arduino-pas-co2-sensor
• www.arduino.cc/reference/en/libraries/pas-co2-sensor/
Photoacoustic spectroscopy:
• https://w.wiki/4wsX
84
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
and TX/SDA pins connect to the Uno’s
SCL and SDA pins and a pair of 10kW
pull-up resistors. The PWM_DIS and
PSEL pins are tied to ground for I2C
mode, as mentioned earlier.
Since the module also needs a 12V
DC supply to provide power for the
IR LED, this can come from a separate
plugpack supply. It can be a small supply, since the average current is less
than 600μA with brief pulses of around
20mA. Three bypass capacitors on the
12V supply line provide smoothing.
Of course, we need a software
library to send commands to and
receive data from the sensor, plus a
sketch to use the library.
After a bit of searching on the Arduino website in the “reference/en/
libraries” section and then in the list
of 900-odd contributed libraries for
communicating with sensors, I found
one called “PAS CO2 Arduino Library
v1.0.3”.
When I clicked on that one, it took
me to github.com, where I discovered
that the library was provided by and
maintained by Infineon! So it was
obviously the right one to download.
I downloaded the library zip file and
added it to my Arduino IDE’s list of
installed libraries. I then discovered
that it came with 12 example sketches
– four of which are for using the module’s PWM interface mode, while the
Fig.4: sample output
15:37:04.303
15:37:09.505
15:37:14.520
15:37:19.487
15:37:24.502
15:37:29.516
15:37:34.483
15:37:39.498
15:37:44.466
15:37:49.480
15:37:54.448
15:37:59.462
15:38:04.477
15:38:09.444
15:38:14.459
15:38:19.426
15:38:24.441
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
->
pas
co2
co2
co2
co2
co2
co2
co2
co2
co2
co2
co2
co2
co2
co2
co2
co2
co2
ppm
ppm
ppm
ppm
ppm
ppm
ppm
ppm
ppm
ppm
ppm
ppm
ppm
ppm
ppm
ppm
serial intialized
value : 633
value : 623
value : 621
value : 611
value : 609
value : 610
value : 649
value : 1018
value : 1255
value : 1254
value : 1256
value : 1317
value : 1409
value : 1418
value : 1405
value : 1392
other eight are for the serial interface
modes (ie, I2C or UART). The latter
had the following titles:
• serial-alarm
• serial-api-test
• serial-calibrate
• serial-device-id
• serial-diagnosis
• serial-oneshot
• serial-periodic
• serial-reset
I decided to try “serial-oneshot.ino”,
and when I loaded it, compiled it and
then uploaded it to the Arduino and
opened virtual serial port COM3, it all
sprang into life.
The PAS sensor measures 14
x 13.8mm, making it tiny in
comparison to the enlarged
photo shown here.
Fig.4 shows the output in the Arduino IDE Serial Monitor following the
startup of the serial-oneshot sketch.
The first line indicates that the PAS
CO2 and its I2C serial port have been
initialised, while the following lines
show the measured CO2 levels in ppm
(parts per million). These measurements are about five seconds apart,
as you can see from the timestamps.
The other thing to note from Fig.4
is that the initial seven readings are
all between 610ppm and 649ppm,
whereas the eighth reading suddenly
jumps up to 1018ppm and then following readings move up to 1418ppm
before starting to fall again.
At about 15:37:40, I exhaled towards
the PAS CO2 sensor. So it was responding to the sudden increase in CO2 level,
as it’s supposed to.
Encouraged by this initial success,
I then tried loading, uploading and
running the “serial-calibrate.ino”
example sketch. This sketch ran very
quickly, simply giving a “sensor now
calibrated” message before ending.
Summary
Despite being very compact, the
Infineon XENSIV PAS CO2 sensor
mini-board is a good performer. As
it uses a standard I2C interface, it
is compatible with just about any
microcontroller, including virtually
all Arduinos.
No doubt it would work with a
Micromite as long as it was set up to
send the correct I2C commands.
Although it is priced higher than
the MOS sensors we’ve looked at previously, and it needs a 12V supply, it
is a good choice if you want a small
and accurate CO2 sensor.
SC
siliconchip.com.au
Australia's electronics magazine
July 2022 85
|