Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Dhairya Parikh
Published © LGPL

Ubitdots Powered Monitoring System

Shows how to use the Ubidots platform with the particle board by monitoring the temperature humidity and air quality of a room!

BeginnerFull instructions provided3 hours1,314
Ubitdots Powered Monitoring System

Things used in this project

Hardware components

Photon
Particle Photon
×1
Grove - Air quality sensor v1.3
Seeed Studio Grove - Air quality sensor v1.3
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Relay Module (Generic)
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1

Software apps and online services

Ubidots
Ubidots
Particle Build Web IDE
Particle Build Web IDE

Story

Read more

Schematics

The project schematic

Code

The Particle Code

C/C++
The code for this tutorial
// This #include statement was automatically added by the Particle IDE.
#include <Ubidots.h>
// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_DHT.h>
// This #include statement was automatically added by the Particle IDE.
#include "Adafruit_DHT/Adafruit_DHT.h"
#include "MQ135.h"
// DHT parameters
#define DHTPIN 2
#define DHTTYPE DHT11

int number = 0;
int state = 0;
MQ135 gasSensor = MQ135(0);
float rzero = gasSensor.getRZero();
int ppm = gasSensor.getPPM();

// Variables
int temperature;
int humidity;

// DHT sensor
DHT dht(DHTPIN, DHTTYPE);

void setup() 
{
    
    // Start DHT sensor
    dht.begin();
  
}

void loop() 
{
    //get the temperature and humidity values
    temperature = dht.getTempCelcius();
    humidity = dht.getHumidity();
    String data = String(temperature);
    String data1 = String(humidity);
    //calculating the air quality parameters
    int co2_ppm = gasSensor.getPPM();
    int ppm = co2_ppm / 4;
   
    // Publish data on particle console
    Particle.publish("temperature",data);
    delay(2000);
    Particle.publish("humidity",data1);
    delay(2000);
     Spark.publish("co2_ppm", String(co2_ppm));
    delay(2000);
    Spark.publish("resistance", String(rzero));
    delay(2000);
    Spark.publish("ppm",String(ppm));
    delay(2000);
   
    
}

Credits

Dhairya Parikh

Dhairya Parikh

21 projects • 123 followers
Project Developer | IoT and Machine Learning Enthusiast | Open Source Enthusiast |

Comments