Professional Documents
Culture Documents
2016/2017
Conor Breen
X13316381
conor@breen.ie
Technical Report
Table of Contents
1 Executive Summary..................................................................................................... 6
2 Introduction ................................................................................................................ 7
3 Background & research............................................................................................... 8
Researched methods .................................................................................................. 8
Pin code entry ................................................................................................................. 9
RFID entry........................................................................................................................ 9
Smartphone entry ......................................................................................................... 10
Research conclusion ................................................................................................. 10
development of an application ................................................................................. 17
Recap 19
4 Aims........................................................................................................................... 20
5 Technologies ............................................................................................................. 21
Hardware....................................................................................................................... 21
Software ........................................................................................................................ 23
Frameworks/languages ................................................................................................. 23
Brief how the software will be used: ........................................................................ 23
6 Full Project Concept Breakdown............................................................................... 25
7 Structure ................................................................................................................... 26
8 System ....................................................................................................................... 27
Requirements ................................................................................................................ 27
Functional requirements............................................................................................... 27
Requirement 1 Registration ...................................................................................... 27
Requirement 2 Password Reset ................................................................................ 29
Requirement 3 Add Users ......................................................................................... 31
Requirement 4 Open device (message) .................................................................... 32
Requirement 5 Open device (key) ............................................................................ 34
Requirement 5 Get device status ............................................................................. 36
Requirement 6 Password Reset ................................................................................ 38
Non-Functional Requirements ...................................................................................... 40
Multi-platform support ............................................................................................. 40
User requirements .................................................................................................... 41
Availability requirement ........................................................................................... 41
Security requirement ................................................................................................ 42
Reliability requirement ............................................................................................. 42
Maintainability requirement..................................................................................... 42
Extendibility requirement ......................................................................................... 42
Reusability requirement ........................................................................................... 43
9 Design and Architecture ........................................................................................... 44
Implementation ............................................................................................................ 44
Web application implements ........................................................................................ 44
User account creation ............................................................................................... 45
Granting access to users ........................................................................................... 46
authenticate user ...................................................................................................... 47
mailer implementation ............................................................................................. 49
password reset system implementation .................................................................. 51
raspberry pi status update ........................................................................................ 53
Open system ................................................................................................................. 56
Raspberry pi image ................................................................................................... 58
10 Prototype creation ................................................................................................ 60
Door creation ................................................................................................................ 60
Device setup .................................................................................................................. 62
11 Graphical User Interface (GUI) Layout .................................................................. 64
Opensesamessage.com................................................................................................. 64
homepage ..................................................................................................................... 64
mobile device ............................................................................................................ 65
Sign in66
mobile device: ........................................................................................................... 66
Registrations ................................................................................................................. 67
User registration GUI ................................................................................................ 67
mobile device ............................................................................................................ 68
Add users....................................................................................................................... 68
68
mobile device ................................................................................................................ 68
Contact GUI ................................................................................................................... 69
mobile device: ........................................................................................................... 69
Telegram GUI ................................................................................................................ 70
Application GUI ......................................................................................................... 71
Web GUI .................................................................................................................... 71
12 Testing ................................................................................................................... 73
Overview ....................................................................................................................... 73
Unit Testing ................................................................................................................... 73
Customer testing ........................................................................................................... 80
13 Market research .................................................................................................... 85
Online survey ................................................................................................................ 85
Questions and results ............................................................................................... 85
Built using a ruby on rails web application to allow simple user integration with the
service, and intuitive account management. The popular messaging service telegram
which boasts high security and exemplary encryption as standard and the raspberry pi
to offer an easy to use, safe and affordable solution to smart home entry.
OpenSesamessage is a fully functioning smart home entry system for the future,
allowing for keyless entry into buildings, or containers with the use of a smartphone. Its
key features include:
With the use of the OpenSesamessage users can grant access to their house, building or
container from anywhere in the world via the internet. This negates the use if keys, RFID
cards and other forms of entry. All you need is an internet connection and the
permission of the owner. This service could benefit almost everyone. Home owners,
who regularly forget their key. Landlords who rent out their property are no longer
required to arrive with a key, the use case is scenarios are infinite
“open sesamessage brings consumer level home entry and home security to the modern
era”
With this system, users or home owners can create an account on the
OpenSesamessage web application, enter their phone number and establish themselves
them as the admin user. From there they can allow access to other simply by entering
their phone numbers on the dashboard. They can monitor who is coming and going
through the system and seamlessly add and remove users to their account granting and
revoking the privilege of home entry through the web application.
3 Background & research
The initial research for this project came late in December as the project I was
undergoing raised concerns for my project supervisor. I was building a front-end frame
work on a company’s pre-existing website, and it was becoming apparent that this
project was not meeting crucial marking scheme topics. So, after a meeting I decided to
create my own ruby on rails project, implement front end framework technologies into
it and implement an IOT aspect to better reflect my speciality.
My interest in the project became apparent when one night I forgot my key, and had to
ring and wake somebody up to let me in. realising a flaw with the system we have for
our home entry and the observation that regardless of whether I have a key or not I
always seem to have my phone with me I began to research possible solutions to my
problem
Researched methods
RFID entry
Keypad Entry
Fingerprint entry
Voice recognition entry
These systems had amazing benefits over conventional use of keys, but in my eyes, they
were all still flawed. Each time I researched a possible solution I found fault with it, and
further questioned how it could be improved upon. Firstly, I considered having a pin
entry system, one where a pin code would be established and distributed amongst
tenants.
using a pin code as an entry system seems a logical choice for entering a building
without a key or any physical means of entry. However, in recent times it has become a
growing concern that hackers could gain access to these systems by brute forcing their
way in by rapidly cycling through all code possibilities in minutes.
Provided the keypad on a system has the numbers 0 – 9, the possible combinations for a
4-pin code are 10 x 10 x 10 x 10 which is 10,000 possibilities. With modern technology,
today that would only be a few minutes of a brute force attack.
RFID entry
The second form of home entry I researched was RFID entry. This system has obvious
benefits. Including heightened security over pin entry. RFID entry allows for multiple
unique keys to be used and each having encrypted information meaning the chance of a
hacker gaining access to the system is greatly reduced over the previous case. However,
RFID entry is very expensive. According to Ireland leading supplier of RFID entry systems
the cost of a RFID entry system can upwards of one thousand euro. This proves too
expensive for the average home user at the consumer level. Considering that every time
a new user is needed to have access to the system a new RFID card or fob is required to
be purchased.
in recent years, a new system came onto the market form a company called August. This
system allows users to enter their homes using their smartphones. This seemed
promising, the ability to enter a home or office building using your smartphone was a
great idea. But further research revealed some major flaws in the system.
No android support
Substantial price point
Useless without internet connection
These flaws in the system proved too great a barrier for most consumers. The system is
only compatible with IOS users, meaning a substantial portion of the potential user base
is already alienated from the get-go. Another barrier is the fail safes in the system, or
lack thereof. If the system experiences a loss in internet connectivity the system is
rendered useless. Furthermore, the cost of almost 500 dollars seems too great for
average users.
Research conclusion
It became evident that the solution that I wanted was not available. Before I set out on
this project it is quite clear that there were no home entry solutions that accurately met
my requirements. So, I set myself to the task to create a smart home entry system that
would allow users simple but secure access to their homes, while providing cross
platform support and keeping the solution modular so that it would work in conjunction
with traditional methods of security. This was the starting point for my final year
project.
Django
.net
Ruby on Rails
I have experience with these three frameworks, and each framework offers certain
benefits to the project. I performed some research into which one would suit the
project the most.
Firstly, ruby on Rails. Ruby on rails is a web development framework designed to work
with the ruby programming language. Ruby is a pleasant language to write in and has a
huge active community contributing to its success. There is a plethora of gems or plugins
available for ruby developers to use that are open source and quick to implement. it
offers simple generation of scaffolds using the rails command line. This means that I
would be able to generate the MVC files needed and simple implementation of APIs
using rails’ powerful package system.
the second choose would be Django. Django is a high-level Python Web framework that
encourages rapid development and clean, pragmatic design. Built by experienced
developers, it takes care of much of the hassle of Web development, so you can focus
the third option is Microsoft's .net framework. Microsoft’s .net framework is not so
much a framework but rather a collection of application programming interfaces and
shared library code that can be used to develop applications. This means that you don’t
have to write the code from scratch. In the .net framework the shared libraries of code
are called the Framework class library, or FCL. Buts of code in the FCL can be shared and
accessed for use in programming a whole wide variety of applications.
For the purposes of this project I have decided to use the web framework Ruby on Rails
for its rapid content creation and extemporary package management system, ruby
gems.
With the framework for the web application chosen, I needed to research what use of
controller devices would best suit this project. from my research, I narrowed it down to
three possible devices.
NannoPC-T3
Raspberry pi
Asus tinker board
Each of these boards runs a variation of the Unix operating system, which was a
requirement for this project as I would be developing on mac os, this would mean less
teething problems down the line when new features and new packages needed to be
implemented. For this project to remain affordable for users I needed to pick a cost-
effective solution, but it also required adequate processing power and features to allow
devices to be attached to them easily and effectively.
The NannoPC-T3
NanoPC-T3 is a single-board computer developed by FriendlyArm. It houses Samsung’s
octa-core SoC clocked @1.4GHz, Mali 400 GPU and 1GB DDR3 RAM. It supports microSD
expansion, Wi-Fi, Bluetooth and an on-board microphone. It can run Android 5.1,
Debian, Ubuntu Core operating systems. It is equipped with 8 GB of storage and is
extensible via microSD card. It includes 4 USB 2.0 ports, HDMI (1080p support) and
Ethernet support. Other multimedia ports include LVDS, LCD, MIPI-DSI and the 3.5mm
audio Jack.
NanoPC-T3 CPU is clocked slightly higher than Raspberry Pi 3’s CPU but features the
same amount of RAM. One advantage it offers over the Pi 3 is that it comes with
an inbuilt storage of 8GB. Other than these things, both are pretty neck-to-neck with
each other.
Perhaps the newest entry in this list, Tinker Board is a single-board computer from Asus.
Along with a nice name, it also comes with some great specifications. On the hardware
side of things, it is equipped with a quad-core CPU (Cortex A17) clocked at 1.8 GHz, Mail-
T764 GPU, 2GB of RAM, 4 USB 2.0 ports and an HDMI port. The Tinker Board comes with
a custom OS named TinkerOS, which is based on Debian. The headline feature is the
support for 4K video playback for videos encoded with H.264 or H.265. It also
supports Wi-Fi and Bluetooth 4.
Tinker Board beats Raspberry Pi 3 by miles in benchmarks, thanks to its more powerful
processor and an extra gig of RAM. The Tinker Board brings support for 4K videos,
whereas Raspberry Pi 3 model B supports (only!) 1080p videos. It also brings support
for 192k/24bit audio playback support compared to Pi’s 48k/16bit. It consumes a
little more power than Pi, but that shouldn’t be much of a problem because it’s very
marginal. The Tinker Board is all good but is available only in the UK, as of now. If you’re
willing to shell out almost twice what you’d otherwise pay for Raspberry Pi, the Tinker
Board can be a great board to tinker around!
The Model B+ is the final revision of the original Raspberry Pi. It replaced the Model B in
July 2014 and was superseded by the Raspberry Pi 2 Model B in February 2015.
Compared to the Model B it has More GPIO. The GPIO header has grown to 40 pins,
while retaining the same pinout for the first 26 pins as the Model A and B. More USB.
We now have 4 USB 2.0 ports, compared to 2 on the Model B, and better hot plug and
overcurrent behavior. Micro SD. The old friction-fit SD card socket has been replaced
with a much nicer push-push micro SD version. Lower power consumption. By replacing
linear regulators with switching ones we’ve reduced power consumption by between
0.5W and 1W. Better audio. The audio circuit incorporates a dedicated low-noise power
supply. Neater form factor. We’ve aligned the USB connectors with the board edge,
moved composite video onto the 3.5mm jack, and added four squarely-placed mounting
holes.
In the end, I decided to go with the raspberry pi b+ model. this decision is mainly
because that is the device I have the most experience with, and its easy integration with
IOT sensor devices, wireless abilities with the use of a simple Wi-Fi dongle and the easy
SSH capabilities for wirelessly editing files on the machine. I have also grown
accustomed to the Raspian operating system, and am comfortable with developing on
it.
Cross platform
Non-intrusive
Available to everyone
Free to use
This is a tall order. Luckily the options for such a system are plentiful, however there was
no clear ‘best’ option. I had to decide whether to develop an application, use a pre-
existing multi-platform solution or find an application that ticked these boxed and
implement it in such a way as to have it perform the actions I required it to. My options
were as follows.
for a long time this was what I considered to be the best option. However, this would
require the development of an application that worked on most if not all the operating
systems currently being used by smartphones. Further research revealed that creating a
smartphone app that would work on all systems would prove difficult. It became
apparent that in order to have a truly cross platform application to handle the
requirements of the project I would have to develop multiple applications using multiple
languages. Something that would have gone way and beyond the scope, and time of this
project.
the next option was to use an IOT development tool for android application. Blynk is a
new platform that allows you to quickly build interfaces for controlling and monitoring
your hardware projects from your iOS and Android device. After downloading the Blynk
app, you can create a project dashboard and arrange buttons, sliders, graphs, and other
widgets onto the screen. Using the widgets, you can turn pins on and off or display data
from sensors.
Blynk was perfect for my purposes, except for one major flaw, the cost. Blynk is a paid
service. They do however offer a free service, but it would not have met my
requirements. To get the service I required would have cost me at minimum $199
dollars a month or $1990 a year, and for a college project of this scale this proved not
feasible for my purposes.
Finally, after extensive research I found the solution. A messenger service called
Telegram.
Telegram is a messaging app with a focus on speed and security, it’s super-fast, simple
and free. You can use Telegram on all your devices at the same time — your messages
sync seamlessly across any number of your phones, tablets or computers.
With Telegram, you can send messages, photos, videos and files of any type (doc, zip,
mp3, etc.), as well as create groups for up to 5000 people or channels for broadcasting
to unlimited audiences. You can write to your phone contacts and find people by
their usernames. As a result, Telegram is like SMS and email combined — and can take
care of all your personal or business messaging needs
telegram is the perfect service for this project. it is widely used across all popular
platforms. There would be no learning curve for this application as everyone has used a
messenger service before. Telegram has an open api allowing for development on the
raspberry pi, python support and ruby support. This would be the final piece of the
puzzle.
Recap
Recap of what options I picked for my project from the research conducted:
Chosen web framework: Ruby on Rails
Chosen IOT device: Raspberry Pi B+
Chosen Application: Telegram
This device will tackle and hopefilly improve upon the devices present today. With Open
Sesamessage I hope to allow for a cost effective home entry system available to
everyone
Raspberry Pi Model B+
o The raspberry pi b+ will be used as a controller station for this project's
main functions. It will be responsible for opening and closing the lock
o Responsible for taking pictures of who is entering the building
o Filtering out unknown users who try to gain disallowed access
Webcam
o The webcam will be used to take photos on request of the admin user.
This will allow them to see who is coming and going through their
property. It will also alert them the malicious intent.
o Model used: Microsoft LifeCam Cinema 720p
Frameworks/languages
List of frameworks/programming languages used:
Ruby on Rails
Ruby
Python
Lua
HTML
CSS
Tg: telegram API
PostgreSQL
Ruby on rails
Ruby on Rails will be used for the following:
Lua
Lua is a lightweight scripting language, I will use it for is the following:
Interpretation of messages: I will use Lua to read the messages sent by users
and perform actions based on their commands. Such as triggering the python
code to open the door upon request
Get commands: to get commands from the web application adding new users to
the approved list, or to remove users from the list
Take photos: to trigger python program to take photo, then retrieve the image
from the file directory and send it back to the user
HTML/CSS/Bootstrap
What I will use it for is the following:
Styling of the web application
Telegram
What I will use it for is the following:
Communication: this cross-platform messenger service will act as the basis for
all communication between the web application and the IOT device, as well as
users and the raspberry pi
The entire concept of the project is to create a home entry system that it is:
Security focused
Easy to setup
Easy to use
Intuitive
Works in conjunction with traditional methods
Unobtrusive
Cost effective
The requirements specification will outline several variables that the user will achieve
while using the system, they are as followed:
1. The user will be aware of the workings of the system, and how to control the
device within 10 minutes of introduction
2. The user will understand the simple commands
3. The user will be able to add, update and remove allowed people on their device
4. New users will share the first two requirements
Functional requirements
Requirement 1 Registration
This is the registration process for the application
Description & Priority
This process however trivial is essential to access the features and functionality
Use Case
Description
This use case allows the user to create an account entering an email, password, phone
number and their name
Flow Description
Precondition
This use case is called into action when the user enters the registration screen. From
their they enter their details and submit them
Activation
This use case starts when the user registers with the web application
Main flow
Alternate flow
1. Administration requests user information
Exceptional flow
1. The system encounters an error
Termination
The system terminates when the registration process is complete
Post condition
The system goes into a wait state
Flow Description
Precondition
The system is initialized when the user opens the password reset view
Activation
This use case starts when a requests a password change
Main flow
1. The system accepts the users email information
2. The user requests an email reset link
3. The system sends a password reset link
4. The user proceeds to the password reset view
5. The system accepts the information and updates the database
Alternate flow
1. The system cannot find user email
Termination
The system updates the database
Scope
The scope of this use case is to allow the user to add users
Description
This use case allows for a user to add secondary users to their account, these names and
numbers will be able to access the device
Use Case Diagram
Flow Description
Precondition
The system is initialized when the user enters their user dashboard view
Activation
This use case is activated when new information is entered into the fields
Alternate flow
4. The system encounters an error
Termination
The system updates the database and device
Post condition
The system goes into a wait state
Use Case
The user message the device using a popular messaging application
Scope
The scope of this use case is to allow the trigger the device actuators via smartphone
Description
This use case allows the user to message the device and request it open
Flow Description
Precondition
The precondition is created when the user has the number for the device
Activation
The use case is activated when the device is messaged
Main flow
1. The user sends a message to the device
2. The device interprets the message
3. The system activates the actuator
4. The device goes into a wait state
Alternate flow
1. The system interprets the message
Termination
Post condition
The system goes into a wait state
Use Case
The user inserts the USB key into the device trigger the actuator
Scope
The scope of this use case is to allow the trigger the device actuators via USB
Description
This use case allows the user insert USB the device and request it open
Use Case Diagram
Precondition
The precondition is when the device is on
Activation
The use case is activated when the USB is inserted
Main flow
5. The user enters the USB
6. The device triggers the open program
7. The device activates the actuator
8. The device goes into a wait state
Alternate flow
5. The system cannot interpret the command
Termination
The system opens the device
Post condition
Use Case
The user requests information via message
Scope
The scope of this use case is to get status information
Description
The user messages the device requesting information such as CPU usage, ram, and core
temperatures
Precondition
The precondition is when the device is on
Activation
The use case is activated when the user requests device status
Main flow
1. The user requests status readings
2. The device returns sensor readings
3. The device goes into a wait state
Alternate flow
1. The request is not sent by an approved number
Termination
The system returns information
Post condition
The system goes into a wait state
Use Case
The user will request an image, the system will execute the image.py program to take a
picture, save the image and the Lua will respond to the user with the image.
Scope
The scope of this use case is to allow the user to request an image, have the device take
it and respond with a multi media message containing the captured image
Description
This use case describes the interaction between the user and the raspberry pi in this
application requirement
Flow Description
Main flow
11. The user requests an image
12. The system interprets the message
13. The system responds with an image to the user
Alternate flow
Termination
The system responds to the message
Post condition
The system goes into a wait state
Multi-platform support
This performance is measured by the accessibility to as many users as possible. The web
application allows for access for anyone with a modern web browser, while the
telegram application allows for access to anyone with a smart phone running one of the
main operating systems
The user must have the telegram app installed on one of the above devices
The user must have a telegram account
The raspberry pi connected with stepper motor and webcam
Availability requirement
requirement 1: web application
requirement 3: telegram
This requirement is for the user to have a unique phone number to create a
telegram account if they do not already have one
The network capabilities of the user’s phone is another requirement, the need to
be able to access the telegram servers is an important requirement
The ability to use telegram outside of the scope of this project as a messenger
service
Security requirement
Security for this project is an important aspect for the scope of it. The users need to be
able to send messages securely between the IOT device and their phones. One of the
main reasons I chose to use telegram is because of its exemplary encryption. Telegram
offers end to end encryption meaning that the only devices capable of decrypting the
messages are the device that sent the message and the device that received the
message
Reliability requirement
This requirement is straight forward, the Tg server needs to be called and once running
and the tgl repository will maintain it until the safe quit function is called.
The servers also need to be running and accessible to anyone on the web
Maintainability requirement
The maintaibality of the project will be managed through Github. Updates to the
repository will be able to be called using the git command git pull in the terminal. This
will merge the updated files in the Github repository with the local files on the machine
Telegram offers updates as standard, as does its well-maintained API.
Extendibility requirement
the main code for this project is easily updated and extended. The project would benefit
from a plethora of new functionalities.
Implementation
Each implementation of this project will span throughout the web application, the
telegram functionality and the working project. along with images and code snippets.
:authorised_users
has_many
has_many :numbers
after_create :send_admin_mail
def send_admin_mail
UserMailer.send_welcome_email(self).deliver
end
end
Edit User: calls the edit view, and provides a new form for altering records. Also
provides a delete button for quick and easy removing of numbers from the system
Once the form is completed, it calls upon the Number.update function to alter the
active record entry associated with the number
authenticate user
Controls, Maintains and Implements:
Add number as authenticated user: allows the user with the designated phone
number to access the service
On create function: on create of the Number record a rails call sends a message
to the raspberry pi via telegram containing the user details
Add user to contacts: the incoming telegram message is interpreted by the
raspberry pi device
# @number = Number.new(number_params)
respond_to do |format|
if @number.save
format.html { redirect_to @number, notice: 'Number was successfully created.' }
format.json { render :show, status: :created, location: @number }
else
format.html { render :new }
format.json { render json: @number.errors, status: :unprocessable_entity }
end
end
end
as you can see above, once the user is created the @number.phone number,
@number.first_name and the @number.last_name variables are passed into the
telegram TeleNotify method to pass these arguments onto the raspberry pi
The message is interpreted by the action.lua code, and returns a cli command to
add_contact. Once the contact is added to the raspberry pi it will have the permissions
required to access the services.
Note: a user with the privileges of triggering the open-door function does not have
access to the camera function, this feature was added as it would seem a security
violation to have anyone able to access the camera.
once the message is received, the function on_msg_recieve takes in the new message,
checks that it came from the rails application
In the telegram cli console you can see the message being received. The message
contains the phone number, first name and second name.
As it stands this string contains all the required information to create a contact, however
it is one string. This string to prove useful needs to be converted into variables. As you
can see in the code above this is done with the number, first_name, last_name
string:match ("([^,]+),([^,]+),([^,]+)") line. This separated the three needed variables by
the “,” delimitator.
mailer implementation
outlines the mail response required for a users’ creation, password recovery and the
queries put forward using the contact.
def send_welcome_email(user)
@user = user
mail(:to => user.email, :subject => "Welcome to opensesamessage.com")
end
end
furthermore, the mailer is called into action once someone sends a message through the
contact us form. This creates a new record using the contact model in the contact form
in the on create method and triggers the action mailer.
the mailer is called into action to trigger emails for both the user (the person submitting
the query) and the system administrator. The administrator email
hello@opensesamessage.com is handled by the service provider zoho mail. The code for
this action can be seen below.
def send_contact_notification(contact)
@contact = contact
mail(:to => 'hello@opensesamessage.com', :subject => "New contact submitted")
end
def send_ack_mail(contact)
@contact = contact
mail(:to => contact.email, :subject => "Thank you for contacting us")
end
end
error handling: if there is no email in the database that matches the email requesting
the password change the system will return an error stating that the password was not
found on the system.
upon clicking the provided link, the user is redirected to a password change view, this
view is only accessible with the password reset token generated for the user when they
request a password change. Only users with this unique token can access this screen.
import os
Lastly the python program creates a text file called status_file which contains the
information, this file is then interpreted by the Lua code when a request for status is
made. Every time the status request is called the file gets overwritten with new
information. This avoids a build-up of text files over periods of long use.
Python code handling file creation and update:
file = open("status_file","w")
file.write("\n"+"CPU Temp")
file.write("\n"+getCPUtemperature())
file.write("\n"+"================")
file.write("\n"+"% of CPU use")
file.write("\n"+"\n".join(getCPUuse()))
file.write("\n"+"================")
file.write("\n"+"Total Ram, Ram Used, Ram Free")
file.write("\n"+"\n".join(getRAMinfo()))
file.write("\n"+"================")
file.write("\n"+"Total Disk, Disk Used, Disk Free, % disk")
file.write("\n"+"\n".join(getDiskSpace()))
file.close()
message to system:
The user initiates this action when the user messages the system requesting it to open,
this needs to be as simple and as intuitive as possible to cater for all users and their
abilities. Because of this I have chosen to designate the message for opening the door as
simply ‘open’
response failed: if the user is not already approved by the administrator before they
message the device requesting it to open.
This stops unwanted people gaining access to the device and the building.
response success: if the user has the required permissions to access the device their
request is granted. This informs the device to trigger the python program to open the
device.
This program is written in python and handles the movement of the servo motor. As you
can see in the code snippet below the servo is working on pin 11 in the raspberry pi’s
Because the raspberry pi b+ GPIO pins only offer a voltage of 5v an external battery was
used to provide enough power to open the bolt on a door’s lock. Because of this the
raspberry pi’s pins offer the ground for both the servo and the external power source.
Raspberry pi image
Outlines in detail the process of taking a photo using the Microsoft LifeCam Cinema
720p webcam, and returning the image to the user via the telegram messanging system.
This is an important security feature for the device as it allows the user to see who is
entering the building remotely
#!/usr/bin/python
import os
import pygame, sys
width = 640
height = 480
#initialise pygame
pygame.init()
pygame.camera.init()
cam = pygame.camera.Camera("/dev/video0",(width,height))
cam.start()
#setup window
windowSurfaceObj = pygame.display.set_mode((width,height),1,16)
pygame.display.set_caption('Camera')
#take a picture
image = cam.get_image()
cam.stop()
#save picture
pygame.image.save(windowSurfaceObj,'image.jpg')
execution: once this code executes the user is responded to the user with a message
with containing the image. This allows the user to remotely monitor who is entering the
building.
The prototype creation took place in two parts. The first part consisted of creating the
door in which the device would operate, the second part of the prototype consisted of
establishing the device in its working state onto the door.
Door creation
The creation of the door took place over the course of an afternoon. For this small
project I created the door frame using 2x4 wood, and a piece of fire retardant MDF
board for the door.
I used small hinges to mount the foor to the frame and the lock, which for this project
was the yale p85 night latch. I chose this lock because it is a common door lock used in
Ireland, and is consitant with the style of lock used commonly throughout the world.
This decision was made to further broaden the application and the use cases for the
project, and not to have it only hit a small niche.
above you can see the system diagram for the raspberry pi, the ground wire for both the
external power source and the servo are connected to pins 1 and 3 of the raspberry pi’s
GPIO board, while the controller wire is connected to pin 11. Finally, the power cord
shown in red runs from the servo to the external power source.
with the creation of the prototype door and the device established, I was able to get a
better understanding of how it would act in normal use throughout its life cycle.
Opensesamessage.com
The GUI for the web application is made up of html and css, and the front-end
framework bootstrap.
“Bootstrap makes front-end web development faster and easier. It's made for folks of all
skill levels, devices of all shapes, and projects of all sizes.”
homepage
Description: this is the first interface the user will be met with, it is the homepage for
the website with links to the sign in page, and the contact page:
home, allows the user to return to the homepage from anywhere in the
application.
contact, allows the user to access the contact us page.
Sign in, allows the user to enter the sign in page.
mobile device
Responsive navbar for screens under a certain size
Responsive icons and text for smaller screen sizes
(GUI 2: login)
mobile device:
Registrations
(GUI 3: registration )
Add users
Description: this interface allows the administrator user to add phone numbers to the
whitelist. This grants the required privileges to the telegram account to access the
device and make requests
mobile device
Responsive navbar
Scaled down interface for smaller device.
Larger buttons for mobile users to allow for
easier navigation to the next menu
As intuitive as possible
mobile device:
this interface resizes itself to cater for the difference
of screen sized
This is handled in the form-control-contact css class
that sets the display to block and resizes the text
areas to 140%.
Mobile GUI
Web GUI
Overview
Testing is essential when it comes to consumer devices, and when it comes to security
devices testing is paramount. It is no different for OpenSesamessage. Three main forms
of testing were used for this project. this testing ensured the device was simple to use
for all audiences regardless of age or technical ability.
Tools used in the testing process of OpenSesamessage:
Travis.io: this testing was carried out by Travis. Travis CI is a hosted, distributed
continuous integration service used to build and test software projects hosted at
GitHub.
Usability testing: this testing was carried out by adding users to the system and
having them run through the processes of operating the system
typeform: I conducted online surveys to see what average consumers wanted
and if those needs could be met within the project.
online survey
Unit & Integration Testing
Usability testing
Each method of testing is explained under its own heading, tests where participants
where used are detailed with the number of active participants and any collected
responses from surveys untaken.
Unit Testing
Initial testing for this project began with creating a separate database for tests to be
performed. In ruby on rails a test database gets populated while running through
controller tests, and is dropped after the tests are done. To create the test database, I
performed the following commands.
this generated the necessary test database. With the creation of the test database I
could begin writing tests. The test suite I used was rSpec. rSpec is a testing framework
for ruby on rails, it can be installed by adding the rSpec-rails gem to the gem file within
the rails application. The installation process for rSpec is similar to most gems. First you
have to add it to the gemfile in the appropriate group, in this case the development test
group:
and running both bundle to download the gem, and then running the command rails
generate rspec:install. This process can be seen in the terminal snippet below:
Numbers controller:
The numbers controller is responsible for handling the users phone numbers. Each
person they want provide the necessary privileges required for opening the door is
added in the numbers controller. Therefore, this controller is critical to the applications
operation. And therefore, the testing of this model is paramount.
assert_redirected_to number_path(assigns(:number))
end
assert_redirected_to numbers_path
end
end
as you can see above the tests for this controller handle the CRUD functionality, some
test smaller roles such as the “should get index” method which tests the index_path for
this model. others such as the ‘should create number’ method tried to create a new
number entry into the test database with the parameters I have given it. These
parameters are the ones that are required for this controller, parameters such as
area_code, first_name, last_name, phone_number, and user_id. Once it runs through
these successfully is checks to make sure the user is correctly redirected to the
number_path of the appropriate number.
Contacts controller:
The contacts controller handles the queries sent by users to the systems administrator.
This is handled by creating a contact entry into the PostgreSQL database containing the
parameters email, name and query. Once created the on_create method calls the user
Mailer within the application that sends an email to the application’s administrator
account hello@opensesamessage.com with the contact.query, the contact.name and
the contact.email parameters. It also takes the contact.email and sends and email to the
person submitting the query notifying them of the receipt of their query and that the
support team will be in contact with them shortly.
require 'test_helper'
assert_redirected_to contact_path(assigns(:contact))
end
end
the contacts controller test file preforms the standard tests such as should get index test
that requires the correct redirect. It also tests for successful creation of contacts in the
should get new method. This method tries to create a new entry into the contacts table
and awaits the 200-success response.
Travis – CI
Travis-CI is one of several build automation tools that allows developers understand if
their application is working. This is done by building, testing and finally reporting on the
build sequences the developer has configured. The ‘continuous’ part reflects that these
tools will scan and detect, in my case by each time a commit is pushed to Github, errors
in the application. The integration part reflects the fast software development requires
the interaction between multiple separate components working together smoothly. In
most cases, there will be a tool to retrieve the latest release or development version, it
will then compile the code, perform the necessary tests and deploy the code to the
server.
setup
setting up Travis Is quite simple, I logged in via the website travis-ci.com and linked with
my Github account. Then I created a configuration file called .travis.yml file to the
project containing the necessary configuration parameters for my project. this file Is
what Travis will reference when building this version and performing tests
language: ruby
rvm:
- 2.3.1
- jruby-18mode
- jruby-19mode
- jruby-head
Travis-CI also gives a log of the build process, this allows you to run down through the
testing process and find where the sequence is being interrupted. This is extremely
useful for rapid development that has you adding functionality quickly. It gives peace of
mind.
worker_info
Worker information
hostname: i-02469a7-precise-production-2-worker-com-
docker.travisci.net:01b88a1a-1718-4344-a568-1133c535bdea
version: v2.5.0 https://github.com/travis-
ci/worker/tree/da3a43228dffc0fcca5a46569ca786b22991979f
instance: 5c36215:travis:ruby
startup: 1.068711592s
system_info
Build system information
Build language: ruby
Build group: stable
rvm
19.85s$ rvm use 2.3.1 --install --binary --fuzzy
ruby-2.3.1 is not installed - installing.
Searching for binary rubies, this might take some time.
Found remote file https://s3.amazonaws.com/travis-
rubies/binaries/ubuntu/12.04/x86_64/ruby-2.3.1.tar.bz2
Checking requirements for ubuntu.
Requirements installation successful.
ruby-2.3.1 - #configure
ruby-2.3.1 - #download
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 23.0M 100 23.0M 0 0 92.9M 0 --:--:-- --:--:-- --:--:-- 93.8M
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.3.1 - #validate archive
ruby-2.3.1 - #extract
ruby-2.3.1 - #validate binary
ruby-2.3.1 - #setup
ruby-2.3.1 - #gemset created /home/travis/.rvm/gems/ruby-2.3.1@global
Usability Study:
All questions are rating based, Ratings below or at 2 are deemed problem areas, users
that answer with this rating are asked and required to provide feedback as to what the
problem or concern is
all questions were based on what tasks the user would be preforming within the life
cycle of the product, tasks such as status check, opening and closing of the device and
adding new users to the system as well as getting pictures.
First Question: on a scale of 1 to 5, how easily did you find creating an account on the
website?
0
1 2 3 4 5
testers
Collected User Reponses from those that answered with a rating of 3 or lower: (Copied
directly from survey response)
Second Question: Overall, how easy was it for you to add, remove and edit numbers on
the website?
testers
Collected User Reponses from those that answered with a rating of 3 or lower:
“I got an error message when adding my phone number”
“I couldn’t save my phone number”
Third Question: overall how did you find the open function for this project?
0
1 2 3 4 5
Series 1
Collected User Reponses from those that answered with a rating of 3 or lower:
None, however one participant experience trouble registering for telegram. The two-
step verification failed, and they had to request another text message
Remarks
No solution needed, I’m happy with the result because I had usability in mind when I
was deciding to use this functionality
Fourth Question: how likely would you be to implement a system like this in your
home?
0
1 2 3 4 5
Series 1
Collected User Reponses from those that answered with a rating of 3 or lower: (Copied
directly from survey response)
This survey was carried out during the project, its aim was to get a better understanding
of the market and what consumers would be interesting in with a product of this type.
The questionnaire was 10 questions long and was designed to gauge the users gender
age and their openness to a pro
The online survey: was carried out using the survey tool typeform.com. this allowed me
to get the survey out to as many people as possible. The survey consisted of 10 simple
questions, aimed to get a better understanding of the product and its features. The
survey was carried out by a total of 178 people. To get a good spread of user data I
asked friends, family and posted to online forums.
Reason for online survey: because of the nature of the project getting a good
understanding of what people want, and the concerns they have over implementing a
technology such as this is paramount. The best way to gauge what the public want and
how they feel entrusting their home and belongings to a smart device is to ask, so I
created this survey.
female
male
26 - 30
23-26
18 - 22
30+
0 10 20 30 40 50 60
results: the results of this question show that the users who took this survey were
generally within the age group of over 30 years old.
conclusion: the data shows that the people interested in taking this survey and thus the
product were people over the age of 30. People of this age generally own their own
homes, so would be the target market. This is the intended audience for the survey and
the results therefore are a good indication of what the target market is interested in.
no
yes
results: this question was both surprising and unsurprising. It revealed that everyone
who answered this question had some form of internet connectivity
conclusion: the device requires internet connectivity to operate as the messages are
sent over the internet. Having internet access in the home means that users can have
the raspberry pi connected to the internet, while being within range of Wi-Fi/3g to be
able to message the device
no
yes
Series 1
results: the results of this question shows that the target market for this product have
some experience using a popular messenger service.
conclusion: this is an important result as it shows that most users have experience using
a messenger service. The importance of this result comes from the importance of
people ease of use of the service. The device is operated by sending messages to the
device using the messenger service telegram. If users have experience with a messenger
service then the learning requirement for the devices’ operation is severely reduced
no
yes
70 75 80 85 90 95 100
results: The majority of people who have taken this survey at some stage left their
house forgetting their keys
conclusion: this question showed that the majority of people have experienced the
problem that this product aims to solve. This is what the consumer has left their house
forgetting their keys, meaning they either must get a locksmith, wait for someone with a
key, or call someone in the house to let them in. with OpenSesamessage this is avoided
by having the ability to just message the device and inlock the door
(on a sale of 1 – 10. 1 being not at all, and 10 being extremely likely)
0 1 2 3 4 5 6 7 8 9 10
results: this data is for a follow up question, the data clearly shows that the likelihood of
a person having their phone with them in the event of them forgetting their keys is quite
likely, most people have answered either 10, 9 or 8 for this question. The average
answer being 8.66
conclusion: this question further re-enforced the idea for this project. this device is
operated using a smartphone. With users having access to their smartphone they can
then use the device to access their home without the need for their keys.
10 9 8 7 6 5 4 3 2 1 0
results: this data shows how likely a person taking this survey would be to have a device
to allow entry to their home via smartphone. This data is scattered, a high percentage
(17%). However, most the data scores 5 or higher.
conclusion: with the main number of people scoring 5 accounted for 64% of the people
taking this survey. This shows that while there are people who are not interested, there
are people willing to get this device, there are however clearly certain concerns
price in euro
60
50
40
30
20
10
0
25 50 10 70 €100+
participants
results: the participants showed interest in the product at a price ranger under €70
conclusion: this result shows that the participants would be willing to spend
approximately €70 for a device such as the one this project is based. The initial research
for this project showed that there are products on the market that perform a similar
function, but at a price point of €150+. This further assures that the project would have
an audience with consumers with a total cost of approximately 50 euro.
if you had the device described, would you like the ability to control
who can access your front door?
yes no
results: this question shows that the participants answered strongly in favour of having
control over who has access to the lock. The participants answered with a majority of
95%
conclusion: the results of this question showed a 95% majority of people wanted to
control who has access to the device. This is a security feature that has been
implemented because of a high popularity of this question.
participants
15+
7 to 15
3 to 7
1 to 3
0 10 20 30 40 50 60 70 80 90
participants
results: the results of this question show the number of people a user of this service
would have associated with their device. Most users would have between 1 and 7
people
conclusion: the results showed that the majority of users would not have more than
seven users associated with an account. However, the device can facilitate an infinite
number of users provided there is sufficient storage. This question was primarily to give
an insight into how people would use OpenSesamessage
Design level, I have a great interest in front end web development and I hope to
peruse a future in it. I feel this project allowed me to get a better understanding
of web development in terms of user experience and styling
Web development, I have a huge interest in the intricacies of web development
and the plethora of tools available to developers today. The creation of
functionality is of huge interest to me.
IOT or internet of things development. This field allows for the creation of fun
and unique devices and tools. I enjoyed working with the raspberry pi and
already have plans to maintain this project and countless projects for the future
Although these milestones did not have deadlines I worked toward these milestones
throughout the project, and hoped to excel in these.
Required: these milestones unlike the ones outlined above were a requirement for the
project. these requirements added structure to the project and created achievable goals
to strive for through the course of the project
Ensuring monthly logs of development progress were kept. This allows for a
timeline for the project
Ensure a working prototype for the mid-point presentation.
telegram: telegram as a service allows the use of their cli, however with this project I
was not creating functionality for its intended use. But from the raw tools provided by
the messenger service I could use the service to suit this project. I had trouble setting up
communication between the raspberry pi, mobile devices and the web application.
However, with the use of the provided methods I could accomplish cross platform
communication.
time hurdles: this project began with another goal, I was I agreement to implement a
front-end framework with a start-up company unituition.com. the goal was to
implement react.js into the pre-existing website. However, after my midpoint
presentation my project supervisor pointed out the loss in marks I was suffering with no
database implementation among other things. After much consideration, I chose to take
a new direction. I chose to create my own ruby on rails application and implement and
iot device
"Active Record Basics — Ruby On Rails Guides". Guides.rubyonrails.org. N.p., 2017. Web.
8 May 2017.
"YARD - A Ruby Documentation Tool". Yardoc.org. N.p., 2017. Web. 8 May 2017.
Monthly Journals
Reflective Journal
Student name: Conor Breen
Programme: BSc in computing
Month: September
You don’t have to follow the suggested format. These sub-headings and questions
below may help you to get the most out of this journal, but you are free to modify as
you see fit. Through this journal, you demonstrate that you are engaged with the
process and that you can identify what you need to do or change to progress and
succeed in this project.
Upload one journal every month. Expected word count 300 words (of you own words).
My Achievements
This month I was able to settle on a project for my final year. I met with a company
called Unituition to discuss possible projects that I could do for them. After our meeting,
we settled on a project. My project will consist of me implementing a front-end
framework on their site. This is no small task; it involves completely redesigning the
entire front end of their site which is written in basic CSS. I have chosen React.js to
implement. React is a front-end framework developed by Facebook and is most notable
used in the previous example as well as Instagram. It improves responsiveness of sites
such by moving html elements into a ‘components’ file. This allows responsive rendering
of html elements on the fly. As well as that is improves upon site efficiency making the
pages’ load faster and allows for quicker ajax calls to be performed.
My Reflection
This month I have implemented the framework into the site by using the react-rails gem.
This gem generates the necessary files needed for ruby on rails to properly interact with
the react component files. However, there have been some setbacks. Because the site
has been created using mainly CSS classes written when needed. The application.css file
contains thousands of lines of code that will need to be loaded every time the site
renders a new page. Cleaning up the legacy code will play a huge part in this project.
Intended Changes
Next month I will work on the user dashboard trying to clean up the interface as well as
make it more intuitive. This involves rewriting tables, ruby calls to the database as well
as ajax calls that confirm bookings.
Supervisor Meetings
Reflective Journal
Student name: Conor Breen
Programme: BSc in computing
Month: October
My Achievements
This month saw slow progress with the project. Reactjs is proving simple in some areas,
and cripplingly difficult in others. Because I’m using ruby on rails, I was able to avail of
the react-rails gem, a package for rails users that allows easy install of dependencies, and
with a couple lines of command line input I had the necessary component.js folder, the
require tree and the compiler setup and ready to go. Initially I began coding in JavaScript
to create and render new Reactjs components. This however raised a new challenge,
JavaScript code that generates html is not very easy to read. And in a project with
multiple developers I made the decision to change from JavaScript to jsx. This syntax
resembles xml, so it is inherently easier for other developers to read.
My Reflection
This month has proved rather difficult in terms of project work. Working only one day a
week on a project of this scale has me worried about the time frame. My other modules
are requiring more and more of my time and I fear that the added workload will hinder
just how much work I am able to do. However, this month I wrote the code to allow react
components make calls to the database, pulling user information. And populating tables
with only minimal input, while generating the rest of the tables based my pre definitions.
This means for a more optimised app
Intended Changes
Next month I will work heavily on active record, as well as creating the react equivalent
of for loops, to loop through associations between students and tutors, populating both
landing pages.
Supervisor Meetings
Month Overview
After my project mid-point presentation Adrianna suggested it would be best for a
change in direction, so I have decided to make my own ruby on rails application and
implement front end features into that. Also, if possible add an IOT element.
December. proved difficult for project work, social obligation meant that progress
slowed somewhat.
However, although slow progress was made. I continued development on the ruby on
rails website, the site now has its entire scaffold. A user model for the admin users of
the service, as well as a sub user model for the people users add to the service. This is a
security feature as it allows to user to grant access to new people using
OpenSesamessage, while giving them the option to remove this privilege rather easily
by logging into their account and removing them. However, this functionality does not
exist, and for the month coming I plan on implementing telegram into the rails website
via the use of a gem
My Achievements
This month was focused heavily on the development of ruby on rails, having worked on
it for the last months, I felt comfortable programming in it now. Making changes and
adding functionality. I am also keeping a list of functionalities that should be
implemented in the hopes that time will allow. I have substantial plans for next month.
My Reflection
In reflection, I guess I knew that December would be a slow month, it would mean
family events and work parties and every form of social obligation or final year project
hindrance imaginable. However, December did act as a way to blow off steam. I enter
January optimistic
Supervisor Meetings
Date of Meeting:
Items discussed: a possible change in direction for my project, which will be tough but
not impossible.
Action Items:
Reflective Journal
Student name: Conor Breen
Programme BSHCIOT4
Month: January
Month Overview
This month saw great progress in terms of programming. I have chosen the messenger
service telegram to handle requests and interpret messages as commands. With the
introduction of telegram into the project I have been able to solve the problem of
interoperability. This project is now, be default multi-platform. I have chosen a
programming language called Lua to parse the incoming messages and based on their
content execute commands. For example, the message hello to the system will return a
message hello #{user_name}. this is the simplest of the commands, but in the next
coming months I will use messages to control os commands with the system, executing
python code that I have written.
My Achievements
This month’s achievements have put me on track for this project. I have purchased a
stepper motor which should arrive shortly. With this motor, I can write a python
program to activate it, in the hopes that it would open a lock on a door solely from a
message on a popular messenger service. I also, have plans to implement a webcam to
allow the admin user to receive image messages of who is entering the house.
This month saw a mild disaster with the project code, I.e. ruby on rails code. The
database got corrupted by fault of my own when testing migrating to AWS. Fortunately,
I had my code on Github, so I was able to salvage the vast majority of it by forking my
repository and creating a new one. OpenSesamessage-2.0
Intended Changes
Next month I hope to establish the stepper motor functionality and have users be able
to trigger this action via a message to “open”. More works needs to be done on the
website. I need to implement a front-end framework into the new website.
Supervisor Meetings
Reflective Journal
Student name: Conor Breen
Programme BSHCIOT4
Month: February
Month Overview
This month was a difficult one. I have growing fears over the timeline of this project,
based on the workload that has fallen upon us in the IOT stream. With no final exams,
we have a substantial amount of project work. However, I did make progress with the
My Achievements
Progress with the website, I need to begin looking into hosting. I have purchased the
domain name openssesamessage.com and plan to host it online. I will probably choose
Digital Ocean as they provide affordable hosting packages for small scale projects, as
well as a certain amount of hosting credit for students.
My Reflection
In reflection, I would like to have gotten more done. However, with the circumstances of
college project work outside of the final year project this was impossible. However, I
have hopes that next month I can make further progress with the project. in an upside
to the project I have found that using git has saved me once again, reverting back
through commits has meant that I haven’t lost huge amounts of code and progress
based on poor programming choices. I have learned that programming when tired and
in the master branch is recipe for disaster.
Intended Changes
Next month I hope to continue on with this project making steady progress. I have had
problems with the stepper motor and have ordered a new one. This new one will have
increased torque over the other and should be better suited for the job
Supervisor Meetings
Month Overview
With the deadline approaching fast it has become apparent that time is a commodity
now. The rapid approach of the project deadline has become shrouded by the onslaught
of projects from other modules. I have growing fears that my final year project will have
its quality lessened by the work load. However, this month did see some progress. I have
the website styled and the stepper motor working on command through the telegram
messenger service. What’s required now is a webcam to take photos and send them
back upon request and to setup security features.
My Achievements
The achievements this month are in the programming sense. The motor works, with
python code running by commanding the GPIO pins, the website is better styled and the
user accounts are up and running. However, I still need to establish communication
between the web application and the IOT device. This I hope will be possible through
the use of a telegram gem. Gems are packages in ruby that allows wrappers for certain
API’s. with the use of a suitable gem I hope that I will be able to establish
communication between the two devices.
My Reflection
It is coming more and more apparent that time is short, obligations outside the scope of
this college project have been creeping in and I have growing concerns over the final
report. So far, a substantial amount of my project work has been programming. And
where I am comfortable programming, I fear that writing technical documents is my
Achilles heel.
Intended Changes
Next month I aim to focus more on the final report. The daunting size of it requires a
large time commitment and next month will be very busy finishing module projects.