MQ-7 Carbon Monoxide Sensor Arduino


Right, in this post I'm going to share with you a Arduino sketch, by using the sketch you can get reading from the MQ-7 Carbon Monoxide Sensor and control many things as you like.

Before I share the sketch with you let me tell you what did I do when I got this sensor on my hand. Actually I bought this sensor by mistake. I wanted natural gas sensor which can detect the quality of the air so that it can tell me when the air gets polluted. Any way after getting this sensor I started looking for the sketch, so after some search I found a link on the Arduino website which was linked to another site, and when I clicked on it my Avast (antivirus software) didn't let me go (probably because of some kind of virus site). Then I have found another site with the sketch, but this time I didn't quite understand the sketch. So I opened my soil moisture sensor sketch and after making some changes I was able to get reading from this sensor.

The sketch
int led = 5;
void setup() {
// initialize serial communication at 9600 bits per second:
 pinMode(led, OUTPUT);
 Serial.begin(9600);
}


void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);

if (sensorValue >=200){
Serial.println(sensorValue);
    digitalWrite(led, HIGH);
  }
  else {
Serial.println(sensorValue);
    digitalWrite(led, LOW);
  }
 
delay(500);
}

What does this sketch do?
Well, it measures level of the carbon monoxide in the air and turns the LED on when it reaches 200 or above. You can change it to what ever level you want and add more things to control with this sensor.

Things you need:
  • 1x MQ-7 Carbon Monoxide Sensor.
  • 1x Arduino board (in this case I've used Arduino Nano).
  • 1x LED.
  • 1x 10k Ohm resistor (just to make the LED a bit dimmer).
  • Few jumper wires.
Note:
This sketch gets readings twice a second if you want more then lower the number "delay(500);"
 according to your needs.

I hope this helps you. Thanks for reading. :)

arduino mq-7 sketch. mq-7 arduino. arduino mq 7. mq 7 arduino. carbon monoxide sensor arduino. co sensor arduino. mq 7 sensor arduino code. arduino carbon monoxide sensor. mq 7 arduino code. mq7 gas sensor arduino code. mq 7 gas sensor arduino. arduino mq-7. mq7 arduino code. mq-7 arduino code. mq-7 sensor arduino. mq7 sensor arduino. mq7 arduino. arduino co sensor.

No comments:

Post a Comment



Newly posted:
Reason why rich getting richer and poor getting poorer