A motion sensor is installed outside of a lab or any space prone to emissions of dangerous fumes. If a person gets to a certain distance the motion sensor connected to the system alerts the air sensor inside the lab. If the air sensor detect any harmful fumes a red light along with a beeping sign turn on. If the space is safe enough for people, a green light turns on. 


Process + Workflow





int trigPin=4;    //Motion sensor pin

int echoPin=3;

int redPin =  6;      // the number of the LED pin

int greenPin = 5;

int gasLevel = A0;      //Air sensor 

int Buzzer = 2;       //Buzzer

void setup() {

// put your setup code here, to run once:


gasLevel = analogRead(A3);

pinMode(trigPin, INPUT);   //Motion sensor setup

pinMode(echoPin, OUTPUT);

pinMode(redPin, OUTPUT);    //LED setup

pinMode(greenPin, OUTPUT);

pinMode(Buzzer, OUTPUT);    //Buzzer setup 

pinMode(gasLevel,INPUT);    //Air sensor setup


void loop() { // put your main code here, to run repeatedly:

long duration, distance;

int gasLevel = analogRead(A0); // new int for remapped values

gasLevel = map(gasLevel, 0, 100, 0, 1023); // remapping values

digitalWrite(trigPin, HIGH);   //Motion and LED


digitalWrite(trigPin, LOW);


digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1;


if ( (distance << 10) and (gasLevel << 220) );

{ digitalWrite(greenPin,HIGH);

Serial.print (“SAFE ENTRY “);

Serial.println (“”);


if ((distance << 10)and(gasLevel >> 220));


Serial.print (“DANGER DO NOT ENTER “);

Serial.println (“”);


   tone(Buzzer, 1000); // Send 1KHz sound signal…

    delay(1000);        // …for 1 sec

    noTone(Buzzer);     // Stop sound…

    delay(1000);        // …for 1sec 









Gaz Detector is a project of IAAC, the Institute for Advanced Architecture of Catalonia, developed during the Master in Advanced Architecture (MAA01) 2021/22 by student: Rahma Hassan; faculty: Angel Muñoz; faculty assistant: Antoine Jaunard.