Project showcase
Who Passed the Gas?

Who Passed the Gas?

Sniff-out the real tooter.

  • 1,310 views
  • 1 comment
  • 7 respects

Components and supplies

About this project

Ever get into the situation when you are with a group of people and someone passes the gas so everyone is trying to find out who did it but suddenly everyone else starts to find (false) hints that it was you when it really wasn't but for some reason they collectively agree it was you?

This device can save you. "Human exhaust" has significant amounts of methane, so you can detect "human exhaust" my the MQ-4 (methane) sensor. The methane sensor is pretty easy to hook-up and code. There is a VCC pin, GND pin, and analog and digital output. For this you will have to use the analog output.

Displaying text on the OLED screen is not to difficult either. The circuit is simple. Same with the code. On the first row, it will say whether someone released or not. On the second row, it will say "Gas level:". On the last level it will say the level of methane.

I do not have a circuit diagram maker so here it is:

MQ-4Sensor:

VCC - 5 or 3.3 V

GND - GND

AO - A6

OLED:

VCC - 5 or 3.3 V

GND - GND

SDA - SDA (on my board SDA is A4. Check the pinout for your board to see where SDA is)

SCL - SCL (on my board, it is A5, but this will for different boards)

NOTE:#define SCREEN_WIDTH and #define SCREEN_HEIGHT will differ based off what size your OLED is. For me, width is 128 pixels and height is 64 pixels.

How to use:

Pass the device around. If it says "fart", they you found the culprit. If many people are getting that message, it is either that they all released or the methane is still in the air. If this is the case, find who has the highest methane signature.

Code

MethaneC/C++
String stat;
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width
#define SCREEN_HEIGHT 64 // OLED display height


#define OLED_RESET     4 
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define NUMFLAKES     10

#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16
static const unsigned char PROGMEM logo_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000 };

void setup() {
  Serial.begin(9600);

  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { 
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }
  display.display();

  // Clear the buffer
  display.clearDisplay();
  display.display();

  pinMode(A0, INPUT);

}

void loop() {
  display.clearDisplay();

  int methane = analogRead(A6);
  if (methane >= 320){
   display.setCursor(0,0);             

    stat = "fart";
  }
  else{
    stat = "no fart";
  }

  display.setTextSize(2);             
  display.setTextColor(SSD1306_WHITE);       
  display.setCursor(0,0);
  display.println(stat);

  display.setTextSize(2); 
  display.setTextColor(SSD1306_WHITE); 
  display.println("Gas Lvl:  " + String(methane));

  display.display();
}

Schematics

methane__zRx3vsHEJj.png
Methane  zrx3vshejj

Comments

Similar projects you might like

Hazardous Gas Detector with LED Indication

Project showcase by Patel Darshil

  • 4,477 views
  • 2 comments
  • 11 respects

How to Connect MQ2 Gas Sensor to Arduino

by Junez Riyaz

  • 23,455 views
  • 12 comments
  • 8 respects

Arduino And MQ2 Gas Sensor

Project showcase by Mahamudul Karim Khondaker

  • 17,370 views
  • 9 comments
  • 20 respects

Smart Fire and Flammable Gas Safety Valve

Project in progress by Ashwini kumar sinha

  • 1,227 views
  • 0 comments
  • 2 respects

Smoke Detection using MQ-2 Gas Sensor

by Aritro Mukherjee

  • 348,483 views
  • 69 comments
  • 213 respects
Add projectSign up / Login