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 will know about the operation of an MQ-2 gas sensor, and you will be able to connect it correctly to the STM32 microcontroller card and view the data obtained from the sensor. You will be able to apply what you have...