SB Components SPi-BOX User manual

SPi-BOX
MANUAL
Motion Activated Security Camera
WWW.SB-COMPONENTS.CO.U K
Motion Alarm Camera

Welcome
Congratulations on buying an SB Components SPi-Box.
We hope you find it to be the perfect complement to
your Raspberry Pi PIR and camera projects.
As a starting point for your project the accompanying
SPi-Box microSD card comes pre-loaded with some
Python scripts for configuring and running a simple
motion-capture security camera which will email the
captured images to an email address of your choice.
The case is designed to mount
the Raspberry Pi 2&3 along
with a Raspberry Pi camera
module and a PIR module; all the
elements you need to set up a
PIR-based security camera
system.
Safety Information
To reduce the risk of damage make sure your Raspberry
Pi is switched off when attaching components to the
non-consumer ports (i.e. GPIO or camera connectors).
Do not operate near water
Do not block any case ventilation openings

Do not install near any heat sources such as radiators
Protect the power cord from damage
Unplug during thunder storms or when switched off
for extended periods
What’s in the Box
Depending on the kit you purchased the contents will
vary (check the label on the box for what is included in
your kit). The standard starter kit includes:
1 x SPi-Box case
1 x PIR
3 x GPIO/PIR leads
1 x microSD card pre-loaded with SPi-Box scripts
Putting the SPi-Box Together
Install your Raspberry Pi
Both B+ and Pi 2/3/3B+ boards will fit the SPi-Box
case. Please be aware that the bottom half of the case
of the SPi-Box is shallower than other SB Components'
cases making the mounting procedure slightly different:
Line up the hdmi side of the Pi with the lower half of
the case and ease it into place at a slight angle
pressing down gently but firmly until the mounting
posts (highlighted in red) click into place in the Pi's
screw-mounting holes.

Press the other side of the board down into place
gently but firmly until the mounting posts on the GPIO
side of the board click into place in the board's
screw-mounting holes.
Mounting Camera & PIR
Attach the camera module to the top half of the case
using the screws provided to secure it into place
(note: the camera ribbon cable should point toward
the USB holes in the case).
Attach the PIR module to the top half of the case using
the screws provided to secure it into place (note: the
pins should be closest to the camera with the orange
trimming controls aligned with the two holes in the
side of the case).
Connect the camera module ribbon to the Pi. For the
correct method of connection please see this guide
from the Raspberry Pi Foundation

Connect the PIR to the Raspberry Pi using the included
GPIO leads:
a. PIR VCC pin connects to Pi pin 2 (5v)
b. PIR OUT pin connects to Pi pin 7 (GPIO4)
c. PIR GND pin connects to Pi pin 6 (Ground)
Illustration of the rear of the PIR
module connected to the Pi GPI
Snap the two case sections together
Getting the SPi-Box Started
To get up and running with the SPi-Box scripts
(pre-installed on the microSD card) you will first need
to connect your Pi to a monitor, keyboard and mouse.
Additionally you will need to connect the Pi to your
local network

Things you need to know:
1. If the Pi does not boot to the desktop how to start
the GUI
2. How to open a command window from the Raspbian
desktop
3.
How to edit files using nano (for a quick tutorial see:
How-To-Geek)
The default username and password for the basic
Raspbian install:
Login = pi
Password = raspberry
4.
Note: After the initial configuration you should be
able to run the SPi-Box "headless" without
connecting to a monitor, keyboard and mouse
Spi Box Software:
The SPi-Box software has been installed under
/home/pi/spibox:
File Name Description
spibox.conf
This is a config file that stores:
1. The subject line of your email alerts
2. The email address to which your email alerts
should be sent
3. Whether the email routine should be sending
emails or not (by default this is set to NO)
spibox.py
When executed, this python script will start waiting for
the PIR to detect motion and then when motion is
detected will take a picture with the camera. All images
get saved to /home/pi/spibox/capture

File Name Description
spiboxmessenger.py
This python script runs at startup (via cron: enter
crontab –l in a command prompt to see the details) and
if the spibox.conf file has the send email flag set to YES it
will attempt to email all jpg files sitting in the capture
directory to the email address specified in the spibox.conf
file (see above). It then moves those files to the
capture/archive folder.
spiboxconfig.py
This python script will open a simple GUI allowing you to:
1. Change the contents of the spibox.conf file without
using a text editor.
2. Test that you have correctly configured your ssmtp
settings (see below)

Spi-box Setup
Firstly, download the 'spibox.tar.gz' file and extract to
'/home/pi' directory
Cut 'SPi-Box' and 'SPi-Box Config' icon from Spi-Box
folder and paste it on desktop
If 'SSMTP' and 'MPACK' is not installed (SSMTP is for
mail configuration and MPACK is used for sending
attachments), follow the commands
sudo apt-get install ssmtp
sudo apt-get install mpack
Edit SSMTP configuration file
sudo nano /etc/ssmtp/ssmtp.conf
1.
2.
3.
4.

Add the following configuration & save it
root=postmaster
mailhub=smtp.gmail.com:465
hostname=raspberrypi
AuthUser=user_name@gmail.com
AuthPass=user_password
FromLineOverride=YES
UseTLS=YES
Send a test mail
mpack –s “subject” file_path recipient@gmail.com
For Example :
mpack –s “test mail” /home/pi/image.png abc@gmail.com
Google will block your sign-in attempts. Check your
Mail Inbox and allow to less securing apps so that
Raspberry Pi can send emails
5.
6.
7.

x x x
Repeat process 6 for sending a test mail
Click 'SPi-Box Config' icon placed on desktop and
configure it
Tick on “turn on email”
Enter the subject
Enter the email recipient address
Click on “Test Email” for checking
configuration is correct
Press “save and quit”
Connect the Camera with connector and PIR sensor
output to 'GPIO 4' of Raspberry Pi
8.
9.
10.

xxx
Enable Camera in raspberry pi configuration and
restart the Pi.
Click on “SPi-Box” icon placed on Desktop, to run
the script and if motion is detected it will click an
image and mail it.
Spi-box Video
For capturing video, download the 'spibox_v.tar.gz'
file and extract to '/home/pi' directory and follow the
same instructions as above. Default it will record 5 sec
video only, user can change it
Install 'MP4Box' for converting h264 to mp4 file format
using command
sudo apt-get install -y gpac
After installation, reboot your Raspberry Pi
11.
12.
1.
2.
3.

Warranty
This SB Components product is warranted for the
period of twelve (12) months from the original date of
purchase, against defective materials and workmanship.
In the event that warranty service is required you
should return the product to the retailer from whom it
was purchased
About Us
SB Components is a specialist manufacturer of
protective cases for single board computers and
microcontroller boards. Our designers are experts in
producing robust, functional and elegant cases that
protect and augment technology platforms.
In addition to the standard products listed in this
catalogue SB Components will undertake bespoke case
projects. These can range from the addition of logos, or
changes in colour/material of existing cases to the
creation of completely bespoke engineered-from
scratch projects
For more information please contact us:
Tel: +44 2035140914
Email: enquiries@sb-components.co.uk
Table of contents