Chapter 8: Gas Sensor

An indoor environment with good air quality is essential to guarantee a healthy environment (Marques and Pitarma, 2017). The MQ-2 gas sensor can be an excellent way to measure the quality parameters of indoor air or as an early fire detection system. In this chapter, you will learn how to build a practical system for detecting gases in the environment (which we will call a gas sensor) and connect the MQ-2 gas sensor to a Blue Pill microcontroller card.

The following main topics will be covered in this chapter:

  • Introducing the MQ-2 gas sensor
  • Connecting a gas sensor to the STM32 microcontroller board
  • Writing a program to read the gas concentration over the sensor board
  • Testing the system

At the end of this chapter, you ...

Get DIY Microcontroller Projects for Hobbyists now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.