This project aims to develop a Smart Farming system which provides the means of getting live data from farm such as temperature, humidity, soil moisture etc.
Smart technologies are the combination of hardware and software here the hardware components are like temperature & humidity sensor, PIR sensor and soil moisture sensor connected with an arduino where as arduino IDE is used as the software . Arduino receives status of different parameters from the sensors connected to it and send it over mobile phone via GSM module.
The screenshot provided above shows an example of message received by the user about the various parameters of the farm.
The system is equipped with a PIR sensor and buzzer which helps in detecting if any animal breaks into field and destroys the farm or if any theive enters the farm.
Arduino Uno
Arduino GSM shield V2
Soil moisture sensor
Temperature & Humidity sensor
PIR sensor
Buzzer
Jumper Wires
Arduino IDE
As shown in the above circuit diagram different sensors have to be connected with the arduino using jumper wires.
#include <dht.h> |
#include <SoftwareSerial.h> |
#define dht_apin A0 |
SoftwareSerial mySerial(7,8) |
const int sensor_pin = A1; |
int pin_out = 9; |
dht DHT; |
float h,t,m; |
int c=0; |
void setup() |
{ |
pinMode(2, INPUT); |
pinMode(3, OUTPUT); |
pinMode(9, OUTPUT); |
} |
void loop() |
{ |
if (digitalRead(2) == HIGH) |
{ |
digitalWrite(3, HIGH); |
delay(10000); |
digitalWrite(3, LOW); |
delay(100); |
} |
Serial.begin(9600); |
delay(1000); |
DHT.read11(dht_apin); |
float h=DHT.humidity; |
float t=DHT.temperature; |
delay(5000); |
Serial.begin(9600); |
float moisture_percentage; |
int sensor_analog; |
sensor_analog = analogRead(sensor_pin); |
moisture_percentage = ( 100 - ( (sensor_analog/1023.00) * 100 ) ); |
float m=moisture_percentage; |
delay(1000); |
if(m<40)//pump |
{ |
while(m>50) |
{ |
digitalWrite(pin_out,HIGH); |
sensor_analog = analogRead(sensor_pin); |
moisture_percentage = ( 100 - ( (sensor_analog/1023.00) * 100 ) ); |
m=moisture_percentage; |
delay(1000); |
} |
digitalWrite(pin_out,LOW); |
} |
if(c>=0) |
{ |
mySerial.begin(9600); |
delay(15000); |
Serial.begin(9600); |
delay(1000); |
Serial.print(" "); |
delay(1000); |
Serial.print("AT+CMGF=1 "); |
delay(1000); |
Serial.print("AT+CMGS="+XXXXXXXXXX" "); //replace X with 10 digit mobile number |
delay(1000); |
Serial.print((String)"update->"+(String)"Temprature="+t+(String)"Humidity="+h+(String)"Moisture="+m); |
delay(1000); |
Serial.write(0x1A); |
delay(1000); |
mySerial.println("AT+CMGF=1");//Sets the GSM Module in Text Mode |
delay(1000); |
mySerial.println("AT+CMGS="+XXXXXXXXXX" "); //replace X with 10 digit mobile number |
delay(1000); |
mySerial.println((String)"update->"+(String)"Temprature="+t+(String)"Humidity="+h+(String)"Moisture="+m);//message format |
mySerial.println(); |
delay(100); |
Serial.write(0x1A); |
delay(1000); |
c++; |
|
} |
|
|
} |