Académique Documents
Professionnel Documents
Culture Documents
a building
Abstract
Reducing Carbon emissions is a growing issue these days. It is necessary to monitor
air quality and keep it under control for a better future and healthy living for all. Here we
propose an air quality monitoring system that allows us to monitor and check live air quality
in a particular building through IOT. System uses Co 2 sensors to sense presence of harmful
gases/compounds in the air and constantly transmit this data to microcontroller. Also system
keeps measuring air quality level and reports it to the online server over IOT. The sensors
interact with microcontroller which processes this data and transmits it over internet.
This allows authorities to monitor air pollution in/ out the building and take action
against it. Likewise the authorities can keep a watch on the noise pollution near schools,
hospitals and no honking areas, and if system detects air quality and noise issues it alerts
authorities so they can take measures to control the issue.
Block Diagram
Hardware Specifications:
Sound Sensors
Wi-Fi Modem
LCD Display
LEDs
Transformer
Resistors
Capacitors
Diodes
Software Specifications:
Arduino Compiler
MC Programming Language: C
Submitted by
B.Vikram Anand
BATCH B4:
Assistant Professor
Rajib Senapathi
Barun Kumar
Sangram Ku Patra
Satyajit Patra
/*
Arduino UART Demo Sketch. This Sketch is made for an Genuino 101 IoT
board with a Grove
UART WiFi module based on the popular ESP8266 IoT SoC to communicate
to the AllThingsTalk
IoT developer cloud.
The Grove UART WiFi module has firmware installed which includes the
ATT_IOT library. It
communicates through Serial1 of the Genuino 101 board.
Version 1.0 dd 26/12/2015
This sketch is an example sketch to deploy the Grove Air quality
sensor v1.3 (101020078) to the
AllThingsTalk IoT developer cloud.
### Instructions
1. Setup the Arduino hardware
- Use an Arduino Genuino 101 IoT board
- Connect the Arduino Grove shield, make sure the switch is set to
3.3V
- Connect USB cable to your computer
- Connect a Grove Air quality sensor v1.3 to pin A2 of the Arduino
shield
- Grove UART wifi to pin UART (D0,D1)
2. Add 'ATT_IOT_UART' library to your Arduino Environment
More info can be found at http://arduino.cc/en/Guide/Libraries
3. Fill in the missing strings (deviceId, clientId and clientKey) in
the keys.h file
4. Optionally, change sensor names, labels as appropiate
5. Upload the sketch
Note: for use of extra actuators, extend the callback function at
the end of the sketch
*/
#include "ATT_IOT_UART.h"
library
#include <SPI.h>
signed/unsigned long type
#include "keys.h"
// Keep all your personal account
information in a seperate file
#include "AirQuality2.h"
#include <Wire.h>
#include "rgb_lcd.h"
rgb_lcd lcd;
ATTDevice Device(&Serial1);
char httpServer[] = "api.smartliving.io";
Server host
char mqttServer[] = "broker.smartliving.io";
Address
// HTTP API
// MQTT Server
Initialize
Init
This line
LINE if
Serial.println("Starting sketch");
Serial1.begin(115200);
serial link for WiFi module
while(!Serial1);
// Init
while(!Device.StartWifi())
Serial.println("Retrying...");
while(!Device.Init(DEVICEID, CLIENTID, CLIENTKEY))
// If we
can't succeed to initialize and set the device credentials, there is
no point to continue
Serial.println("Retrying...");
while(!Device.Connect(httpServer))
// Connect
the device with the AllThingsTalk IOT developer cloud. No point to
continue if we can't succeed at this
Serial.println("Retrying");
Device.AddAsset(airId, "Air quality sensor v1.3", "air", false,
"{\"type\": \"integer\",\"minimum\":0,\"maximum\":1023}");
//
Create the sensor asset for your device
Device.AddAsset(textId, "Air quality", "label", false, "string");
delay(1000);
// Give the
WiFi some time to finish everything
while(!Device.Subscribe(mqttServer, callback))
// Make sure
that we can receive message from the AllThingsTalk IOT developer
cloud (MQTT). This stops the http connection
Serial.println("Retrying");
airqualitysensor.init(airId);
Serial.println("Air quality sensor v1.3 is ready for use!");
}
int sensorVal = -1;
initial value to -1
int evaluateVal = -1;
void loop()
{
// Set
{
Serial.print("Air quality: ");
Serial.print(sensorVal);
sensorVal = sensorRead;
Device.Send(String(sensorVal), airId);
// set the cursor to (0,0):
lcd.setCursor(0, 0);
lcd.print("Air quality: ");
// print from 0 to 9:
lcd.setCursor(13, 0);
lcd.print(sensorVal);
delay(500);
}
sensorRead = airqualitysensor.evaluate();
if (evaluateVal != sensorRead )
{
String text;
evaluateVal = sensorRead;
if(evaluateVal == 0)
{
text = "Good quality! :D";
digitalWrite(4, HIGH); //good airquality green LED on
digitalWrite(2, LOW); //Red LED off
}
else if(evaluateVal == 1)
{
text = "Low pollution";
digitalWrite(2, HIGH);
digitalWrite(4, HIGH);
}
else if(evaluateVal == 2)
{
text = "High pollution";
digitalWrite(2, HIGH);
digitalWrite(4, LOW);
}
else if(evaluateVal == 3)
{
text = "Huge pollution!!";
digitalWrite(2, HIGH);
digitalWrite(4, LOW);
}
Serial.println("0|"+text);
lcd.setCursor(0, 1);
lcd.print(text);
Device.Send(text, textId);
}
Device.Process();
delay(2000);
}
// Callback function: handles messages that were sent from the iot
platform to this device.
void callback(int pin, String& value)
{
Serial.print("Incoming data for: ");
// Display the value
that arrived from the AllThingsTalk IOT developer cloud.
Serial.print(pin);
Serial.print(", Air quality value: ");
Serial.println(value);
}