Categories

Follow Us

Arduino and mics-5524 gas sensor example

In this example we look at a MICS 5524 gas module

The MiCS-5524 is a robust MEMS sensor for indoor carbon monoxide and natural gas leakage detection; suitable also for indoor air quality monitoring; breath checker and early fire detection.

Detectable gases

• Carbon monoxide CO 1 – 1000ppm
• Ethanol C2H5OH 10 – 500ppm
• Hydrogen H2 1 – 1000ppm
• Ammonia NH3 1 – 500ppm
• Methane CH4 >1000ppm

One thing to note is that this sensor is sensitive to multiple gasses, as you can see above – but does not know which gas it is

Connection

 

Arduino UnoMICS 5524 module
5v5v
GndGnd
A0A0

 

arduino and mics5524

arduino and mics5524

 

Parts List

Here are the parts I used

Part nameLink
Arduino UnoUNO R3 CH340G/ATmega328P, compatible for Arduino UNO
MICS 5524 module1PCS MiCS5524 CO Alcohol and VOC Gas Sensor Breakout Detector
Dupont cable Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire Dupont cablefor Arduino

 

Code

void setup()
{
  Serial.begin(9600);
  Serial.println("MiCS-5524 demo!");
}
 
void loop()
{
  int reading = analogRead(A0);
  Serial.println(reading);
  delay(100);
}

Output

OPen the serial monitor, if you have a gas source such as alcohol then you could test this further

MiCS-5524 demo!
61
57
57
56
56
56
57
56
56
56
56
55
54

 

Serial plotter example

 

Links

 

Share

CCS811 digital gas sensor and Arduino example

In this example we will connect a CCS811 gas sensor to an arduino, lets look at the sensor

CCS811 is a low-power digital gas sensor solution, which integrates a gas sensor solution for detecting low levels of VOCs typically found indoors, with a microcontroller unit (MCU) and an Analog-to-Digital converter to monitor the local environment and provide an indication of the indoor air quality via an equivalent CO2 or TVOC output over a standard I2C digital interface.

Features

Integrated MCU
On-board processing
Standard digital interface
Optimised low power modes
IAQ threshold alarms
Programmable baseline
2.7mm x 4.0mm LGA package
Low component count
Proven technology platform

Specs

InterfaceI²C
Supply Voltage [V]1.8 to 3.6
Power Consumption [mW]1.2 to 46
Dimension [mm]2.7 x 4.0 x 1.1 LGA
Ambient Temperature Range [°C]-40 to 85
Ambient Humidity Range [% r.h.]10 to 95

Parts List

 

 

AmountPart Type
1CJMCU-811 CCS811 Air Quality Gas Sensor
1UNO R3 CH340G/ATmega328P, compatible for Arduino UNO R3

 

 

Schematics/Layout

 

Remember and connect WAKE to gnd

arduino and ccs811 layout

arduino and ccs811 layout

 

arduino and ccs811 schematic

arduino and ccs811 schematic

Code

Again we use a library this is the adafruit one – you can use the library manager and add this.

And this is the out of the box example

#include "Adafruit_CCS811.h"
Adafruit_CCS811 ccs;
void setup() {
Serial.begin(9600);
Serial.println("CCS811 test");
if(!ccs.begin()){
Serial.println("Failed to start sensor! Please check your wiring.");
while(1);
}
//calibrate temperature sensor
while(!ccs.available());
float temp = ccs.calculateTemperature();
ccs.setTempOffset(temp - 25.0);
}
void loop() {
if(ccs.available()){
float temp = ccs.calculateTemperature();
if(!ccs.readData()){
Serial.print("CO2: ");
Serial.print(ccs.geteCO2());
Serial.print("ppm, TVOC: ");
Serial.print(ccs.getTVOC());
Serial.print("ppb Temp:");
Serial.println(temp);
}
else{
Serial.println("ERROR!");
while(1);
}
}
delay(500);
}

 

Output

Open the serial monitor – this is what I saw. The higher CO2 level was when I breathed on the sensor

CO2: 400ppm, TVOC: 0ppb Temp:28.28
CO2: 400ppm, TVOC: 0ppb Temp:47.75
CO2: 400ppm, TVOC: 0ppb Temp:25.00
CO2: 400ppm, TVOC: 0ppb Temp:26.49
CO2: 1228ppm, TVOC: 126ppb Temp:25.68
CO2: 575ppm, TVOC: 26ppb Temp:9.59
CO2: 400ppm, TVOC: 0ppb Temp:26.49
CO2: 400ppm, TVOC: 0ppb Temp:105.81

 

Video

In this video we import the library, we compile and program the Arduino and then we open the serial monitor. The higher reading is when I blew on the sensor

Links

ccs811 datasheet

CJMCU-811 CCS811 Air Quality Gas Sensor

Share

MQ-135 gas sensor

MQ-135 gas sensor is a hazardous gas detection apparatus for the family, the environment, suitable for ammonia, aromatic compounds, sulfur, benzene vapor, smoke and other gases harmful gas detection, gas-sensitive element test concentration.

Air quality sensor is for detecting a wide range of gases, including NH3, NOx, alcohol, benzene, smoke and CO2. Ideal for use in office or factory, simple drive and monitoring circuit.

The sensitivity of the sensor can be adjusted by using the potentiometer.

MQ-135

MQ-135

FEATURES
* High sensitivity to Sulfide, benzene Department of steam, smoke and other harmful gases
* Long life and low cost
* Simple drive circuit

Connection

here are the connections for my sensor

ArduinoGas Sensor
5VVCC
GNDGND
NCDO
Analog A0AO

Code

void setup()
{
  Serial.begin(9600);
}
 
void loop()
{
  float sensorVoltage;
  float sensorValue;
 
  sensorValue = analogRead(A0);
  sensorVoltage = sensorValue/1024*5.0;
 
  Serial.print("sensor voltage = ");
  Serial.print(sensorVoltage);
  Serial.println(" V");
  delay(1000);
}

Results

Again look at the serial monitor, you need to let the sensor stabilise. Remember it consists of a heating element, so you effectively have to let the sensor ‘heat up’.

sensor voltage = 0.30 V
sensor voltage = 0.31 V
sensor voltage = 0.33 V
sensor voltage = 0.34 V
sensor voltage = 0.35 V
sensor voltage = 0.32 V
sensor voltage = 0.31 V
sensor voltage = 0.30 V

Links

Mq-135 datasheet

 
MQ-135 Air Quality Sensor Hazardous Gas Detection Module for Arduino

Share

MQ-9 gas sensor

MQ-9 gas sensor has high sensitity to Carbon Monoxide, Methane and LPG. The sensor could be used to detect different gases contains CO and combustible gases, it is with low cost and suitable for different application.

The sensitivity of the sensor can be adjusted by using the potentiometer.

MQ-9

MQ-9

FEATURES

* Good sensitivity to CO/Combustible gas
* High sensitivity to Methane, Propane and CO
* Long life and low cost
* Simple drive circuit

Connection

here are the connections for my sensor

ArduinoGas Sensor
5VVCC
GNDGND
NCDOUT
Analog A0AOUT

Code

void setup()
{
  Serial.begin(9600);
}
 
void loop()
{
  float sensorVoltage;
  float sensorValue;
 
  sensorValue = analogRead(A0);
  sensorVoltage = sensorValue/1024*5.0;
 
  Serial.print("sensor voltage = ");
  Serial.print(sensorVoltage);
  Serial.println(" V");
  delay(1000);
}

Results

Again look at the serial monitor, you need to let the sensor stabilise. Remember it consists of a heating element, so you effectively have to let the sensor ‘heat up’.

sensor voltage = 0.40 V
sensor voltage = 0.40 V
sensor voltage = 0.40 V
sensor voltage = 0.42 V
sensor voltage = 0.41 V
sensor voltage = 0.41 V
sensor voltage = 0.41 V
sensor voltage = 0.41 V
sensor voltage = 0.40 V

Links

Mq-9 datasheet
MQ-9 Combustible Gas Detector Carbon Monoxide CO Sensor Module for Arduino

Share