Things used in this project

Hardware components:
Ardgen 101
Arduino 101 & Genuino 101
×1
SeeedStudio Grove Wireless Sensor Node Kit
×1
SeeedStudio Grove Air Quality Sensor
×1
Software apps and online services:
Ide web
Arduino IDE
Google Android Studio
Hand tools and fabrication machines:
3drag
3D Printer (generic)

Custom parts and enclosures

3D model
this is the 3D model for the device

Schematics

Arduino 101 with Grove Sensor
Arduino 101 with Grove Sensor
Img 20170727 225700 c39hvf2sfv

Code

Arduino BLE CodeArduino
Arduino BLE Code, this allows Android and other devices to connect to Air monitor via BLE
#include <CurieBLE.h>
const unsigned char ledPin = 13;              // On-board LED

BLEPeripheral blePeripheral;  
BLEService tempService("fef431b0-51e0-11e7-9598-0800200c9a67"); // Create custom BLE Service
BLEUnsignedIntCharacteristic  tempChar("fef431b0-51e0-11e7-9598-0800200c9a66", BLERead | BLENotify); // allows remote device to get notifications
int oldTemp = 0;          // last temperature reading from analog input
long previousMillis = 0;  // last time the temperature was checked, in ms

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);  // initialize the LED on pin 13 to indicate when a central is connected

  // initialize the BLE hardware
  BLE.begin();
  blePeripheral.setLocalName("Air Monitor");
  blePeripheral.setAdvertisedServiceUuid(tempService.uuid());    // add the service UUID
  blePeripheral.addAttribute(tempService);
  blePeripheral.addAttribute(tempChar);
  tempChar.setValue(oldTemp);               // initial value for this characteristic
//  BLE.advertise();

  Serial.println("BLE Central - LED control");

  blePeripheral.begin();
}

void loop() {
  // put your main code here, to run repeatedly:
  BLEDevice central = BLE.central();

  // if a central is connected to peripheral:
  if (central) {
    Serial.print("Connected to central: "); Serial.println(central.address());  // print the central's MAC address
    digitalWrite(ledPin, HIGH);  // turn on the LED to indicate the connection

    // check the temperature every 5000ms as long as the central is still connected:
    while (central.connected()) {
      long currentMillis = millis();
      if (currentMillis - previousMillis >= 1000) {
        previousMillis = currentMillis;
          updateAirQual();
      }
    }
    digitalWrite(ledPin, LOW);   // when the central disconnects, turn off the LED.
    Serial.print("Disconnected from central: "); Serial.println(central.address());
  }

}

void updateAirQual() {
  //Set quality from 0 to 255, with one to 100 being normal
  int sensorValue = analogRead(A0);
  int quality = map(sensorValue, 0, 1023, 0, 255);
  Serial.println(quality);
  tempChar.setValue(quality);
}
Android and Arduino code
Smart City Air Monitor uses air quality sensor attaching to the vehicle to monitor the air quality through out the city. Edit Add topics

Credits

Img 3538
Lin Ochoa
1 project • 3 followers
Queens College Computer Science Student
Contact
271430
Peter Ma
7 projects • 25 followers
I make great things
Contact
Received 10100468024407680 5gti6tolyd
Mica Wong
3 projects • 6 followers
Self taught 3D modeling and printing skills. Work at a grooming salon part time and delve into projects and hackathons as hobby.
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaBlog