This is only a preview of the June 2022 issue of Silicon Chip. You can view 41 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 "Spectral Sound MIDI Synthesiser":
Items relevant to "Buck-Boost LED Driver":
Items relevant to "Arduino Programmable Load":
Items relevant to "500W Power Amplifier, Part 3":
Items relevant to "MOS Air Quality Sensors":
Items relevant to "Revised Battery Charge Controller":
Purchase a printed copy of this issue for $11.50. |
Using Cheap Asian Electronic Modules
By Jim Rowe
MOS metal oxide semiconductor
Air Quality Sensors
Our recent article took a look at low-cost air quality sensors and sensing
modules, explaining what they do and how they work. Here’s a more
detailed investigation of some of the currently available MOS (metal
oxide semiconductor) type sensor modules.
M
OS type air quality sensors
(sometimes called MOx sensors)
rely on the behaviour of particles of a
metal oxide (usually tin oxide) when
heated in the presence of air and/
or other gases. The basic principle
is shown in Fig.1, which depicts a
cross-section of a typical MOS sensor.
The silicon substrate of the sensing
chip has a thin layer of tin oxide on the
top, placed there by chemical vapour
deposition. Electrodes at each end
allow its resistance to be measured. On
the underside of the chip is a heater
element, used to heat the oxide layer
to around 200-250°C, to speed up the
sensor’s response.
When the oxide layer is heated in
the presence of clean air, donor electrons in the oxide attract oxygen molecules from the air, and they are ‘captured’ by the oxide particles. As a
result, a depletion layer forms on the
surface of the oxide layer, and its electrical resistance rises.
But if reducing gases such as carbon monoxide (CO) and some volatile
organic chemicals (VOCs) are present
in the air, oxygen molecules in the
surface of the oxide are released, and
the depletion layer becomes thinner.
As a result, the effective resistance of
72
Silicon Chip
the oxide layer is reduced.
So the current passed by the oxide
layer varies proportionally with the
amount of reducing gas in the air surrounding the oxide layer. The higher
the reducing gas level, the higher the
current. Therefore, the basic MOS sensor essentially behaves as a reducing
gas to DC analog current transducer.
We already mentioned several of
these modules in the article last month
(siliconchip.au/Article/15309) along
with some basic specifications. But
we did not go into detail regarding
how they work and how to use them.
The Hanwei MQ-135
Probably the most common of the
low-cost MOS sensors currently available is the Hanwei MQ-135, which is
designed to be sensitive to ammonia
(NH3), nitrous oxides (NOx), carbon
dioxide (CO2), alcohol, benzene and
smoke. Like the other sensors in the
Hanwei series, the MQ-135 sensor
comes in a cylindrical 6-pin package
19mm in diameter and 15mm high.
Most modules using the MQ-135
simply take the current output from
the sensor and convert it to a proportional voltage using a fixed load resistor. The output voltage can then be
measured using a DMM, or fed into
one of the ADC inputs of a microcontroller unit (MCU).
Fig.2 shows the circuit of Hanwei’s
Fig.1: shows the
cross-section of a
MOS (metal oxide
semiconductor)
sensor and how it
works.
Australia's electronics magazine
siliconchip.com.au
Fig.2: the circuit of Hanwei’s
MQ-135 air sensor module.
The lead photo shows a group
of MQ-model sensors.
own air sensor module using the
MQ-135. The MQ-135’s heater pins (H)
are connected between the +5V (Vcc)
line and the GND line via a 5.1W series
current-limiting resistor.
One end of the tin oxide sensing
resistor (Rs) is connected to the +5V
line via the two A pins, and the other
end goes to the GND line via the two B
pins and a 1kW load resistor. The two
B pins are also connected to the A0
analog output pin, to allow the voltage
across the load resistor to be sent to a
DMM or an MCU’s ADC input.
The rest of the components are so
that the module can also be used as a
simple gas level alarm. One half of the
LM393 dual comparator (IC1b) compares the voltage across the 1kW load
resistor with a reference voltage set
using trimpot VR1, so whenever the
A0 voltage rises slightly above the reference voltage, the output of IC1b (pin
7) drops to near ground level, causing
the D0 LED to begin glowing.
The voltage level at the D0 output
pin is pulled down simultaneously.
One change should ideally be made
to the module if you want to use it
with an MCU for monitoring the gas
level, rather than simply using it as a
gas level alarm. This involves replacing the sensor’s 1kW load resistor with
a 22kW resistor, to give a higher output voltage swing and improve reading accuracy.
This resistor is an M2012/0805size (2.0 x 1.2mm) SMD component,
so you’ll need a fine-tipped soldering
iron and either a magnifying glass or
a microscope.
Fig.3 shows how to hook it up
to an Arduino Uno or a compatible
MCU after making that change. You
siliconchip.com.au
just need to connect the module’s Vcc
and GND pins to the corresponding
pins on the Arduino, plus the module’s A0 pin to one of the Arduino’s
ADC input pins; in this case, we’re
using A2.
There are quite a few Arduino libraries and sketches available to work with
the MQ-135 module. You’ll find links
to some of them in the list of links
at the end of this article. However,
I found many of them a bit tricky to
negotiate.
But I did find some very helpful
information on Rob’s blog (at https://
blog.robberg.net/mq-135-arduino/).
Then I came across an elementary
sketch using no libraries, but just
showing the current analog voltage
provided at the module’s A0 pin (at
https://arduinolearning.com/amp/
code).
I adapted this sketch slightly, and
its listing is replicated below along
with some of the sample output from
when this sketch is running. When I
breathed on the MQ-135, that caused
the voltage reading to rise from under
700 to about 728 before falling back
down again.
As you can see, there’s no attempt
to convert the A0 voltage readings to
equivalent gas levels – for that, you
would need one of the fancier sketches
relying on their dedicated libraries.
The SGX Sensortech
MiCS-5524
Another MOS sensor found in lowcost air/gas sensing modules is the
MiCS-5524, made by SGX Sensortech
(an Amphenol company) in Switzerland. This is much smaller than the
MQ-135, coming in an SMD package
measuring only 7 x 5 x 1.6mm.
The MiCS-5524 detects CO, ethanol, hydrogen, ammonia and methane. It is used in an 18 x 13mm gas
sensing module with the same name
available from various internet suppliers, including Banggood, which currently has it priced at US$11.00 with
free shipping (about $16).
Fig.3: the connection diagram for
the MQ-135 sensor module with an
Arduino Uno or similar.
MQ-135 Sketch Program
void setup() {
Serial.begin(9600);
Serial.println(“Silicon
Chip’s MQ-135 demo!”);
}
void loop() {
int reading =
analogRead(A2);
Serial.println(reading);
delay(1000);
}
Sample Output
Silicon Chip’s MQ-135 demo!
696
694
694
691
692
710
June 2022 73
Fig.4: the circuit diagram for the MiCS-5524 module, which is simpler
than the previous MQ-135 sensor and detects fewer gases. Next to the
circuit are two different modules that use this chip.
The circuit of the MiCS-5524 module is shown in Fig.4. It’s basically just
the sensor itself with an 82W current
limiting resistor for the sensor’s heater
and a 91kW load resistor for its sensing resistor Rs, with a 100nF capacitor
across the latter for noise reduction.
P-channel Mosfet Q1 is so that the
power to the sensor can be controlled
using the module’s EN pin. This pin
can be left floating if the module is to
operate continuously.
Fig.5 shows how easy it is to connect
the MiCS-5524 module to an Arduino
Uno, while the sketch is shown below
with the sample output. The sketch is
almost identical to the MQ-135 program and is similarly based on https://
arduinolearning.com/amp/code
The SGX Sensortech
MiCS-VZ-89TE
SGX Sensortech also makes a fancier and slightly larger module (23
x 14mm) called the MiCS-VZ-89TE,
available from suppliers like element14 for $24.65, including GST
but not delivery. This module incorporates its own dedicated MCU with
ADCs (analog to digital converters)
and embedded conversion algorithms.
As a result, this module can provide
both PWM and I2C digital outputs for
CO2 equivalent and TVOC (isobutylene equivalent).
I couldn’t find any circuit diagram
for the MiCS-VZ-89TE module, but its
layout is shown in Fig.6.
I found it fairly easy to connect to
this module by using two 5-pin sections of SIL header strip, with the top
of the second and fourth pins of each
strip cut short, allowing the tops of the
remaining three pins to be soldered to
the notches on one side of the module. You can then plug the complete
assembly into a small breadboard for
testing and use.
Fig.7 shows how the MiCS-VZ-89TE
module can be connected to an Arduino Uno or equivalent MCU. The GND
connection goes to one of the Arduino’s GND pins, while the module’s
Fig.6: the layout diagram for the
MiCS-VZ-89TE module, which is
shown above.
MiCS-5524 Sketch
void setup() {
Serial.begin(9600);
Serial.println(“Silicon
Chip’s MiCs-5524 demo!”);
}
void loop() {
int reading =
analogRead(A0);
Serial.println(reading);
delay(1000);
}
Sample Output
Fig.5: MiCS-5524 connection diagram.
Fig.7: MiCS-VZ-89TE connection
diagram to an Arduino Uno.
74
Silicon Chip
Silicon Chip’s MiCs-5524
demo!
40
39
40
39
siliconchip.com.au
3.3V power connection goes to the
Arduino’s +3.3V pin.
The module’s I2C connections SDA
and SCL are wired to the Arduino’s
pins A4/SDA and A5/SCL, respectively. Each of these pins needs an
external 4.7kW pullup resistor connecting to the +3.3V pin, because the
MiCS-VZ-89TE module doesn’t provide the pullups itself.
I found an Arduino sketch and
library to read the CO2 and VOC levels from a MiCS-VZ-89TE, written by
H.Grabas and available on his website
at https://github.com/HGrabas/MICSVZ-89TE
This sketch and its library worked
so well that I adapted it to produce the
sketch listed below along with a sample of the output from the Arduino IDE
Serial Monitor. For this to work, you
need to download Mr Grabas’ library
from his website and install it as a
library in the Arduino IDE.
When running, it gives you a VOC
reading and a CO2 reading approximately once per second. I eventually breathed on the module’s sensor,
causing the VOC readings to rise to
around 270.4ppb (parts per billion),
while the CO2 reading barely moved
MiCS-VZ-89TE Sketch:
#include <MICS-VZ-89TE.h>
#include <Wire.h>
MICS_VZ_89TE voc;
void setup() {
voc.begin();
Serial.begin(9600);
Serial.println(“Reading the
MiCS-VZ-89TE sensor”);
}
void loop() {
voc.readSensor();
Serial.print(“VOC =”);
Serial.print(voc.getVOC());
Serial.print(“ | ”);
Serial.print(“CO2 = ”);
Serial.println(voc.
getCO2());
delay(1000);
}
from about 414 ppm (parts per million).
Then I sprayed a tiny amount of
isopropanol (spectacle cleaning fluid)
a few centimetres above the sensor,
causing the VOC reading to jump up
to its maximum figure of 1000ppb. So
the MiCS-VZ-89TE and the sketch and
library certainly seem to be working!
The ScioSense CCS811
Another MOS sensor found in several low-cost air/gas sensing modules
is the CCS811, made by ScioSense BV
in Eindhoven, The Netherlands. The
CCS811 is in a tiny SMD package, measuring only 4 x 3 x 1.2mm.
Despite this tiny size, it incorporates both an ADC and a dedicated
MCU with built-in conversion algorithms, plus an I2C digital interface
to link directly to a PC or an MCU
like an Arduino or a Micromite. It’s
described by ScioSense as an “ultralow power digital gas sensor” and
detects a range of VOCs and provide
both eTVOC (equivalent total VOC)
and eCO2 (equivalent CO2) levels.
Fig.8 is a block diagram of the
CCS811. Pins 4 (PWM) and 5 (SENSE)
must be connected together for correct
operation of the MOX sensor’s heater
control circuit. Pin 1 (ADDR) is to
allow the CCS811’s I2C address to be
set to either 90d/5Ah (ADDR pin low)
or 91d/5Bh (ADDR pin high), while
the AUX pin (8) has no internal connection.
The CCS811 sensor is used in many
air quality sensing modules, including the Keyestudio KS0457 CO2 Air
Quality module, the Duinotech SENCCS811 Air Quality Sensor module
(Jaycar Cat XC3782), the Adafruit
CCS811 Air Quality Sensor and the
CJMCU-811 CO2, Temperature and
Humidity Sensor from Banggood.
Fig.9 shows the circuit for many of
these CCS811 sensor modules. Along
with the CCS811 sensor itself, there’s
voltage regulator REG1, which steps
down the incoming +5V power to provide the 3.3V needed by the CCS811,
plus Mosfets Q1 and Q2 which,
together with four 10kW pullup resistors, perform logic level conversion for
the I2C digital communication lines
(SDA and SCL).
Diodes D1 and D2, together with the
two 100kW pullup resistors, allow the
WAKE and RST pins of the CCS811 to
be pulled low. The WAKE pin must
be pulled to ground to allow the chip
to operate.
Note that pin 1 of the CCS811 is
pulled low by a 100kW resistor to set
the I2C address to 90d/5Ah. Also, as
mentioned earlier, pins 4 and 5 are
tied together and pulled high via two
more 100kW resistors.
Incidentally, some CCS811-based
modules (such as the CJMCU-811)
have an additional pin on the I/O connector, with the extra pin connected
to pin 1 of the CCS811 and labelled
“ADD”. This allows the I2C address of
the module to be changed to 91d/5Bh
by pulling the pin high.
It’s quite easy to connect the SENCCS811 and most of the other CCS811based air quality modules to an MCU
like an Arduino Uno, as shown in
Fig.10. The Vcc and GND pins connect to the +5V and GND pins of the
Arduino, while the SDA pin goes to
the Arduino’s A4/SDA pin and the
SCL pin to the Arduino’s A5/SCL
pin. Finally, the module’s WAKE pin
connects to another GND pin on the
Arduino.
Some modules have the pins in a different order, so make sure you check
the connections for the module you
are using.
Fig.8: the block diagram
for the CCS811 module.
One type of this module
is shown below, with a
larger variant shown
overleaf.
Sample Output
Reading the MiCS-VZ-89TE
sensor
VOC = 0.00
| CO2 = 413.97
VOC = 135.37 | CO2 = 413.97
VOC = 270.74 | CO2 = 413.97
VOC = 1000.00 | CO2 = 420.96
siliconchip.com.au
Australia's electronics magazine
June 2022 75
Fig.9: the circuit diagram for the
CCS811 module.
Several Arduino libraries are available to support a sketch communicating with these modules. I found
the easiest one to use was the Keyestudio KS0457 library (CCS811.h and
CCS811.cpp), available from https://
fs.keyestudio.com/KS0457
I also downloaded Keyestudio’s
“readData.ino” sketch and adapted it
to produce the sketch “read_CCS811_
data.ino”, which you can download
from the Silicon Chip website. It’s
a bit too long to reproduce the listing here.
Shown at right is the output of that
sketch. The Arduino provides a stream
of measurements for both the eCO2
level in ppm and eVOC in ppb.
At one point, I blew in the direction
of the CCS811 sensor to give it some
extra CO2. That’s the reason for the
sudden rise in eCO2 and eTVOC readings, from around 400ppm and 1-2ppb
up to peaks of 1743ppm and 384ppb
a second later. Then the readings fell
slowly after that.
Summary
After trying several of these modules, I’m less keen on those based on
the MQ-135 sensor than on the Sensortech MiCS sensors or the ScioSense
CCS811 sensor. That’s mainly because
of the scarcity of easy-to-understand
software if you want to do more than
simply ‘raise the alarm’ if the CO2/
VOC level rises above a preset ‘safe’
level.
I’m also not that keen on modules
based on the SGX Sensortech MiCS5524 sensor for much the same reason.
76
Silicon Chip
Overall, I prefer the ‘smarter’ modules like the SGX Sensortech MiCSVZ-89TE or most of those using the
CCS811 sensor. These modules are
all much easier to get going with an
MCU like an Arduino as a reliable
CO2/VOC sensor.
I would give first prize to the
MiCS-VZ-89TE module (element14
2925865). But second prize would go
to any of the modules based on the
ScioSense CCS811 sensor, like the
Duinotech SEN-CCS811 from Jaycar
(Cat XC3782), the CJMCU-811 from
Banggood (ID 1157216), the Keyestudio KS0457 or the Adafruit CCS811
(www.adafruit.com/product/3566).
I will describe some of the NDIR and
PAS type air quality sensor modules
SC
in a future article.
Sample Output
Getting data from the
CCS811...
eCO2: 400ppm, eTVOC: 0ppb
eCO2: 410ppm, eTVOC: 1ppb
eCO2: 414ppm, eTVOC: 2ppb
eCO2: 1743ppm, eTVOC: 384ppb
eCO2: 1345ppm, eTVOC: 143ppb
eCO2: 977ppm, eTVOC: 87ppb
Useful Links
MQ-135:
• www.arduinolibraries.info/
libraries/mq135
• https://github.com/
Phoenix1747/MQ-135
• siliconchip.com.au/link/abct
• https://blog.robberg.net/
mq-135-arduino
MiCS-5524:
• www.sgxsensortech.com
• siliconchip.com.au/link/abcu
• https://github.com/HGrabas/
MiCS-VZ-89TE
CCS811:
• https://fs.keyestudio.com/
KS0457
• siliconchip.com.au/link/abcv
Australia's electronics magazine
Fig.10: CCS811 connection diagram.
siliconchip.com.au
|