Thursday, November 19, 2015

Arduino board in India


It’s my blog in which we are going to use a gas alarm. In this system when pollution is detect user got a message.

arduino-board-in-india

Step 1: Materials Required

(2) GSM shield.
(3) Jumper Cables
(4) 10K Resistor
(5) Breadboard
(6) MQ 135 gas sensor

Step 2: How to make connection between GSM shield and Arduino:-

Firstly we have to connect the transmitter part of GSM module to the pin 2 of arduino and receiver part and make both part ground.and don’t forget to give the power to the GSM shield with a 12V when our device is active.


Step 3: Making Connections between sensor and Arduino:-

Make connections and Treat the Side of Sensor With"Mq135" Written As To and choose analog pin A0.

arduino-board-in-india


Step 4: The Time of test:-

Firstly we will run code attached so that we can see readings of sensor in normal and polluted environment on serial monitor.

int mqx_analogPin = A0; // connected to the output pin of MQ-X

void setup(){
  Serial.begin(9600); // open serial at 9600 bps
}

void loop()
{
  // give ample warmup time for readings to stabilize

  int mqx_value = analogRead(mqx_analogPin);
  Serial.println(mqx_value);

  delay(100); //Just here to slow down the output.
}



Step 5: Final testing

1.    Use the noted values to edit the final code attached and to change the cellphone number in code and then write the code in arduino.
2.    Open serial monitor and wait
3.    serial monitor will show "status OK" and soon will send sms to the cellphone.

 #include "SIM900.h"
#include <SoftwareSerial.h>

//#include "inetGSM.h"


#include "sms.h"
SMSGSM sms;



int numdata;
int value;
boolean started=false;
char smsbuffer[160];
char n[20];
int PIN = A0;
int sensor = 450;

int LED1 = 11;

void setup()
{
 pinMode(LED1, OUTPUT);
  pinMode (PIN,INPUT);
  value = analogRead (PIN);
  Serial.begin(9600);
  Serial.println(value);
  Serial.println("GSM Shield testing.");

 if (value > sensor){
    digitalWrite(LED1, HIGH);
 }
 
  if (gsm.begin(2400)){
    Serial.println("\nstatus=READY");
    started=true; 
  }
  else Serial.println("\nstatus=IDLE");
  if (value > sensor){
    digitalWrite(LED1, HIGH);
  
   
   
    (sms.SendSMS("+919461022454", "RJ27 CB 3**9 Pollution Level Exceeding , Attention Required "));
      Serial.println("\nSMS sent OK");
  }

};


void loop()
{
  if(started){
   
    if(gsm.readSMS(smsbuffer, 160, n, 20))
    {
      Serial.println(n);
      Serial.println(smsbuffer);
    }
   
   
  }
};











No comments:

Post a Comment