MQ5 SENSOR

CODE:

#include<maker_mq5.h>

uint8_t AN_PIN=A2;


int main()
{


init();
Serial.begin(9600);
maker_mqGetEnvirionmentR0( AN_PIN);

while(1)
{

Serial.print(“Sensor_volt=”);
Serial.println(maker_mq5GetSensorVolt(AN_PIN));
Serial.print(“RS=”);
Serial.println(maker_mq5GetRSAir(AN_PIN));
Serial.print(“RS/R0”);
Serial.println(maker_mq5GetRatio(AN_PIN));
delay(1000);

}
return 0;

}

MQ5 sensor can be used for gas leakage detection and it is mostly used for detecting LPG, but it can be also used to detect some other chemical compounds, such as hydrogen and methane. It is highly sensitive and very responsive and this allow us to do some quick measurements.

VCC – power supply pin (5V)

GND – ground pin (0V)

AO – output analog pin

DO – output digital pin 

Coded by: