of PWM to switch from +5V (sensor purge 90 second
cycle) to +1.4V (sensor measurement 60 second cycle).
The Parallax sensor breakout board provides an HSW
input to switch the MQ VCC on/off. We use the HSW
with PWM control to achieve the +1.4V and +5V VCC
needed for this sensor.
The sensor board also uses three Microchip MCP608
rail-to-rail op-amps to do a voltage level conversion from
the native sensor +5V peak analog to the ISaAC/Pi + 3.3V
The op-amps connect directly to the VRL sources from
the breakout boards, and then each outputs to a resistor
network of a 10K pot in series with a 3.3K resistor to
ground. The pot settings are about 1.7K to achieve a full
scale conversion of +5V to + 3.3V at the tap point of each
resistor network. These networks prevent overdriving of
the input 3.3V analog pins of ISaAC, thereby protecting
them (see the sensor interface schematic in Figure 8).
ISaAC does the “heavy lifting” of interfacing to the gas
sensor boards, as well as driving the LEDs — all under
Python control by the Raspberry Pi. The ISaAC Python
library is used for this control in commanding the hardware:
• API_ADC (pin) to do 10-bit analog-to-digital
conversions where pin is 14 (A0), 15(A1), and 16
(A2) for MQ- 7, MQ- 2, and HCHO.
• API_com (command string)
• For digital I/O where various command strings
are OXX (set out digital), HXX (set digital high),
and LXX (set digital low) for XX = 01, 02 for D1,
and D2, respectively.
• For precision PWM using command string ‘Z’ +
‘09’ (pin D9) + 5 digit PWM frequency (HZ) + 6
digit PWM duty cycle (microseconds).
FIGURE 8. Gas sensor board
interface to ISaAC.
August 2015 57
Gas Sensor Board (#27983)
CO (Carbon Monoxide) MQ- 7
Gas Sensor (# 605-0007)
Grove Gas Sensor MQ- 2 LPG
Grove HCHO Sensor
Microchip Direct ( 3) MCP-608
Op-Amp eight-pin DIP
( 3) 10K Potentiometer
( 3) 3.3K Resistor
( 2) 1K Resistor
(1) Raspberry Pi with Display,
(1) ISaAC board
Free Downloads IsaAC
Software and Documentation