Dear friends welcome back! Are you
interested in building
and do it yourself home security system
with an Arduino that can
inform you with an SMS to your cell phone if it detects motion inside your house?
If yes, keep watching! The parts needed for this project are these:
An Arduino Uno, the TinySine GSM shield
a PIR sensor, a DS3231 Real Time Clock module
some wires and an LED
if you need to debug your project. The cost of the project is very low.
You can build this project for less than
35 euros. You need
25 euros for the GSM shield, you need 1.5 euros for the PIR sensor
1.5 euros for the Real Time Clock,
and around 5 euros for the Arduino. You can find links for
all the parts of this project in the description of the video.
Let's now see how to connect all the parts together.
Before starting I encourage you to watch some of the previous videos of the channel.
I have prepared detailed tutorials on
the GSM shield
the PIR sensor and the DS3231 real time clock.
By watching these videos
you would have
a better understanding of all the parts and it will be
easier to build this project. First we connect the GSM shield to
Arduino Uno. Next we connect the real time clock.
Vcc goes to breadboard Vcc. Ground goes to breadboard Ground.
SDA goes to analog pin 4 on Arduino
which is now accessible via the GSM shield. Lastly
SCL goes to analog pin 5 of Arduino.
Let's now connect the PIR sensor. Vcc
the pin next to the diode goes to breadboard Vcc.
Ground goes to breadboard Ground.
And lastly the output pin, the middle one, goes to digital pin 7
of Arduino. Next we connect the breadboard Vcc
to Arduino 5V and the breadboard
ground to Arduino Ground. Next we connect the LED. The long leg
goes to digital pin 13 and the other one to Ground.
Now we are ready to power on Arduino.
At first the project connects to the GSM network. As you can see
the LEDs will start flashing here in a moment.
OK, here it is. At the same time the PIR sensor
initializes and that initialization process takes time as well.
Our project will be ready in about 30 seconds from power on.
Let's wait for a bit. The LED is flashing slowly
that means that we are connected to the GSM network.
Now if I place my hand in front of the PIR sensor,
the LED will go on, in order to visually see
the detection and it will send
an SMS to my cell phone along with the time
that the motion happened. Let's try it. OK.
The LED goes on, now we are going to receive
an SMS message, let's wait... OK here it is
As you can see motion detected at 11:35.
The LED will stay on for around one minute in order
not to send SMS messages all the time if
it detects the same motion over and over again. Now let's go to the computer
and see the software side of the project. In the code of the project we use two libraries
that need to be downloaded.
The first one can be downloaded directly
from the Arduino
IDE. I'm using the latest version the
Arduino
IDE which is 1.6 .5 You have to go
to Sketch -> Include Library-> Manage libraries
and search
for the DS3231 library. OK we search here
DS3231 and you have to download the Sodaq DS3231
library directly from Arduino IDE.
The other library that we have to use is the GSM shield library
that you can find the link for this library in the description of the video.
The code of the project is very simple. At first
we initialize the GSM shield. Then we read
the PIR pin all the time.  If the PIR pin goes HIGH
we read the time from the Real Time Clock and send an SMS to a predefined telephone number.
The we wait for a minute,  before reading the PIR pin
again. In order to set time to the Real Time clock,
we can use an example the comes with the library
in order to do that. We go to File->Examples
to Sodaq_DS3231 and we load the adjust
sketch.
In this line here we enter the date
Year, month, date, hour
minute, second, and weekday and we
upload it to our Arduino once.
Then the time is set and can be kept internally for many years with the embedded
battery of the module. As you can see the code of the project is very simple.
Overall I think it is a very easy to build  project and very useful
as well. With it you can protect your
house or a warehouse that you don't visit
very often please write your comments
about this project in the comment
section below
or share ideas on how to further impove it. If this is your first time here
I would love to have you subscribed
because we post Do It Yourself hardware
and software projects every Saturday. The main
focus of our channel is to make useful projects using low cost parts
acquiring useful electronics and
programing skills while
having fun so I hope that you liked the video
and I will see you next Saturday!
