DIY Home Security System using Raspberry Pi

DIY Home Security System – Install and configure the door sensors application

In this step we look at the door-sensor software.

All the commands on this page are executed on the raspberry pi box. See previous page for tips to connect remotely using ssh.

In order to run java programs install the JDK

First, check if you have java pre-installed

java -version

my current output is

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) Client VM (build 25.0-b70, mixed mode)

If you get an error or you have an older version of java, install the java 8 JDK:

sudo apt-get install oracle-java8-jdk

Re-run the java -version command to verify the installation.

Download the doorsensors build

cd ~
wget http://teakdata.com/doorsensor/doorsensor-1.0.0-SNAPSHOT-bin.zip

Unzip the package

unzip doorsensor-1.0.0-SNAPSHOT-bin.zip

At this point you should see the folder doorsensor-1.0.0-SNAPSHOT

ls doorsensor-1.0.0-SNAPSHOT

The above command should list all the files in the new folder:

door.properties  door.sh  lib

Edit the configuration file door.properties, I am using the nano editor. After finished your changes, to save press CTRL-o and press enter to save to existing file. To exit press CTRL-x

cd ~/doorsensor-1.0.0-SNAPSHOT
nano door.properties

The main changes you should do in the door.properties file are related to your email configuration.

IMPORTANT: it is a good idea to not use your main email, you can create a test gmail account to use it with the device. As “email.to” you can use your real email to receive notifications.

The sample has preconfigured values for GMAIL accounts (smtp host, port).

#destination email to send the pictures
email.to=your_real_email@gmail.com
#sender email
email.from=your_test_email@gmail.com
#smtp server configuration
email.smtp.host=smtp.gmail.com
email.smtp.port=587
email.smtp.user=your_test_email
email.smtp.passwd=yourpassword

We are now ready to start the application.

cd ~/doorsensor-1.0.0-SNAPSHOT
sudo ./door.sh

The application is running and the logs are now displayed on the console. To close the application use CTRL-C

 

Next Page: DIY Home Security System – Final Assembly

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *