56 August 2015
large and unwieldy for lookup within a software
application. We can automate the process by using a
spreadsheet to plot and thus capture the curve fit for the
RS/R0 relationship to VRL and then to PPM. A simple
regression can be used to derive a formula. The formula
can then be applied for code use within Python. As an
example, with MQ- 2, the equation is y = 0.1575e1.724*x
where LPG gas PPM is y and the MQ- 2 VRL is x. The
spreadsheet example is shown in Figure 6.
Most of this spreadsheet “leg work’ has been done for
you on the selected gas sensors, and the necessary
equations are derived. A copy of this spreadsheet with the
gas equations is available for download at the article link.
As you build your own air quality prototype using the
equations (Figure 6), keep in mind several fixed required
conditions before starting:
1. Configure RL on breakout boards; these can be set
using a multimeter when VCC power is not applied
to the boards. In our case, we followed
manufacturer’s specifications and configured both
MQ- 2 and MQ- 7 for an RL of 10K, and HCHO for
an RL of 20K.
2. Keep the supply voltage (VCC) to +5V DC.
Prototype Overview
Let’s start with a good old fashioned block diagram
(see Figure 7). The computer hardware, as mentioned
earlier, is based on an ISaAC adapter/Raspberry Pi board.
The application is written in Python which executes on the
Raspberry Pi. To this, we added a gas sensor interface
breakout boards interface
directly to computer
hardware. The sensor
board also provides an
LED feedback.
The various gas sensor
breakout boards are
supplied with +5V DC
power and ground from
our sensor interface. Also,
it is here where the sensor
voltage outputs are
buffered and levels are
converted for ingestion
into the computer
hardware.
As noted earlier, each sensor
contains individual heating
elements that at +5V require
current. These typically run hot,
and can consume about 160 mA
each. It is not practical to use
power from the ISaAC and Pi; + 5
volts is needed to supply heater
power, so a separate +5V DC
supply is integrated in the sensor
interface to handle all gas sensor
power.
Finally, for email connectively,
the system uses a Wi-Fi dongle or
direct Ethernet connection.
Sensor Board
Particulars
The MQ- 2 and VOC sensor
use a fixed +5V. The MQ- 7 CO
sensor is unique from the other
sensors in that it requires the use
FIGURE 6. Excel MQ- 2 derived PPM to VRL equation.
FIGURE 7. DIY air quality
monitoring block diagram.