Gonzalo RosalesTatiana CarbajalMartin Avila
Published © GPL3+

Vibrations VS C02

Made by Group 510 (Gonzalo Rosales, Tatiana Carbajal and Martin Avila)

IntermediateFull instructions provided6 hours720
Vibrations VS C02

Things used in this project

Hardware components

DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
Photon
Particle Photon
×1
SparkFun Solder-able Breadboard - Mini
SparkFun Solder-able Breadboard - Mini
×1
Jumper wires (generic)
Jumper wires (generic)
×1
RGB Diffused Common Cathode
RGB Diffused Common Cathode
×1
Andium MQ135
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 330 ohm
Resistor 330 ohm
×3
SparkFun Piezo Element
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Laser cutter (generic)
Laser cutter (generic)

Story

Read more

Custom parts and enclosures

Case Maker file

File created by case maker for cutting out enclosure using laser cutter.

Schematics

Schematic

Schematic for overall project

Fritzing File

Includes schematic and example for pcb wiring

Code

Code

C/C++
/ This #include statement was automatically added by the Particle IDE.


#include <MQ135.h>
#include <Adafruit_DHT.h>

#define DHTPIN 3    // the DHT pin
#define DHTTYPE DHT22		// DHT 22 (AM2302)
#define MQ135PIN A0  //the CO2 Sensor pin

MQ135 MQ135(MQ135PIN);

DHT dht(DHTPIN, DHTTYPE);

int vibe =  A2;


double hum = 0;
double temp = 0;
double ppm = 0;
 
int redPin = D1;
int greenPin = D2;
int bluePin = D0;
double sensorRead = 0;



void setup() {
    Serial.begin(9600);
    pinMode(vibe, INPUT) ;
    pinMode(DHTPIN, INPUT);
    Particle.variable("hum", hum);
    Particle.variable("temp", temp);
    Particle.variable("ppm", ppm);
    Particle.variable("sensorRead", sensorRead);
    pinMode(redPin, OUTPUT);
    pinMode(greenPin, OUTPUT);
    pinMode(bluePin, OUTPUT);  
}

void setColor(int red, int green, int blue)
{
  analogWrite(redPin, red);
  analogWrite(greenPin, green);
  analogWrite(bluePin, blue);  
}

void loop() {
    sensorRead = analogRead(vibe);
    
    temp = dht.getTempFarenheit();
    hum = dht.getHumidity();

    ppm = MQ135.getCorrectedPPM(temp, hum);
    
    if(ppm < 300){
        setColor(0, 255, 0);
    }else if (ppm < 500){
        setColor(0, 0, 255);
    }else{
        setColor(255, 0, 0);
    }
    
    Serial.println("temp: ");
    Serial.println(temp);
    Serial.println("hum: ");
    Serial.println(hum);
    Serial.println("ppm: ");
    Serial.println(ppm);
    Serial.println("sensorRead: ");
    Serial.println(sensorRead);
    delay(1000);
    
}

Credits

Gonzalo Rosales

Gonzalo Rosales

-1 projects • 1 follower
Tatiana Carbajal

Tatiana Carbajal

-1 projects • 1 follower
Martin Avila

Martin Avila

-1 projects • 1 follower

Comments