In this tutorial, we will integrate our Surilli WiFi with MQ7 CO Gas Sensor. This MQ7 Gas sensor will help us monitor the levels of Carbon monoxide concentrations in the air.
Carbon monoxide (CO) is a very dangerous gas which is odorless, colorless, and tasteless, so it cannot be smelt, seen, or tasted.
Carbon monoxide is produced from the partial oxidation of carbon-containing compounds; it forms when there is not enough oxygen to produce carbon dioxide (CO), such as when operating a stove or an internal combustion engine in an enclosed space. In the presence of oxygen, including atmospheric concentrations, carbon monoxide burns with a blue flame, producing carbon dioxide. So it is really in enclosed spaces with partial oxidation of carbon products that creates the danger of carbon monoxide production in homes or in businesses.
Carbon monoxide poisoning is the most common type of fatal air poisoning in many countries. Being colorless, odorless, and tasteless, it is very hard to detect but highly toxic. Carbon monoxide is absorbed through breathing and enters the bloodstream through gas exchange in the lungs. CO combines with hemoglobin to produce carboxy hemoglobin, which usurps the space in hemoglobin that normally carries oxygen, but is ineffective for delivering oxygen to bodily tissues. This leads to oxygen deprivation, which can be deadly.
CO is measured in parts per million (ppm). To give you some perspective, the natural atmosphere is composed of 0.1 ppm. The average level in homes is 0.5-5 ppm. The level near properly adjusted gas stoves in homes and from modern vehicle exhaust emissions is 5-15 ppm. The exhaust from automobiles in Mexico City central area is 100-200 ppm. The amount of CO that can be created from the exhaust from a home wood fire is 5000ppm. Concentrations as low as 667 ppm may cause up to 50% of the body's hemoglobin to convert to carboxy hemoglobin. A level of 50% carboxy hemoglobin may result in seizure, coma, and fatality.
What Is MQ7 Gas Sensor?This Carbon Monoxide (CO) gas sensor detects the concentrations of CO in the air and ouputs its reading as an analog voltage. The sensor can measure concentrations of 10 to 10, 000 ppm.The sensor can operate at temperatures from -10 to 50°C and consumes less than 150 mA at 5 V.
Since this gas is considered toxic to humans at certain levels, concentration of CO is used to determine the air pollution in a given area.
There are two ways to read the output from the MQ-7. One is through the DOUT pin which gives a high when the concentration threshold is reached and low otherwise. Second is the AOUT pin gives varying voltage representing the CO concentration.
- A0 Analog output
- D0 Digital output
- GND Ground
- VCC Supply(5V)
- MQ7 Gas Sensor Module
- Surilli WiFi
- Connecting wires
- Arduino IDE software
Parts per million (PPM) is a unit of measurement used for expressing a very dilute concentration level of pollutants in the air, water and other fluids or one item in a million of anything of the same size. PPM is a volume-to-volume ratio.
Changes in temperature and pressure do not change the ratio of the volume of pollutant gas to the volume of air that contains it.
Connections of Surilli WiFi with MQ7 Gas SensorMQ7 Gas Sensor --> Surilli WiFi
- VCC PIN (MQ7 Gas Sensor) --> USB PIN (5V) (Surilli WiFi)
- GND PIN (MQ7 Gas Sensor) --> GND PIN (Surilli WiFi)
- AOUT PIN (MQ7 Gas Sensor) --> A0 PIN (Surilli WiFi)
- DOUT PIN (MQ7 Gas Sensor) --> PIN 12 (Surilli WiFi)
Make sure you have selected the right port, board and processor for the Surilli as shown in the picture below and it is programmable (compile and upload “Blink” from File>Examples>Digital>Blink onto your Surilli to check if every thing is working fine).
STEP 2: The CircuitryThe circuitry is very simple. It's mostly the programming. Follow the figure below to set up your hardware.
- Now you have completed setting up your hardware and Arduino IDE. Copy and paste the Arduino sketch given below into your Arduino IDE and hit upload.
- After the Arduino Code has been uploaded, the changing values of CO can be observed on the Serial Monitor of Arduino IDE Software.
const int AOUTpin = 0; // The AOUT pin of the CO sensor goes into analog pin A0 of Surilli WiFi
const int DOUTpin = 12; // The DOUT pin of the CO sensor goes into digital pin 12 of Surilli WiFi
int limit;
int value;
void setup()
{
Serial.begin(115200); // Sets the baud rate
pinMode(DOUTpin, INPUT); // Sets the pin as an input to the Surilli WiFi
}
void loop()
{
value= analogRead(AOUTpin); // Reads the analaog value from the CO sensor's AOUT pin
limit= digitalRead(DOUTpin); // Reads the digital value from the CO sensor's DOUT pin
Serial.print("CO value: ");
Serial.println(value); // Prints the CO value
Serial.print("Limit: ");
Serial.println(limit); // Prints the limit reached as either LOW or HIGH (above or underneath)
delay(1000);
}
ResultsThe following results were obtained on the Serial Monitor of Arduino IDE:
Play with the program to see how it reacts to different values and logic.
If you make something fun and interesting, do share it with our community.
That’s all for now. If you have any queries, visit surilli.io or contact our support. Stay connected with Surilli family for more amazing stuff. :-)
Comments
Please log in or sign up to comment.