Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO and SIM900A Vape Smoke Detector with PM2.5 Sensor

View and Edit Project In Cirkit DesignerImage of Arduino UNO and SIM900A Vape Smoke Detector with PM2.5 Sensor

Circuit Documentation

Summary

This circuit is designed to detect vape smoke in a restroom using a PM2.5 Air Quality Sensor (PMS5003) and notify an adviser via a SIM900A GSM module. The PM2.5 sensor is connected to an Arduino UNO, which processes the sensor data. When vape smoke is detected, the Arduino uses the SIM900A module to send an SMS alert.

Component List

  1. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. SIM900A

    • Description: A GSM module used for sending SMS messages.
    • Pins: GND, DB9-3 (RXD), DB9-2 (TXD), 5V, 3VR, 5VR, 3VT, 5VT, VCC, Ring, RESTART, RESET, STATUS
  3. PM2.5 Air Quality Sensor and Breadboard Adapter Kit - PMS5003

    • Description: A sensor used to measure particulate matter (PM2.5) in the air.
    • Pins: VCC, GND, SET, RX, TX, RST
  4. Comment

    • Description: Placeholder for comments in the circuit design.
    • Pins: None

Wiring Details

Arduino UNO

SIM900A

PM2.5 Air Quality Sensor and Breadboard Adapter Kit - PMS5003

Code Documentation

/*
 * This Arduino sketch is designed to detect vape smoke in a restroom using a
 * PM2.5 Air Quality Sensor (PMS5003) and notify an adviser via a SIM900A
 * GSM module. The PM2.5 sensor is connected to the Arduino UNO, and the
 * SIM900A module is used to send an SMS alert when vape smoke is detected.
 */

#include <SoftwareSerial.h>

// Pin definitions
const int pmSensorTX = 10;
const int pmSensorRX = 11;
const int sim900TX = 7;
const int sim900RX = 8;

// Create software serial ports
SoftwareSerial pmSerial(pmSensorRX, pmSensorTX); // RX, TX for PM2.5 sensor
SoftwareSerial sim900Serial(sim900RX, sim900TX); // RX, TX for SIM900A

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  pmSerial.begin(9600);
  sim900Serial.begin(9600);

  // Initialize SIM900A
  sim900Serial.println("AT");
  delay(1000);
  sim900Serial.println("AT+CMGF=1"); // Set SMS to text mode
  delay(1000);
}

void loop() {
  // Read data from PM2.5 sensor
  if (pmSerial.available()) {
    int pmData = pmSerial.read();
    Serial.print("PM2.5 Data: ");
    Serial.println(pmData);

    // Check if vape smoke is detected (example threshold)
    if (pmData > 100) { // Adjust threshold as needed
      sendSMS();
    }
  }
  delay(1000); // Delay for stability
}

void sendSMS() {
  sim900Serial.println("AT+CMGS=\"+1234567890\""); // Replace with adviser's number
  delay(1000);
  sim900Serial.print("Vape smoke detected in the restroom.");
  delay(1000);
  sim900Serial.write(26); // ASCII code for CTRL+Z to send SMS
  delay(1000);
}

This code initializes the PM2.5 sensor and the SIM900A GSM module. It continuously reads data from the PM2.5 sensor and checks if the particulate matter level exceeds a predefined threshold. If vape smoke is detected, it sends an SMS alert to the adviser's phone number.