Sinchan0009
Published © GPL3+

Gas, Smoke, Temperature and Humidity With Cayenne

In this project I will create how to monitor temperature, humidity, and give alert if gas or smoke concentrate above normal.

BeginnerShowcase (no instructions)1 hour2,348
Gas, Smoke, Temperature and Humidity With Cayenne

Things used in this project

Hardware components

Arduino Mega 2560 & Genuino Mega 2560
Arduino Mega 2560 & Genuino Mega 2560
×1
w5100 ethernet shield
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
MQ2 Gas Sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE
Cayenne
myDevices Cayenne

Story

Read more

Schematics

MQ CIRCUIT.JPG

Code

MQ2.ino

C/C++
#include "CayenneEthernet.h"
#include "DHT.h"

#define DHTPIN 22
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

char token[] = ""; //fill with your token

const int MQ2 = A0;

void setup()
{
  Serial.begin(115200);
  Cayenne.begin(token);
  dht.begin();
}

void loop()
{
  Cayenne.run();
}

CAYENNE_OUT(V0)
{
  float t = dht.readTemperature();
  Cayenne.virtualWrite(V0, t); //virtual pin
}

CAYENNE_OUT(V1)
{
  float h = dht.readHumidity();
  Cayenne.virtualWrite(V1, h); //virtual pin
}

CAYENNE_OUT(V2) {
    Cayenne.virtualWrite(V2, MQ2);
}

Credits

Sinchan0009

Sinchan0009

5 projects • 3 followers

Comments