Lalith AdhithyaSaran Raj
Published © GPL3+

Pollution Monitoring system: Project Kaatru

Project kaatru is a pollution monitoring system that measures co2 and sends the data to the cloud

IntermediateFull instructions providedOver 1 day202
Pollution Monitoring system: Project Kaatru

Things used in this project

Hardware components

Photon
Particle Photon
×1
mq135
×1
Antenna, SMB
Antenna, SMB
×1

Software apps and online services

Ubidots
Ubidots

Story

Read more

Custom parts and enclosures

enclosure

Schematics

kaatru schematics

Code

kaatru code.txt

C/C++
#include "MQ135.h"

#include "Ubidots.h"


#ifndef UBIDOTS_TOKEN
#define UBIDOTS_TOKEN "Your_Token"  // Put here your Ubidots TOKEN
#endif

Ubidots ubidots(UBIDOTS_TOKEN, UBI_HTTP);
int number = 0;
int state = 0;
MQ135 gasSensor = MQ135(0);
int led = D7;
float rzero = gasSensor.getRZero();
int ppm = gasSensor.getPPM();

// SETUP
void setup() {
Serial.begin(115200);
ubidots.setDebug(true);
}

// LOOP
void loop() { 

    float rzero = gasSensor.getRZero();
    digitalWrite(led,HIGH);             // turn the ledPin on
    delay(100);                         // stop the program for some time
    digitalWrite(led, LOW);             // turn the ledPin off
    delay(100);                         // stop the program for some time

    int co2_ppm = gasSensor.getPPM();
    int ppm = co2_ppm / 4;
    Spark.variable("ppm", &ppm, INT);                    
    
   ubidots.add("PPM", ppm);

   bool bufferSent = false;
   bufferSent = ubidots.send();  
	if (bufferSent) {
    // Do something if values were sent properly
    Serial.println("Values sent by the device");
  }
    delay(2000);
}

Credits

Lalith Adhithya
4 projects • 4 followers
Contact
Saran Raj
5 projects • 7 followers
Contact

Comments

Please log in or sign up to comment.