Working with Gas Sensors and the Raspberry Pi

Many devices predicted by earlier science fiction stories and movies have come true. Among them are gas detectors as envisaged by the TV series Star Trek. If you have a single board computer such as the Raspberry Pi (RBPi), you can use it to detect the type of gas and air quality around you. Of course, you will need to couple the RBPI with a gas sensor, and among the popular gas sensors available are the BME680 from Bosch, and the CCS811 from AMS.

Gas sensors are helpful in sniffing out volatile organic compounds, many of them not only poisonous but also flammable. Volatile organic compounds may be natural or manmade, including paints and coatings that require solvents to spread in a protective or decorative coating. Where earlier the paint and coating industry used toxic chemicals, they are now shifting towards aqueous solvents. Natural volatile organic compounds may come from direct use of fossil fuels such as gasoline or as indirect byproduct such as automobile exhaust gas.

Some volatile organic compounds may also be carcinogenic to humans. Among them are chemicals such as benzene, methylene chloride, perchloroethylene, MTBE, Formaldehyde, and more.

BME680

Bosch developed this tiny sensor BME680 specifically for applications involving mobiles and wearables that require low power consumption. This one sensor has high linearity, and measures temperature, humidity, pressure, and gas with high accuracy. This 8-pin LGA package is only 3 X 3 X 0.95 mm, and Bosch has optimized its power consumption based on the specific operating mode.

With high EMC robustness and long-term stability, the BME680 measures indoor air quality, while detecting a broad range of gases and volatile organic compounds. For instance, the BME680 can detect formaldehyde from paints, and other volatile organic compounds from paint strippers, lacquers, furnishings, cleaning supplies, glues, office equipment, alcohol, and adhesives.

Apart from applications for indoor air quality measurement, BME680 is also useful for applications such as personalized weather station, measuring skin moisture, detecting change in rooms, monitoring fitness, warning for dryness or high temperatures, measuring volume and air flow, altitude tracking, and more.

CCS811

Compared to the BME680, the CCS811 is only a digital gas sensor. It is meant for monitoring indoor air quality using a metal oxide gas sensor. The gas sensor can detect a wide range of volatile organic compounds. The CCS811 includes a micro-controller unit, an analog to digital converter, and an I2C interface.

With optimized low-power modes, AMS has designed the CCS811 for high volume and reliability. It has a tiny form-factor that saves more than 60% in PCB footprint, while producing stable and predictable behavior regardless of air quality at power up.

Similar to the BME680, the CCS811 also measures the total volatile organic compounds and the equivalent of calculated carbon di oxide. However, the consumption of CCS811 being about 60 mW, it may be necessary to have to supply it with an external supply of 3.3V.

Both sensors need the working I2C bus on the RBPi to interface and function. The software library for the two sensors are available here for the BME680 and here for the CCS811.