Bringing Digital Electronics More Closer To Daily Life: Arduino Based Security System

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

1

WHAT IS INSIDE?

Arduino Based Security


System

Bringing Digital
Electronics More
Closer to Daily Life

Vinayaka K. V.
Sugeesh B. S.
P.R.N. Amrata Bharathi P.U.
College, Hebri

Introduction, working etc.

Block Diagram

Codes

Arduino based Flood


Monitoring and Warning
System for Floating
Agriculture Field

Introduction, working etc.

Block Diagram

UML and Flowchart

10

Bibliography

11

Arduino based Security System:


Introduction:

Today, security is of most important concern for many enterprises and industries. While
many types of Security Systems are manufactured by various companies and available at
different prices in the market, they have their own limitations and drawbacks. This
Security System tries to overcome these drawbacks and limitations. At the core of this
Security System is Freeduino Leonardo, a clone of Arduino Leonardo. At the sensor part
stands Photo resistor (LDR) and at the communication level stands C#, .NET applications.

What is Arduino?
Arduino is an open-source electronics platform based on easy-to-use software and
hardware. Its intended for anyone making interactive projects.

Why Arduino?
Because at low cost, it is more efficient than many ICs. More than that, it is
programmable. You can program it in C/C++. You can write and upload the program to
board as many times as you wish. After programming, PC is not required to run program.
Just connect the board to external power supply and head on!

Why Arduino Leonardo?


During the programming it is needed to press a certain key on a certain event. Arduino
Leonardo is one of the Arduino boards to provide support for these kind of operations
by providing Keyboard and Mouse libraries.

How this Security System Works?


This Security System works on the basis of variation of current passing through LDR with
variation of amount of light falling on it. Any object/person is allowed to pass a region
between LDR and a light source. When the object passes through this region, the current
variation is recognized by the Arduino Leonardo and it instructs the 7-Segment object
counter circuit to increment the count by one and the PC to capture the photo of the
object passed. At PC, after capture of the photo of passed object takes place, the
automated C# program will attach count to the photo and based on user choice, upload
the numbered photo to Dropbox and/or send SMS to a number entered by the user.

What can be done in future versions?


Webcam can be replaced with High resolution and small wireless camera
C# program can be improved from console app to GUI app and can be enriched with
Exception Handling to achieve machine independency
A real time system software can be developed to automate the things
In SMS sending time efficiency can be achieved by using other service providers

Security System Block Network Diagram

Arduino C++ code for Security System Circuit


//Code by Vinayaka K V and Sugeesh B S
void setup()
{
pinMode(13,OUTPUT);
}
void loop()
{
unsigned short int i = 0;
//Sense light falling on LDR
while(analogRead(A0)<200)
{
//While light is not falling on LDR
for(; i<1 ; i++)
{
//Press F2 key once in order to take photo
Keyboard.press(KEY_F2);
Keyboard.releaseAll();
}
//Send HIGH signal to counter to increase the count by one
digitalWrite(13,HIGH);
delay(10);
}
//After the object is passed, keep the counter input LOW
digitalWrite(13,LOW);
}

Simplified version of ASP Web Interface


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Code.cs" Inherits="Security_System" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>App Launcher</title>
<!Include Necessary Scripts and Stylesheets-->
</head>
<body>
<h1>Security System App Launcher </h1>
<br/><br/><br/><br/><br /><br />
<div id="timer"><% =getTime()%></div>
<br/><br/>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager2" runat="server" EnablePageMethods="true"/>
<button class="command-button primary" onclick="Runfile(0)" id="start_app_0">
<i class="icon-code on-left"></i>
Run C# Code
<small>Start Code to Number Images And Send SMS</small>
</button>
<br /><br />
<button class="command-button warning" onclick="Runfile(2)" id="start_app_2">
<i class="icon-camera on-left"></i>
Webcam App
<small>Starts CyberLink YouCam 5</small>
</button>
<br/><br/>
<button class="command-button success" onclick="Runfile(3)" id="start_app_3">
<i class="icon-folder on-left"></i>
Gallaries
<small>See Stored Images</small>
</button>
<br/><br/>
<button class="command-button info" onclick="Runfile(4)" id="start_app_4">
<i class="icon-image on-left"></i>
Gallaries App
<small>Launch Photos App To See Images</small>
</button>
<br/><br/>
<div id="counter_val"><% int count_val = CountFiles("E:/Trial/Capturex");%></div>
<div class="tile bg-darkGreen" id="count">
<span id="value"><% =count_val%></span>
<div class="tile-status">
<span class="name">Counter</span>
</div>
</div>
</form>
</body>
</html>

JS code and C# code


function Runfile(index)
{
switch (index)
{
case 0: PageMethods.OpenEXE(//Add path to run C# app);
break;
case 1: PageMethods.OpenEXE("C:/Program Files/WOWebcam/camclient.exe");
break;
case 2: PageMethods.OpenEXE("C:/Program Files/CyberLink/YouCam6/YouCam6.exe");
break;
case 3: PageMethods.OpenFolder("E:/Trial/Capturex");
break;
case 4: PageMethods.OpenEXE("C:/Photos.exe")
break;
}
}
//Refereh Content of HTML divs using jquery
function autoRefresh_div()
{
$("#timer").load("Security%20System%20Application.aspx #timer");
$("#counter_val").load("Security%20System%20Application.aspx #counter_val");
$("#value").load("Security%20System%20Application.aspx #value");
}
setInterval('autoRefresh_div()', 1);

using System;
using System.Diagnostics;
using System.IO;
using System.Web.Services;
public partial class Security_System : System.Web.UI.Page
{
[WebMethod]
public static void OpenEXE(String path)
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = @path;
Process.Start(psi);
}
[WebMethod]
public static void OpenFolder(String path)
{
Process.Start(@path);
}
public static int CountFiles(String path)
{
DirectoryInfo dir = new DirectoryInfo(@path);
int count = dir.GetFiles().Length;
return count;
}
public string getTime()
{
DateTime now = DateTime.Now;
return now.ToString("F");
}
}

C# Console App UML Diagram


Send_Msg
+phone_number : String
+txtMessage : String
+Send_Msg(phone_number : String , txtMessage : String)
+Send_SMS() : void

Number_Images
-folder_path : String
-folderx_path : String
+Number_Images() : void
+NumberImages(condition :bool) : void
+CountFiles() : int

Only get
accessor for
the datas is
public

get accessor
for data is
public
Constructer
to initialze
folders

Main() method partially


static void Main(string[] args)
{
//Declare and initialize variables
String secu_msg = " Someone has entered, please take care \n ";
//Ask about sending SMS
if (choice_msg.ToUpper() == "Y")
//Input the Mobile Number
//Ask about uploading to DropBox
bool upload = (choice_dropbox.ToUpper() == "Y");
Number_Images n = new Number_Images();
Send_Msg m = new Send_Msg(Mobile_Number,secu_msg);
n.NumberImages(upload);
do
{
int no_of_files_old = n.CountFiles();
Thread.Sleep(500); //Sleep for 500ms
int no_of_files_new = n.CountFiles();
if (no_of_files_old < no_of_files_new) //Check for any increment in number of files
{
n.NumberImages(upload);
if (choice_msg.ToUpper() == "Y")
{
m.Send_SMS();
Console.WriteLine("SMS : " + m.txtMessage + "had sent to " + m.phone_number);
}
}
} while (true); //Infinate Loop
}

Arduino based Flood Monitoring and Warning System for


Floating Agriculture Field

Introduction:
Today floods are more frequent than ever due to Urbanization and many other things.
Not only urban areas are affected, but also Rural Areas are affected by these floods.
Especially in Rural Areas which are Agriculture dependent, flood not only causes loss of
lives, but also loss of Agricultural crops, due to which the lacking of particular crops and
hence increase in their rate can also occur. Lives can be saved with provisionary actions
taken by the Government, but crops cannot. This circuit and materials helps to save the
crops during flood seasons.

What things this System Consists Of?


This System, at the core consists of a floatable field, in which crops are grown, made
basically of tharmacol. For communications between sensors in the field and Arduino, RF
transmitters and receivers are used. From the Arduino to SMS gateway and Camera App,
C# console application is linked.

How all the things work?


When the water level raises, as usual, lighter tharmacol platforms, having balloons
inserted inside them starts floating. And at the same time, the sensors will report the
water level and send the signal through RF transmitter. RF receiver connected to Arduino
will receive the signals and makes one particular pin to go high. C# console app will
recognize the changes in pin values and send SMS to inputted number. If the flood level
increases too seriously, other sensors do the same things and SMS is sent to the same
number indicating the critical situation and at the spot, photos are taken, which are
uploaded to Dropbox.

Future Ideas
Tharmacol can be replaced by floatable, weight withstanding and hydrophobic Nano
material.
RF transmitter can be increased its range to achieve longer distance.

C# program can be improved from console app to GUI app and can be enriched with
Exception Handling to achieve machine independency.
A real time system software can be developed to automate the things.
In SMS sending time efficiency can be achieved by using other service providers.

Flood Monitor Block Network Diagram

Flood Monitor UML Diagram and flowchart of Read_Serial.action()

10

Read_Serial
-port : String
-arduino : SerialPort
-msgr : Send_Msg
+Read_Serial(port : String , mob_no :
String)
+action() : void

Send_Msg
+phone_number : String
+Send_Mag(phone_number : String)
+Send_SMS(txtMessage : String) : void

Start
Is true?

Initialize pin A1
and pin A2 for
INPUT
Read value from Arduino Serial

Is reading of A1 is
not equal to 5V?

False

Is value = 0
True

True
Print -1 on serial

Send_SMS( Flood )

Is reading of A1
is equal to 5V?

False
Read value from Arduino Serial

True
Print 0 on serial
once

False

Is reading of A2
is equal to 5V?

False
Is value = 1

True
Send_SMS( Flood Overflow)

True

Print 1 on serial
once

Press F2 key once

Bibliography:

11

Built with
z
Visual Studio

Reference

VV

You might also like