In this project I will create how to monitor temperature, humidity, and give alert if gas or smoke concentrate above normal.
It’s very useful to prevent fire or get poisoned if gas leaking in our room.
Using cayenne app for easier setup.
Step 1: Hardware and Software
In this step we need hardware and software below :
Arduino Mega 2560
Ethernet shield W5100
DHT22 Module
MQ2 sensor
Arduino IDE and cayenne
Step 3: Upload sketch
You need to change the value of cayenne token to yours and upload the code.
#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 }
Step 4: Setup cayenne dashboard
The next is, set up your cayenne dashboard like on the pictures attached and add widget for MQ2 gas sensor to virtual pin 2.
set the triger for MQ2 gas sensor, if the value above 500 then give you an alert to your mobile phone.
You’re almost done and can monitoring temperature, humidit, and also get alert if gas leaking
Leave a Reply
You must be logged in to post a comment.