Arduino Carbon Monoxide detector Alarm

Hello world! This was my very first arduino project, a Arduino Carbon Monoxide detector.
It’s a simple arduino gas alarm that can turn of you central heating for example by using a relay.

!NOTE! I tested this Arduino Carbon Monoxide detector with a lighter as you can see in the video.
You should fully test your device before installing it in your home.
You can add any sensor that you like and turn of any device you like.
I advise to use a quality sensor, that you know for sure will detect Carbon monoxide.
My device is just a prototype to show you how to build it.
I used the MQ9 sensor ordered from china to build this Arduino Carbon Monoxide detector.

Parts List:
Arduino UNO
Buzzer
Keyes 3 color RGB Ky-016
mq9 Carbon Monoxide Sensor or other.
1 Channel relay Ky-019
Jumper Wires.

Schematic:
Arduino Carbon Monoxide detector

code:

//Author: Danny van den Brande
//ArduinoSensors.nl
int relay = 10; // relay turns trigger signal - active high;
int buzzer = 8 ;// pin for buzzer alarm
const int analogInPin = A0;  // Analoge Input 
const int ledPin = 13; // RED LED
const int ledPin2 = 12; // BLUE LED 
const int ledPin3 = 11; // GREEN LED

int sensorValue = 0;        

void setup() {
  
  Serial.begin(9600); 
  pinMode(ledPin, OUTPUT);      // zet de digitale pin als output
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode (buzzer, OUTPUT) ;    
  pinMode (relay, OUTPUT); 
}

void loop() {
  
  sensorValue = analogRead(analogInPin);            
  // bepaal wanneer alarm afgaat
  if (sensorValue >= 100)
  {
    digitalWrite(ledPin, HIGH);  
    digitalWrite(ledPin3, LOW);  
    digitalWrite (buzzer, HIGH) ;// buzz 
    delay(50);
    digitalWrite (buzzer, LOW) ;
    delay(50);
    digitalWrite (buzzer, HIGH) ;    
    delay(50);
    digitalWrite (buzzer, LOW) ;
    delay(50);
    digitalWrite (buzzer, HIGH) ;        
    delay(600);
    digitalWrite (buzzer, LOW) ;
    delay(600);
    digitalWrite (buzzer, HIGH) ;    
    delay(50);
    digitalWrite (buzzer, LOW) ;
    delay(50);
    digitalWrite (buzzer, HIGH) ;    
    delay(50);
    digitalWrite (buzzer, LOW) ;
    delay(50);
    digitalWrite (buzzer, HIGH) ;    
    delay(300);
    digitalWrite (buzzer, LOW) ;
    delay(300);
    digitalWrite (buzzer, HIGH) ;    
    delay(50);
    digitalWrite (buzzer, LOW) ;
    delay(50);
    digitalWrite (buzzer, HIGH) ;    
    delay(50);
    digitalWrite (buzzer, LOW) ;
    delay(50);
    digitalWrite (buzzer, HIGH) ;
    delay(50);
    digitalWrite (buzzer, LOW) ;
    delay(50);
    

    digitalWrite (relay, LOW); 
  

  }
  else
  {
    digitalWrite(ledPin3, HIGH);    
    digitalWrite(ledPin, LOW);        
    digitalWrite (buzzer, LOW) ;
    digitalWrite (relay, HIGH); // relay conduction;
  }

 

  
  Serial.print("sensor = " );                       
  Serial.println(sensorValue);     

  
  
  delay(10);                     
}

Buy sensors here: http://arduinosensors.nl

Danny van den Brande

http://www.arduinosensors.nl

Programmer, Game Designer, 3D Designer, Web Designer, Graphic Designer. Jup this website looks crappy.. :) But enjoy the projects! Everything you need is here.

Leave a Reply

Your email address will not be published. Required fields are marked *