mirna-ayman Goto Github PK
Name: Mirna
Type: User
Bio: Ex-stemer'22 || SW engineer || Front-end engineer.
Name: Mirna
Type: User
Bio: Ex-stemer'22 || SW engineer || Front-end engineer.
One of the most alarming issues in modern cities is the air quality level, where air pollution has caused 120 deaths out of 100,000 per year based on a worldwide study (Green Car Congress, 2019). The World Health Organization emphasized that 97% of cities in low- and middle- income countries with more than 100 000 inhabitants do not meet World Health Organization (WHO) air quality guidelines. Due to poor air quality, it will increase potential health risks such as risk of stroke, heart disease, lung cancer, asthma and others as well (citation). Hence, there is a need to install an air quality monitoring system in cities to ensure the air is not contaminated. This can be done by installing sensors to monitor dust particles, carbon dioxide, carbon monoxide, nitrogen dioxide and sulfur dioxide levels and this information can be shared with the public through smartphones, where the smartphone app allows people to monitor real-time data of the current air quality level in the area. Hence, through these implementations, better quality of life can be achieved.
int redLed = 12; int greenLed = 8; int buzzer = 10; int smokeA0 = A0; // Your threshold value int sensorThres = 150; void setup() { pinMode(redLed, OUTPUT); pinMode(greenLed, OUTPUT); pinMode(buzzer, OUTPUT); pinMode(smokeA0, INPUT); Serial.begin(9600); } void loop() { int analogSensor = analogRead(smokeA0); Serial.print("Pin A0: "); Serial.println(analogSensor); // Checks if it has reached the threshold value if (analogSensor > sensorThres) { digitalWrite(redLed, HIGH); digitalWrite(greenLed, LOW); tone(buzzer, 3000, 300); } else { digitalWrite(redLed, LOW); digitalWrite(greenLed, HIGH); noTone(buzzer); } delay(100); }
#include "MQ135.h" #include <SoftwareSerial.h> #define DEBUG true SoftwareSerial esp8266(9,10); // This makes pin 9 of Arduino as RX pin and pin 10 of Arduino as the TX pin const int sensorPin= 0; int air_quality; #include <LiquidCrystal.h> LiquidCrystal lcd(12,11, 5, 4, 3, 2); void setup() { pinMode(8, OUTPUT); lcd.begin(16,2); lcd.setCursor (0,0); lcd.print ("REES52 "); lcd.setCursor (0,1); lcd.print ("Sensor Warming "); delay(1000); Serial.begin(9600); esp8266.begin(9600); // your esp's baud rate might be different sendData("AT+RST\r\n",2000,DEBUG); // reset module sendData("AT+CWMODE=2\r\n",1000,DEBUG); // configure as access point sendData("AT+CIFSR\r\n",1000,DEBUG); // get ip address sendData("AT+CIPMUair_quality=1\r\n",1000,DEBUG); // configure for multiple connections sendData("AT+CIPSERVER=1,80\r\n",1000,DEBUG); // turn on server on port 80 pinMode(sensorPin, INPUT); //Gas sensor will be an input to the arduino lcd.clear(); } void loop() { MQ135 gasSensor = MQ135(A0); float air_quality = gasSensor.getPPM(); if(esp8266.available()) // check if the esp is sending a message { if(esp8266.find("+IPD,")) { delay(1000); int connectionId = esp8266.read()-48; /* We are subtracting 48 from the output because the read() function returns the ASCII decimal value and the first decimal number which is 0 starts at 48*/ String webpage = "<h1>IOT Air Pollution Monitoring System</h1>"; webpage += "<p><h2>"; webpage+= " Air Quality is "; webpage+= air_quality; webpage+=" PPM"; webpage += "<p>"; if (air_quality<=1000) { webpage+= "Fresh Air"; } else if(air_quality<=2000 && air_quality>=1000) { webpage+= "Poor Air"; } else if (air_quality>=2000 ) { webpage+= "Danger! Move to Fresh Air"; } webpage += "</h2></p></body>"; String cipSend = "AT+CIPSEND="; cipSend += connectionId; cipSend += ","; cipSend +=webpage.length(); cipSend +="\r\n"; sendData(cipSend,1000,DEBUG); sendData(webpage,1000,DEBUG); cipSend = "AT+CIPSEND="; cipSend += connectionId; cipSend += ","; cipSend +=webpage.length(); cipSend +="\r\n"; String closeCommand = "AT+CIPCLOSE="; closeCommand+=connectionId; // append connection id closeCommand+="\r\n"; sendData(closeCommand,3000,DEBUG); } } lcd.setCursor (0, 0); lcd.print ("Air Quality is "); lcd.print (air_quality); lcd.print (" PPM "); lcd.setCursor (0,1); if (air_quality<=1000) { lcd.print("Fresh Air"); digitalWrite(8, LOW); } else if( air_quality>=1000 && air_quality<=2000 ) { lcd.print("Poor Air, Open Windows"); digitalWrite(8, HIGH ); } else if (air_quality>=2000 ) { lcd.print("Danger! Move to Fresh Air"); digitalWrite(8, HIGH); // turn the LED on } lcd.scrollDisplayLeft(); delay(1000); } String sendData(String command, const int timeout, boolean debug) { String response = ""; esp8266.print(command); // send the read character to the esp8266 long int time = millis(); while( (time+timeout) > millis()) { while(esp8266.available()) { // The esp has data so display its output to the serial window char c = esp8266.read(); // read the next character. response+=c; } } if(debug) { Serial.print(response); } return response; }
The website aims to inform and engage people, particularly citizen scientists, who can contribute significantly to heliophysics projects. The HBY includes two major solar eclipses over the Americas, the Sun's solar maximum, and the closest approach of NASA's Parker Solar Probe to the Sun.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.