Arduino Powered Gas monitoring project

  I have done this Gas sensor monitoring project on Fiverr for a client. The purpose of the project will be clear once you check the Flowchart below: 

Now check all the details of the project I have made below:

All the flowcharts and circuit diagrams with graphical view are available in every formats.
If you need it, I'll give you through Gmail. Just comment on this post!

Component list:

1. MQ-2 Gas/Smoke sensor
2. DFROBOT Solar management circuit 
3. Solar panel 5V
4. Li-ion battery 3.7V
5. 3 5V relay modules (For main power, it will be different / more apmpier consumer than others. Will run on solar power)
6. Windows opening mechanism (Will run on solar power. This system will be made separately while assembling)
7. The AC Supply (Note: While assembling, with 12V fan, no ac supply will be provided, THe fan would run on 12V solar power supply)
6. Arduino Nano
7. Alert Siren / buzzer
8. Alert RED led diode.

In case if power consumption crosses the limit, you might need to use two solar panels and power circuit together. 
If you need product links, you can tell me via inbox.

Code:

#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 3
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

float gasDetectionSensitivity = 47;
int gasSensorPin = A0;
float maxTmp = 24;

int flameSensorPin = 10;

int buzzerPin = 2,
    ledPin = 7;

int fanRelay = 4,
    powerCutRelay = 6,
    windowsOpenRelay = 5;

void setup() {
  Serial.begin(9600);
  pinMode(gasSensorPin, INPUT);
  sensors.begin();
  pinMode(flameSensorPin, INPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(fanRelay, OUTPUT);
  pinMode(powerCutRelay, OUTPUT);
  pinMode(windowsOpenRelay, OUTPUT);
}

boolean printingState = true;

void loop() {
  if (gasDetected() && getTmp() > maxTmp && flameDetected())
  {
    if (!printingState)
    {
      printingState = !printingState;
      giveAlert(HIGH);
      homeControl(LOW);
    }
  }
  else
  {
    if (printingState)
    {
      printingState = !printingState;
      Serial.println("Normal Mode!");
      giveAlert(LOW);
      homeControl(HIGH);
    }
  }
}

float getTmp()
{
  sensors.requestTemperatures();
  float tempC = sensors.getTempCByIndex(0);
  return (tempC);
}

boolean flameDetected()
{
  return (!digitalRead(flameSensorPin));
}

void giveAlert(int state)
{
  if (state)
  {
    Serial.println("Alarm and LED are turned on!");
  }
  digitalWrite(buzzerPin, state);
  digitalWrite(ledPin, state);
}

void homeControl(int state)
{
  if (!state)
  {
    Serial.println("Shutting down main power \n Windows opened \n Smoke remover fan turned on");
  }
  digitalWrite(fanRelay, !state);
  digitalWrite(powerCutRelay, state);
  digitalWrite(windowsOpenRelay, !state);
}

boolean gasDetected()
{
  int pin = gasSensorPin;
  float sensorMaxValue = gasDetectionSensitivity;
  boolean gasState = false;
  if (analogRead(pin) >= (sensorMaxValue * 10))
  {
    gasState = true;
  }
  else
  {
    gasState = false;
  }
  return gasState;
}


Project.rar file available here: https://drive.google.com/file/d/1bBolxOnxNpTCYvTzHLhtg7qfJzF5tz0g/view?usp=sharing






Comments

Popular posts from this blog

Husband's Affair with Step Daughter Ends in Grisly Murder (True Crime Documentary)