Monday, September 8, 2014

TEMPERATURE AND HUMIDITY MEASUREMENT BY DHT11 SENSOR


The following system measures the Temperature and Humidity and gives the data in the two forms, In section 7.2 it will display on the LCD display and In section 7.3 measured data will be sent to the given mobile number.
7.1. Interfacing Temperature and humidity sensor with Arduino
            Vcc pin of DHT11 sensor is connected to 5V pin of Arduino,DATA pin of sensor is connected to A0 of Arduino and Gnd pin of DHT11  is connected to Gnd pin of Arduino.
DHT11 Sensor
Arduino
Vcc
5V
DATA
A0
Gnd
Gnd

7.2. DHT11 sensor with LCD
7.2.1. Circuit diagram:
















7.2.2. Arduino program:
#include <dht.h>
#include <LiquidCrystal.h>
#define dht_dpin A0
LiquidCrystal lcd(12, 11, 2, 3, 4, 5);
dht DHT;

void setup(){
  Serial.begin(9600);
  lcd.begin(16,2);
}

void loop(){
  DHT.read11(dht_dpin);
  Serial.print("Current humidity = ");
  Serial.print(DHT.humidity);
  Serial.print("% ");
  Serial.print("temperature = ");
  Serial.print(DHT.temperature);
  Serial.println("C ");
  lcd.clear()
  lcd.print("Humidity: ");
  lcd.setCursor(0,1);
  lcd.print(DHT.humidity);
  lcd.print(" %");
  delay(1000);
  lcd.clear();
  lcd.print("Temperature:");
  lcd.setCursor(0,1);
  lcd.print(DHT.temperature);
  lcd.print(" C");
  delay(1000); 
}

7.2.3. Outputs of the system
















7.3. DHT11 sensor with GSM-SIM 900
7.3.1. Circuit Diagram:






7.3.2. Arduino Program:
#include <dht.h>
#define dht_dpin A1
dht DHT;

void setup()
{
                Serial.begin(9600);
           Serial.print(“\r”);
}
void loop()
{
           DHT.read11(dht_dpin);
           Serial.print("AT+CMGF=1\r");
           delay(1000);
           Serial.print("AT+CMGS=\"+919542081456\"\r"); //Number to which you want to send the SMS want to send the SMS
           delay(1000);
           Serial.print("Temperature: ");
           Serial.print(DHT.temperature); //The text of the message to be sent
           Serial.print(" C ");
           Serial.print("Humidity: ");
           Serial.print(DHT.humidity);
           Serial.print(" %");
           delay(1000);
           Serial.write(0x1A);
           delay(1000);

}



Let me know if you have any queries ?

Thursday, September 4, 2014

Soil Moisture Measurement System

The following system measures the Soil Moisture percentage and it will be notified by two ways. i.e In section 6.2 measured quantity will be displayed on the LCD display, and in 6.3 it is sent to the given mobile phone number as an SMS.
6.1. Interfacing soil moisture sensor with Arduino
            In order to receive the sensed data from the soil moisture sensor to arduino, power supply of 5V is provided from arduino by connecting Vcc of sensor to 5V of arduino and GND of sensor to GND of arduino. Readings are retrieved at analog pin of arduino by connecting A0 of soil moisture sensor to any analog pin of arduino. Those retrieved values are displayed via LCD display or sent as SMS using GSM-SIM 900.
Soil moisture sensor
Arduino
Vcc
5V
Gnd
Gnd
A0
A0
D0
NC
6.2. Soil moisture sensor with LCD
6.2.1. Circuit diagram:









6.2.2. Arduino program:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 2, 3, 4, 5);
int soil=0;
// the setup routine runs once when you press reset:
void setup()
{
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  lcd.begin(16,2);
}

// the loop routine runs over and over again forever:
void loop() {
  lcd.clear();
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  sensorValue = constrain(sensorValue, 485, 1023);
  // print out the value you read:
  //Serial.println(sensorValue);

  //map the value to a percentage
  soil = map(sensorValue, 485, 1023, 100, 0);

  // print out the soil water percentage you calculated:
  Serial.print(soil);
  Serial.println("%");
  lcd.print("Soil Moisture");
  lcd.setCursor(0, 1);
  lcd.print(soil);
  lcd.print("  %");

  delay(1000);        // delay in between reads for stability
}

6.2.3.  Output of the System                                            






6.3. Soil moisture sensor with GSM-SIM 900
6.3.1. Circuit diagram:










6.3.2. Arduino program:
int soil=0;

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  Serial1.begin(9600); //Baud rate of the GSM/GPRS Module
  Serial1.print("\r");
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  sensorValue = constrain(sensorValue, 485, 1023);
  // print out the value you read:
  //Serial.println(sensorValue);

  //map the value to a percentage
  soil = map(sensorValue, 485, 1023, 100, 0);

  // print out the soil water percentage you calculated:
  Serial.print(soil);
  Serial.println("%");


  delay(1000);        // delay in between reads for stability
  Serial1.print("AT+CMGF=1\r");
  delay(1000);
  Serial1.print("AT+CMGS=\"+919542081456\"\r"); //Number to which you want to  send the SMS
  delay(1000);
  Serial1.print(soil); //The text of the message to be sent
  Serial1.print("%");
  delay(1000);
  Serial1.write(0x1A);
  delay(20000);

}



Please Let me know if you have any queries?

Tuesday, September 2, 2014

Water Depth Measurement System by using Ultrasonic Sensor

The following system will measure the depth of the water and measured depth will be notified by two different ways. In section 5.2, depth will be displayed on the LCD display that is used and In section 5.3 depth will be sent to the given mobile number as a SMS.

5.1. Interfacing ultrasonic sensor with Arduino
Vcc pin of the Ultrasonic Sensor is connected to the 5V pin of Arduino, GND
pin is connected to the GND pin, Trig pin is connected to digital pin 8 of Arduino and Echo pin is connected to digital pin 7 of Arduino.
                Ultrasonic sensor
Arduino
Vcc
5V
Gnd
Gnd
Trig
pin 7
Echo
pin 8

5.2. Ultrasonic sensor with LCD
5.2.1 Circuit diagram:

           


5.2.2 Arduino Program:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int trig=7 ;
const int echo=8;

void setup()
{
                Serial.begin(9600);
                lcd.begin(16,2);
}

void loop()
{
                lcd.clear();
                long  timeDuration,cm;
                pinMode(trig,OUTPUT);
                digitalWrite(trig,LOW);
                delayMicroseconds(4);
                digitalWrite(trig,HIGH);
                delayMicroseconds(10);
                digitalWrite(trig,LOW);
                pinMode(echo, INPUT);
                timeDuration = pulseIn(echo, HIGH);
                cm= microTocms(timeDuration);  //conversion of microseconds to centimeters
                Serial.print(cm);
                Serial.print("cm");
                Serial.println();
                lcd.print(cm);
                lcd.print("  cm");
                 delay(1000);
}

long  microTocms(long  microseconds)
{
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / (29 * 2);
}


5.2.3. Ouput of the System




5.3. Ultrasonic sensor with GSM
Following system will use ultrasonic sensor to measure the water depth, then measured distance will be sent to given mobile number.            
 
5.3.1. Circuit diagram:






5.3.2. Arduino Program:
const int trig=7 ;
const int echo=8;

void setup()
{
Serial.begin(9600);
                 Serial1.begin(9600); //Baud rate of the GSM/GPRS Module
                 Serial1.print("\r");

}
void loop()
{

                long  timeDuration,cm;

                pinMode(trig,OUTPUT);
                digitalWrite(trig,LOW);
                delayMicroseconds(2);
                digitalWrite(trig,HIGH);
                delayMicroseconds(10);
                digitalWrite(trig,LOW);

                pinMode(echo, INPUT);
                timeDuration = pulseIn(echo, HIGH);

                cm= microTocms(timeDuration);

                Serial.print(cm);
                Serial.print("cm");
                Serial.println();
 
                //  delay(2000);

            Serial1.print("AT+CMGF=1\r");
            delay(1000);
            Serial1.print("AT+CMGS=\"+919542081456\"\r"); //Number to which you want to send the SMS
            delay(1000);
            Serial1.print(cm); //The text of the message to be sent
            Serial1.print("cm");
            delay(1000);
            Serial1.write(0x1A);
            delay(20000);
}

long  microTocms(long  microseconds)
{
return microseconds / (29 * 2);
}

5.3.3. Output of the system





 Please let me know if you have any quires?