38
November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser University Burnaby, British Columbia V5A 1S6 Re: ENSC 305W/440W Design Specifications for Audolok Dear Dr. Rawicz, The enclosed document contains the design specifications for our product Audolok, a smart secured door system. Audolok is an automatic, secured lock/unlocking and open/closing door controlled by Smartphones. The goal of our project is to eliminate challenges faced by physically disabled individuals of locking/unlocking and opening/closing secured doors. The succeeding document contains a detailed outline of the design specifications required for Audolok. In addition, it will include a functional test plan for each of Audolok’s features and systems. The design specifications will cover the system as a whole, as well as each individual system along with component and material selection. The eLOK Systems team consists of four goal driven engineering students with diverse backgrounds and skill sets: Lexi Chor, Ellson Dai, Christy Tao and Chi Zhang. Should you have any questions or concerns, please do not hesitate to contact us at [email protected] Sincerely, Lexi Chor Chief Executive Officer eLOK Systems Enclosure: Design Specifications for Audolok

November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

November 12th 2015

Dr Andrew Rawicz

School of Engineering Science

Simon Fraser University

Burnaby British Columbia

V5A 1S6

Re ENSC 305W440W Design Specifications for Audolok

Dear Dr Rawicz

The enclosed document contains the design specifications for our product Audolok a

smart secured door system Audolok is an automatic secured lockunlocking and

openclosing door controlled by Smartphonersquos The goal of our project is to eliminate

challenges faced by physically disabled individuals of lockingunlocking and

openingclosing secured doors

The succeeding document contains a detailed outline of the design specifications

required for Audolok In addition it will include a functional test plan for each of

Audolokrsquos features and systems The design specifications will cover the system as a

whole as well as each individual system along with component and material selection

The eLOK Systems team consists of four goal driven engineering students with diverse

backgrounds and skill sets Lexi Chor Ellson Dai Christy Tao and Chi Zhang Should

you have any questions or concerns please do not hesitate to contact us at

lchorsfuca

Sincerely

Lexi Chor

Chief Executive Officer

eLOK Systems

Enclosure Design Specifications for Audolok

Design Specifications for Audolok

Project Team Lexi Chor

Ellson Dai

Christy Tao

Chi Zhang

Contact Person Lexi Chor

Submitted to Dr Andrew Rawicz - ENSC 440W

Steve Whitmore - ENSC 305W

School of Engineering Science

Simon Fraser University

Issue Date November 12 2015

Revision 11

Copyright copy 2015 eLOK Solutions ii

Executive Summary The freedom to move around comfortably in homes and offices is often taken for

granted But it is this freedom that is embraced by individuals with limited mobility and

strength such as the elderly and physically disabled individuals These individuals often

face many challenges such as locking and unlocking doors and opening and closing

them especially if they have limited strength hand dexterity or use wheelchairs The

most common difficulties are associated with the hardware used the weight of the door

and the height of the lock or door knob [1]

eLOK Systems has designed a smart secured door called Audolok aimed to solve these

challenges With a touch of a finger Audolok will unlock and open then close and lock

itself behind you meaning minimal movement and strength needed to perform these

tasks In addition the status of the door can be checked remotely via the companion

mobile application and Wi-Fi technology Three different levels of electronic keys are

also available Trusted User Temporary User and Admin User This functionality allows

users to give access to other users so they can access their door for cases when they

arenrsquot home or for emergencies

This documentation contains all the design specification requirements needed for

Audolok eLOK Systems plans to complete a working prototype of Audolok by

December 2015 Our goal is to ease the daily tasks of individuals with limited mobility

and strength when it comes to opening and closing secured doors

Copyright copy 2015 eLOK Solutions iii

Table of Contents Executive Summary ii

List of Figures and Tables v

Glossary vii

1 Introduction 1

2 Scope 1

3 Audience 1

4 System Overview 2

5 Overall System Design 3

6 Mechanical Design Specifications 5

61 Motor Module 5

611 Servo Motor 5

612 Stepper Motor 6

613 Motor Comparison 7

614 Motor Driver 7

62 Linear Actuator 8

7 Structural Specifications 10

71 ConnectorsArms 10

72 Brackets 11

73 Enclosure 12

731 Lock System Enclosure 12

8 Electronic Design Specifications 12

81 Microcontroller 13

82 Motor System and Linear Actuator Drive Module 14

83 Power System 15

84 Wi-Fi Module 15

85 Firmware Design 15

9 Software Design Specifications 16

91 MVC Architecture 17

92 Data Models 17

Copyright copy 2015 eLOK Solutions iv

921 Database Design 18

93 Controllers 18

931 Network Specifications 19

94 Client-Server Communications 20

95 Views (User Interface) 20

10 Communication System Specifications 21

11 Test Plans 22

111 Unit Test Plans 22

1111 Microcontroller Unit Peripherals Test 22

1112 Power Supply Unit Test 22

1113 Wi-Fi Communication System Test 23

1114 Software Unit Test 23

1114 Mechanical Unit Test 24

112 Regression Test Plan 25

113 Prototype Integrated Test 27

12 Conclusion 28

Copyright copy 2015 eLOK Solutions v

List of Figures and Tables Figure 1 Block Diagram of Audolok Systems 2

Figure 2 3D Conceptual model of Audolok 4

Figure 3 3D Conceptual Model of Lock System 4

Figure 4 3D Conceptual Model of Handle Opener 4

Figure 5 LS-3006 Servo Motor [3] 5

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6] 7

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8] 8

Figure 8 PA-14 Linear Actuator [9] 8

Figure 9 12 VDC Speed vs Load for Linear Actuator [9] 9

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9] 9

Figure 11 Top View of Linear Actuator Placement 10

Figure 12 Example of Arms Required to Connect Motor and Lock [11] 11

Figure 13 Lock System Design 11

Figure 14 Ideal Gear Design for Lock System 11

Figure 15 Brackets Used to Fasten Linear Actuator [12] 12

Figure 16 Prototype Model of Enclosure 12

Figure 17 Product Model of Enclosure 12

Figure 18 Schematic Diagram of Electronic System 13

Figure 19 General Flow of the Firmware 16

Figure 20 Model-View-Controller Relation Diagram [14] 17

Figure 21 Relational Database Schema for Mobile Application 18

Figure 22 Owner GUI of list of users 21

Figure 23 Owner GUI of invitation page 21

Copyright copy 2015 eLOK Solutions vi

Table 1 Specifications for the LS-3006 Servo Motor [4] 6

Table 2 Specifications for 28BYJ-48 Stepper Motor [6] 6

Table 3 Specifications for Linear Actuator [9] 9

Table 4 Pin Occupation for Arduino 14

Table 5 Specifications for Arduino Mega 2560 [13] 14

Copyright copy 2015 eLOK Solutions vii

Glossary 3G Third Generation of Mobile Telecommunications Technology

4G Fourth Generation of Mobile Telecommunications Technology

3D Three Dimensional

AC-DC Alternating Current - Direct Current

API Application Program Interface

GUI Graphical User Interface

HTTP Hypertext Transfer Protocol

IDE Integrated Development Environment

IEEE Electrical Electronic Engineers

iOS iPhone Operating System

IP Internet Protocol

JDBC Java Database Connectivity Technology

MCU Microcontroller Unit

MVC Model-View-Controller

PC Personal Computer

PCB Printed Circuit Board

PHP Hypertext Preprocessor

PWM Pulse Width Modulation

RampD Research and Development

RFID Radio Frequency Identification

SMT Surface Mount Technology

SSID Service Set Identifier

TCP Transmission Control Protocol

UDP User Datagram Program

UI User Interface

USB Universal Serial Bus

WPA Wi-Fi Protected Access

Copyright copy 2015 eLOK Solutions 1

1 Introduction New technologies and innovations are constantly showing up on todayrsquos market One

new technology is electronic locks These locks are controlled by Smartphonersquos or RFID

cards eLOK Systems has designed a product called Audolok which improves electronic

locks by adding more features Audolok has three main features

LockUnlock using mobile application

Automatically open and close door

Electronic shareable keys

Since Smartphonersquos are becoming very popular in todayrsquos generation all the features

are conveniently accessed via the companion mobile application Audolok App Mobile

phones require very little movement so it will alleviate the challenges faced by

individuals with limited mobility and strength Audolok is an assembly of systems

containing an Arduino microcontroller Wi-Fi shields and motor drivers Mechanical parts

controlled by the MCUrsquos are motors rotating arms and linear actuators A database will

provide locations for authority and server based actions

2 Scope This document outlines the design specifications for the proof-of-concept and prototype

model of Audolok The design specifications will cover the mechanical and electrical

components used in the design 3D conceptual models of the product and subsystems

the microcontroller design as well as software design and UI requirements It will make

cross references to the functional requirements listed in Functional Specifications for

Audolok [2] to justify the design choice The classifications referenced in Functional

Specifications for Audolok have the form [Rn-p] where Rn is the requirement number

and p is the priority of the specification In addition this document will also include test

cases for each component and the expected behavior of each test

3 Audience

Our design specifications are intended for use by all members of the eLOK Systems

team Each member will use this document as a reference guide when designing and

testing Audolok to ensure the proof-of-concept and prototype model meets the design

specifications and correct behaviour In addition the design specifications document will

be used to measure progress during the development period and to aid the marketing

department of eLOK Systems to find potential investors

Copyright copy 2015 eLOK Solutions 2

4 System Overview Figure 1 below shows the block diagram of the system overview of Audolok

Figure 1 Block Diagram of Audolok Systems

Each section of the block diagram is described below

Input

Mobile Application The mobile app communicates with the microcontrollers

and the server Users are able to lockunlock openclose the door with the app

as well as check the door status and view a log of when the door has been

unlocked In addition the users are able to share keys to other users

Controller

Microcontrollers The microcontrollers receive signals from both the server and

the application When a command is received the microcontroller tells the

motors to run

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 2: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Design Specifications for Audolok

Project Team Lexi Chor

Ellson Dai

Christy Tao

Chi Zhang

Contact Person Lexi Chor

Submitted to Dr Andrew Rawicz - ENSC 440W

Steve Whitmore - ENSC 305W

School of Engineering Science

Simon Fraser University

Issue Date November 12 2015

Revision 11

Copyright copy 2015 eLOK Solutions ii

Executive Summary The freedom to move around comfortably in homes and offices is often taken for

granted But it is this freedom that is embraced by individuals with limited mobility and

strength such as the elderly and physically disabled individuals These individuals often

face many challenges such as locking and unlocking doors and opening and closing

them especially if they have limited strength hand dexterity or use wheelchairs The

most common difficulties are associated with the hardware used the weight of the door

and the height of the lock or door knob [1]

eLOK Systems has designed a smart secured door called Audolok aimed to solve these

challenges With a touch of a finger Audolok will unlock and open then close and lock

itself behind you meaning minimal movement and strength needed to perform these

tasks In addition the status of the door can be checked remotely via the companion

mobile application and Wi-Fi technology Three different levels of electronic keys are

also available Trusted User Temporary User and Admin User This functionality allows

users to give access to other users so they can access their door for cases when they

arenrsquot home or for emergencies

This documentation contains all the design specification requirements needed for

Audolok eLOK Systems plans to complete a working prototype of Audolok by

December 2015 Our goal is to ease the daily tasks of individuals with limited mobility

and strength when it comes to opening and closing secured doors

Copyright copy 2015 eLOK Solutions iii

Table of Contents Executive Summary ii

List of Figures and Tables v

Glossary vii

1 Introduction 1

2 Scope 1

3 Audience 1

4 System Overview 2

5 Overall System Design 3

6 Mechanical Design Specifications 5

61 Motor Module 5

611 Servo Motor 5

612 Stepper Motor 6

613 Motor Comparison 7

614 Motor Driver 7

62 Linear Actuator 8

7 Structural Specifications 10

71 ConnectorsArms 10

72 Brackets 11

73 Enclosure 12

731 Lock System Enclosure 12

8 Electronic Design Specifications 12

81 Microcontroller 13

82 Motor System and Linear Actuator Drive Module 14

83 Power System 15

84 Wi-Fi Module 15

85 Firmware Design 15

9 Software Design Specifications 16

91 MVC Architecture 17

92 Data Models 17

Copyright copy 2015 eLOK Solutions iv

921 Database Design 18

93 Controllers 18

931 Network Specifications 19

94 Client-Server Communications 20

95 Views (User Interface) 20

10 Communication System Specifications 21

11 Test Plans 22

111 Unit Test Plans 22

1111 Microcontroller Unit Peripherals Test 22

1112 Power Supply Unit Test 22

1113 Wi-Fi Communication System Test 23

1114 Software Unit Test 23

1114 Mechanical Unit Test 24

112 Regression Test Plan 25

113 Prototype Integrated Test 27

12 Conclusion 28

Copyright copy 2015 eLOK Solutions v

List of Figures and Tables Figure 1 Block Diagram of Audolok Systems 2

Figure 2 3D Conceptual model of Audolok 4

Figure 3 3D Conceptual Model of Lock System 4

Figure 4 3D Conceptual Model of Handle Opener 4

Figure 5 LS-3006 Servo Motor [3] 5

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6] 7

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8] 8

Figure 8 PA-14 Linear Actuator [9] 8

Figure 9 12 VDC Speed vs Load for Linear Actuator [9] 9

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9] 9

Figure 11 Top View of Linear Actuator Placement 10

Figure 12 Example of Arms Required to Connect Motor and Lock [11] 11

Figure 13 Lock System Design 11

Figure 14 Ideal Gear Design for Lock System 11

Figure 15 Brackets Used to Fasten Linear Actuator [12] 12

Figure 16 Prototype Model of Enclosure 12

Figure 17 Product Model of Enclosure 12

Figure 18 Schematic Diagram of Electronic System 13

Figure 19 General Flow of the Firmware 16

Figure 20 Model-View-Controller Relation Diagram [14] 17

Figure 21 Relational Database Schema for Mobile Application 18

Figure 22 Owner GUI of list of users 21

Figure 23 Owner GUI of invitation page 21

Copyright copy 2015 eLOK Solutions vi

Table 1 Specifications for the LS-3006 Servo Motor [4] 6

Table 2 Specifications for 28BYJ-48 Stepper Motor [6] 6

Table 3 Specifications for Linear Actuator [9] 9

Table 4 Pin Occupation for Arduino 14

Table 5 Specifications for Arduino Mega 2560 [13] 14

Copyright copy 2015 eLOK Solutions vii

Glossary 3G Third Generation of Mobile Telecommunications Technology

4G Fourth Generation of Mobile Telecommunications Technology

3D Three Dimensional

AC-DC Alternating Current - Direct Current

API Application Program Interface

GUI Graphical User Interface

HTTP Hypertext Transfer Protocol

IDE Integrated Development Environment

IEEE Electrical Electronic Engineers

iOS iPhone Operating System

IP Internet Protocol

JDBC Java Database Connectivity Technology

MCU Microcontroller Unit

MVC Model-View-Controller

PC Personal Computer

PCB Printed Circuit Board

PHP Hypertext Preprocessor

PWM Pulse Width Modulation

RampD Research and Development

RFID Radio Frequency Identification

SMT Surface Mount Technology

SSID Service Set Identifier

TCP Transmission Control Protocol

UDP User Datagram Program

UI User Interface

USB Universal Serial Bus

WPA Wi-Fi Protected Access

Copyright copy 2015 eLOK Solutions 1

1 Introduction New technologies and innovations are constantly showing up on todayrsquos market One

new technology is electronic locks These locks are controlled by Smartphonersquos or RFID

cards eLOK Systems has designed a product called Audolok which improves electronic

locks by adding more features Audolok has three main features

LockUnlock using mobile application

Automatically open and close door

Electronic shareable keys

Since Smartphonersquos are becoming very popular in todayrsquos generation all the features

are conveniently accessed via the companion mobile application Audolok App Mobile

phones require very little movement so it will alleviate the challenges faced by

individuals with limited mobility and strength Audolok is an assembly of systems

containing an Arduino microcontroller Wi-Fi shields and motor drivers Mechanical parts

controlled by the MCUrsquos are motors rotating arms and linear actuators A database will

provide locations for authority and server based actions

2 Scope This document outlines the design specifications for the proof-of-concept and prototype

model of Audolok The design specifications will cover the mechanical and electrical

components used in the design 3D conceptual models of the product and subsystems

the microcontroller design as well as software design and UI requirements It will make

cross references to the functional requirements listed in Functional Specifications for

Audolok [2] to justify the design choice The classifications referenced in Functional

Specifications for Audolok have the form [Rn-p] where Rn is the requirement number

and p is the priority of the specification In addition this document will also include test

cases for each component and the expected behavior of each test

3 Audience

Our design specifications are intended for use by all members of the eLOK Systems

team Each member will use this document as a reference guide when designing and

testing Audolok to ensure the proof-of-concept and prototype model meets the design

specifications and correct behaviour In addition the design specifications document will

be used to measure progress during the development period and to aid the marketing

department of eLOK Systems to find potential investors

Copyright copy 2015 eLOK Solutions 2

4 System Overview Figure 1 below shows the block diagram of the system overview of Audolok

Figure 1 Block Diagram of Audolok Systems

Each section of the block diagram is described below

Input

Mobile Application The mobile app communicates with the microcontrollers

and the server Users are able to lockunlock openclose the door with the app

as well as check the door status and view a log of when the door has been

unlocked In addition the users are able to share keys to other users

Controller

Microcontrollers The microcontrollers receive signals from both the server and

the application When a command is received the microcontroller tells the

motors to run

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 3: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions ii

Executive Summary The freedom to move around comfortably in homes and offices is often taken for

granted But it is this freedom that is embraced by individuals with limited mobility and

strength such as the elderly and physically disabled individuals These individuals often

face many challenges such as locking and unlocking doors and opening and closing

them especially if they have limited strength hand dexterity or use wheelchairs The

most common difficulties are associated with the hardware used the weight of the door

and the height of the lock or door knob [1]

eLOK Systems has designed a smart secured door called Audolok aimed to solve these

challenges With a touch of a finger Audolok will unlock and open then close and lock

itself behind you meaning minimal movement and strength needed to perform these

tasks In addition the status of the door can be checked remotely via the companion

mobile application and Wi-Fi technology Three different levels of electronic keys are

also available Trusted User Temporary User and Admin User This functionality allows

users to give access to other users so they can access their door for cases when they

arenrsquot home or for emergencies

This documentation contains all the design specification requirements needed for

Audolok eLOK Systems plans to complete a working prototype of Audolok by

December 2015 Our goal is to ease the daily tasks of individuals with limited mobility

and strength when it comes to opening and closing secured doors

Copyright copy 2015 eLOK Solutions iii

Table of Contents Executive Summary ii

List of Figures and Tables v

Glossary vii

1 Introduction 1

2 Scope 1

3 Audience 1

4 System Overview 2

5 Overall System Design 3

6 Mechanical Design Specifications 5

61 Motor Module 5

611 Servo Motor 5

612 Stepper Motor 6

613 Motor Comparison 7

614 Motor Driver 7

62 Linear Actuator 8

7 Structural Specifications 10

71 ConnectorsArms 10

72 Brackets 11

73 Enclosure 12

731 Lock System Enclosure 12

8 Electronic Design Specifications 12

81 Microcontroller 13

82 Motor System and Linear Actuator Drive Module 14

83 Power System 15

84 Wi-Fi Module 15

85 Firmware Design 15

9 Software Design Specifications 16

91 MVC Architecture 17

92 Data Models 17

Copyright copy 2015 eLOK Solutions iv

921 Database Design 18

93 Controllers 18

931 Network Specifications 19

94 Client-Server Communications 20

95 Views (User Interface) 20

10 Communication System Specifications 21

11 Test Plans 22

111 Unit Test Plans 22

1111 Microcontroller Unit Peripherals Test 22

1112 Power Supply Unit Test 22

1113 Wi-Fi Communication System Test 23

1114 Software Unit Test 23

1114 Mechanical Unit Test 24

112 Regression Test Plan 25

113 Prototype Integrated Test 27

12 Conclusion 28

Copyright copy 2015 eLOK Solutions v

List of Figures and Tables Figure 1 Block Diagram of Audolok Systems 2

Figure 2 3D Conceptual model of Audolok 4

Figure 3 3D Conceptual Model of Lock System 4

Figure 4 3D Conceptual Model of Handle Opener 4

Figure 5 LS-3006 Servo Motor [3] 5

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6] 7

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8] 8

Figure 8 PA-14 Linear Actuator [9] 8

Figure 9 12 VDC Speed vs Load for Linear Actuator [9] 9

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9] 9

Figure 11 Top View of Linear Actuator Placement 10

Figure 12 Example of Arms Required to Connect Motor and Lock [11] 11

Figure 13 Lock System Design 11

Figure 14 Ideal Gear Design for Lock System 11

Figure 15 Brackets Used to Fasten Linear Actuator [12] 12

Figure 16 Prototype Model of Enclosure 12

Figure 17 Product Model of Enclosure 12

Figure 18 Schematic Diagram of Electronic System 13

Figure 19 General Flow of the Firmware 16

Figure 20 Model-View-Controller Relation Diagram [14] 17

Figure 21 Relational Database Schema for Mobile Application 18

Figure 22 Owner GUI of list of users 21

Figure 23 Owner GUI of invitation page 21

Copyright copy 2015 eLOK Solutions vi

Table 1 Specifications for the LS-3006 Servo Motor [4] 6

Table 2 Specifications for 28BYJ-48 Stepper Motor [6] 6

Table 3 Specifications for Linear Actuator [9] 9

Table 4 Pin Occupation for Arduino 14

Table 5 Specifications for Arduino Mega 2560 [13] 14

Copyright copy 2015 eLOK Solutions vii

Glossary 3G Third Generation of Mobile Telecommunications Technology

4G Fourth Generation of Mobile Telecommunications Technology

3D Three Dimensional

AC-DC Alternating Current - Direct Current

API Application Program Interface

GUI Graphical User Interface

HTTP Hypertext Transfer Protocol

IDE Integrated Development Environment

IEEE Electrical Electronic Engineers

iOS iPhone Operating System

IP Internet Protocol

JDBC Java Database Connectivity Technology

MCU Microcontroller Unit

MVC Model-View-Controller

PC Personal Computer

PCB Printed Circuit Board

PHP Hypertext Preprocessor

PWM Pulse Width Modulation

RampD Research and Development

RFID Radio Frequency Identification

SMT Surface Mount Technology

SSID Service Set Identifier

TCP Transmission Control Protocol

UDP User Datagram Program

UI User Interface

USB Universal Serial Bus

WPA Wi-Fi Protected Access

Copyright copy 2015 eLOK Solutions 1

1 Introduction New technologies and innovations are constantly showing up on todayrsquos market One

new technology is electronic locks These locks are controlled by Smartphonersquos or RFID

cards eLOK Systems has designed a product called Audolok which improves electronic

locks by adding more features Audolok has three main features

LockUnlock using mobile application

Automatically open and close door

Electronic shareable keys

Since Smartphonersquos are becoming very popular in todayrsquos generation all the features

are conveniently accessed via the companion mobile application Audolok App Mobile

phones require very little movement so it will alleviate the challenges faced by

individuals with limited mobility and strength Audolok is an assembly of systems

containing an Arduino microcontroller Wi-Fi shields and motor drivers Mechanical parts

controlled by the MCUrsquos are motors rotating arms and linear actuators A database will

provide locations for authority and server based actions

2 Scope This document outlines the design specifications for the proof-of-concept and prototype

model of Audolok The design specifications will cover the mechanical and electrical

components used in the design 3D conceptual models of the product and subsystems

the microcontroller design as well as software design and UI requirements It will make

cross references to the functional requirements listed in Functional Specifications for

Audolok [2] to justify the design choice The classifications referenced in Functional

Specifications for Audolok have the form [Rn-p] where Rn is the requirement number

and p is the priority of the specification In addition this document will also include test

cases for each component and the expected behavior of each test

3 Audience

Our design specifications are intended for use by all members of the eLOK Systems

team Each member will use this document as a reference guide when designing and

testing Audolok to ensure the proof-of-concept and prototype model meets the design

specifications and correct behaviour In addition the design specifications document will

be used to measure progress during the development period and to aid the marketing

department of eLOK Systems to find potential investors

Copyright copy 2015 eLOK Solutions 2

4 System Overview Figure 1 below shows the block diagram of the system overview of Audolok

Figure 1 Block Diagram of Audolok Systems

Each section of the block diagram is described below

Input

Mobile Application The mobile app communicates with the microcontrollers

and the server Users are able to lockunlock openclose the door with the app

as well as check the door status and view a log of when the door has been

unlocked In addition the users are able to share keys to other users

Controller

Microcontrollers The microcontrollers receive signals from both the server and

the application When a command is received the microcontroller tells the

motors to run

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 4: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions iii

Table of Contents Executive Summary ii

List of Figures and Tables v

Glossary vii

1 Introduction 1

2 Scope 1

3 Audience 1

4 System Overview 2

5 Overall System Design 3

6 Mechanical Design Specifications 5

61 Motor Module 5

611 Servo Motor 5

612 Stepper Motor 6

613 Motor Comparison 7

614 Motor Driver 7

62 Linear Actuator 8

7 Structural Specifications 10

71 ConnectorsArms 10

72 Brackets 11

73 Enclosure 12

731 Lock System Enclosure 12

8 Electronic Design Specifications 12

81 Microcontroller 13

82 Motor System and Linear Actuator Drive Module 14

83 Power System 15

84 Wi-Fi Module 15

85 Firmware Design 15

9 Software Design Specifications 16

91 MVC Architecture 17

92 Data Models 17

Copyright copy 2015 eLOK Solutions iv

921 Database Design 18

93 Controllers 18

931 Network Specifications 19

94 Client-Server Communications 20

95 Views (User Interface) 20

10 Communication System Specifications 21

11 Test Plans 22

111 Unit Test Plans 22

1111 Microcontroller Unit Peripherals Test 22

1112 Power Supply Unit Test 22

1113 Wi-Fi Communication System Test 23

1114 Software Unit Test 23

1114 Mechanical Unit Test 24

112 Regression Test Plan 25

113 Prototype Integrated Test 27

12 Conclusion 28

Copyright copy 2015 eLOK Solutions v

List of Figures and Tables Figure 1 Block Diagram of Audolok Systems 2

Figure 2 3D Conceptual model of Audolok 4

Figure 3 3D Conceptual Model of Lock System 4

Figure 4 3D Conceptual Model of Handle Opener 4

Figure 5 LS-3006 Servo Motor [3] 5

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6] 7

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8] 8

Figure 8 PA-14 Linear Actuator [9] 8

Figure 9 12 VDC Speed vs Load for Linear Actuator [9] 9

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9] 9

Figure 11 Top View of Linear Actuator Placement 10

Figure 12 Example of Arms Required to Connect Motor and Lock [11] 11

Figure 13 Lock System Design 11

Figure 14 Ideal Gear Design for Lock System 11

Figure 15 Brackets Used to Fasten Linear Actuator [12] 12

Figure 16 Prototype Model of Enclosure 12

Figure 17 Product Model of Enclosure 12

Figure 18 Schematic Diagram of Electronic System 13

Figure 19 General Flow of the Firmware 16

Figure 20 Model-View-Controller Relation Diagram [14] 17

Figure 21 Relational Database Schema for Mobile Application 18

Figure 22 Owner GUI of list of users 21

Figure 23 Owner GUI of invitation page 21

Copyright copy 2015 eLOK Solutions vi

Table 1 Specifications for the LS-3006 Servo Motor [4] 6

Table 2 Specifications for 28BYJ-48 Stepper Motor [6] 6

Table 3 Specifications for Linear Actuator [9] 9

Table 4 Pin Occupation for Arduino 14

Table 5 Specifications for Arduino Mega 2560 [13] 14

Copyright copy 2015 eLOK Solutions vii

Glossary 3G Third Generation of Mobile Telecommunications Technology

4G Fourth Generation of Mobile Telecommunications Technology

3D Three Dimensional

AC-DC Alternating Current - Direct Current

API Application Program Interface

GUI Graphical User Interface

HTTP Hypertext Transfer Protocol

IDE Integrated Development Environment

IEEE Electrical Electronic Engineers

iOS iPhone Operating System

IP Internet Protocol

JDBC Java Database Connectivity Technology

MCU Microcontroller Unit

MVC Model-View-Controller

PC Personal Computer

PCB Printed Circuit Board

PHP Hypertext Preprocessor

PWM Pulse Width Modulation

RampD Research and Development

RFID Radio Frequency Identification

SMT Surface Mount Technology

SSID Service Set Identifier

TCP Transmission Control Protocol

UDP User Datagram Program

UI User Interface

USB Universal Serial Bus

WPA Wi-Fi Protected Access

Copyright copy 2015 eLOK Solutions 1

1 Introduction New technologies and innovations are constantly showing up on todayrsquos market One

new technology is electronic locks These locks are controlled by Smartphonersquos or RFID

cards eLOK Systems has designed a product called Audolok which improves electronic

locks by adding more features Audolok has three main features

LockUnlock using mobile application

Automatically open and close door

Electronic shareable keys

Since Smartphonersquos are becoming very popular in todayrsquos generation all the features

are conveniently accessed via the companion mobile application Audolok App Mobile

phones require very little movement so it will alleviate the challenges faced by

individuals with limited mobility and strength Audolok is an assembly of systems

containing an Arduino microcontroller Wi-Fi shields and motor drivers Mechanical parts

controlled by the MCUrsquos are motors rotating arms and linear actuators A database will

provide locations for authority and server based actions

2 Scope This document outlines the design specifications for the proof-of-concept and prototype

model of Audolok The design specifications will cover the mechanical and electrical

components used in the design 3D conceptual models of the product and subsystems

the microcontroller design as well as software design and UI requirements It will make

cross references to the functional requirements listed in Functional Specifications for

Audolok [2] to justify the design choice The classifications referenced in Functional

Specifications for Audolok have the form [Rn-p] where Rn is the requirement number

and p is the priority of the specification In addition this document will also include test

cases for each component and the expected behavior of each test

3 Audience

Our design specifications are intended for use by all members of the eLOK Systems

team Each member will use this document as a reference guide when designing and

testing Audolok to ensure the proof-of-concept and prototype model meets the design

specifications and correct behaviour In addition the design specifications document will

be used to measure progress during the development period and to aid the marketing

department of eLOK Systems to find potential investors

Copyright copy 2015 eLOK Solutions 2

4 System Overview Figure 1 below shows the block diagram of the system overview of Audolok

Figure 1 Block Diagram of Audolok Systems

Each section of the block diagram is described below

Input

Mobile Application The mobile app communicates with the microcontrollers

and the server Users are able to lockunlock openclose the door with the app

as well as check the door status and view a log of when the door has been

unlocked In addition the users are able to share keys to other users

Controller

Microcontrollers The microcontrollers receive signals from both the server and

the application When a command is received the microcontroller tells the

motors to run

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 5: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions iv

921 Database Design 18

93 Controllers 18

931 Network Specifications 19

94 Client-Server Communications 20

95 Views (User Interface) 20

10 Communication System Specifications 21

11 Test Plans 22

111 Unit Test Plans 22

1111 Microcontroller Unit Peripherals Test 22

1112 Power Supply Unit Test 22

1113 Wi-Fi Communication System Test 23

1114 Software Unit Test 23

1114 Mechanical Unit Test 24

112 Regression Test Plan 25

113 Prototype Integrated Test 27

12 Conclusion 28

Copyright copy 2015 eLOK Solutions v

List of Figures and Tables Figure 1 Block Diagram of Audolok Systems 2

Figure 2 3D Conceptual model of Audolok 4

Figure 3 3D Conceptual Model of Lock System 4

Figure 4 3D Conceptual Model of Handle Opener 4

Figure 5 LS-3006 Servo Motor [3] 5

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6] 7

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8] 8

Figure 8 PA-14 Linear Actuator [9] 8

Figure 9 12 VDC Speed vs Load for Linear Actuator [9] 9

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9] 9

Figure 11 Top View of Linear Actuator Placement 10

Figure 12 Example of Arms Required to Connect Motor and Lock [11] 11

Figure 13 Lock System Design 11

Figure 14 Ideal Gear Design for Lock System 11

Figure 15 Brackets Used to Fasten Linear Actuator [12] 12

Figure 16 Prototype Model of Enclosure 12

Figure 17 Product Model of Enclosure 12

Figure 18 Schematic Diagram of Electronic System 13

Figure 19 General Flow of the Firmware 16

Figure 20 Model-View-Controller Relation Diagram [14] 17

Figure 21 Relational Database Schema for Mobile Application 18

Figure 22 Owner GUI of list of users 21

Figure 23 Owner GUI of invitation page 21

Copyright copy 2015 eLOK Solutions vi

Table 1 Specifications for the LS-3006 Servo Motor [4] 6

Table 2 Specifications for 28BYJ-48 Stepper Motor [6] 6

Table 3 Specifications for Linear Actuator [9] 9

Table 4 Pin Occupation for Arduino 14

Table 5 Specifications for Arduino Mega 2560 [13] 14

Copyright copy 2015 eLOK Solutions vii

Glossary 3G Third Generation of Mobile Telecommunications Technology

4G Fourth Generation of Mobile Telecommunications Technology

3D Three Dimensional

AC-DC Alternating Current - Direct Current

API Application Program Interface

GUI Graphical User Interface

HTTP Hypertext Transfer Protocol

IDE Integrated Development Environment

IEEE Electrical Electronic Engineers

iOS iPhone Operating System

IP Internet Protocol

JDBC Java Database Connectivity Technology

MCU Microcontroller Unit

MVC Model-View-Controller

PC Personal Computer

PCB Printed Circuit Board

PHP Hypertext Preprocessor

PWM Pulse Width Modulation

RampD Research and Development

RFID Radio Frequency Identification

SMT Surface Mount Technology

SSID Service Set Identifier

TCP Transmission Control Protocol

UDP User Datagram Program

UI User Interface

USB Universal Serial Bus

WPA Wi-Fi Protected Access

Copyright copy 2015 eLOK Solutions 1

1 Introduction New technologies and innovations are constantly showing up on todayrsquos market One

new technology is electronic locks These locks are controlled by Smartphonersquos or RFID

cards eLOK Systems has designed a product called Audolok which improves electronic

locks by adding more features Audolok has three main features

LockUnlock using mobile application

Automatically open and close door

Electronic shareable keys

Since Smartphonersquos are becoming very popular in todayrsquos generation all the features

are conveniently accessed via the companion mobile application Audolok App Mobile

phones require very little movement so it will alleviate the challenges faced by

individuals with limited mobility and strength Audolok is an assembly of systems

containing an Arduino microcontroller Wi-Fi shields and motor drivers Mechanical parts

controlled by the MCUrsquos are motors rotating arms and linear actuators A database will

provide locations for authority and server based actions

2 Scope This document outlines the design specifications for the proof-of-concept and prototype

model of Audolok The design specifications will cover the mechanical and electrical

components used in the design 3D conceptual models of the product and subsystems

the microcontroller design as well as software design and UI requirements It will make

cross references to the functional requirements listed in Functional Specifications for

Audolok [2] to justify the design choice The classifications referenced in Functional

Specifications for Audolok have the form [Rn-p] where Rn is the requirement number

and p is the priority of the specification In addition this document will also include test

cases for each component and the expected behavior of each test

3 Audience

Our design specifications are intended for use by all members of the eLOK Systems

team Each member will use this document as a reference guide when designing and

testing Audolok to ensure the proof-of-concept and prototype model meets the design

specifications and correct behaviour In addition the design specifications document will

be used to measure progress during the development period and to aid the marketing

department of eLOK Systems to find potential investors

Copyright copy 2015 eLOK Solutions 2

4 System Overview Figure 1 below shows the block diagram of the system overview of Audolok

Figure 1 Block Diagram of Audolok Systems

Each section of the block diagram is described below

Input

Mobile Application The mobile app communicates with the microcontrollers

and the server Users are able to lockunlock openclose the door with the app

as well as check the door status and view a log of when the door has been

unlocked In addition the users are able to share keys to other users

Controller

Microcontrollers The microcontrollers receive signals from both the server and

the application When a command is received the microcontroller tells the

motors to run

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 6: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions v

List of Figures and Tables Figure 1 Block Diagram of Audolok Systems 2

Figure 2 3D Conceptual model of Audolok 4

Figure 3 3D Conceptual Model of Lock System 4

Figure 4 3D Conceptual Model of Handle Opener 4

Figure 5 LS-3006 Servo Motor [3] 5

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6] 7

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8] 8

Figure 8 PA-14 Linear Actuator [9] 8

Figure 9 12 VDC Speed vs Load for Linear Actuator [9] 9

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9] 9

Figure 11 Top View of Linear Actuator Placement 10

Figure 12 Example of Arms Required to Connect Motor and Lock [11] 11

Figure 13 Lock System Design 11

Figure 14 Ideal Gear Design for Lock System 11

Figure 15 Brackets Used to Fasten Linear Actuator [12] 12

Figure 16 Prototype Model of Enclosure 12

Figure 17 Product Model of Enclosure 12

Figure 18 Schematic Diagram of Electronic System 13

Figure 19 General Flow of the Firmware 16

Figure 20 Model-View-Controller Relation Diagram [14] 17

Figure 21 Relational Database Schema for Mobile Application 18

Figure 22 Owner GUI of list of users 21

Figure 23 Owner GUI of invitation page 21

Copyright copy 2015 eLOK Solutions vi

Table 1 Specifications for the LS-3006 Servo Motor [4] 6

Table 2 Specifications for 28BYJ-48 Stepper Motor [6] 6

Table 3 Specifications for Linear Actuator [9] 9

Table 4 Pin Occupation for Arduino 14

Table 5 Specifications for Arduino Mega 2560 [13] 14

Copyright copy 2015 eLOK Solutions vii

Glossary 3G Third Generation of Mobile Telecommunications Technology

4G Fourth Generation of Mobile Telecommunications Technology

3D Three Dimensional

AC-DC Alternating Current - Direct Current

API Application Program Interface

GUI Graphical User Interface

HTTP Hypertext Transfer Protocol

IDE Integrated Development Environment

IEEE Electrical Electronic Engineers

iOS iPhone Operating System

IP Internet Protocol

JDBC Java Database Connectivity Technology

MCU Microcontroller Unit

MVC Model-View-Controller

PC Personal Computer

PCB Printed Circuit Board

PHP Hypertext Preprocessor

PWM Pulse Width Modulation

RampD Research and Development

RFID Radio Frequency Identification

SMT Surface Mount Technology

SSID Service Set Identifier

TCP Transmission Control Protocol

UDP User Datagram Program

UI User Interface

USB Universal Serial Bus

WPA Wi-Fi Protected Access

Copyright copy 2015 eLOK Solutions 1

1 Introduction New technologies and innovations are constantly showing up on todayrsquos market One

new technology is electronic locks These locks are controlled by Smartphonersquos or RFID

cards eLOK Systems has designed a product called Audolok which improves electronic

locks by adding more features Audolok has three main features

LockUnlock using mobile application

Automatically open and close door

Electronic shareable keys

Since Smartphonersquos are becoming very popular in todayrsquos generation all the features

are conveniently accessed via the companion mobile application Audolok App Mobile

phones require very little movement so it will alleviate the challenges faced by

individuals with limited mobility and strength Audolok is an assembly of systems

containing an Arduino microcontroller Wi-Fi shields and motor drivers Mechanical parts

controlled by the MCUrsquos are motors rotating arms and linear actuators A database will

provide locations for authority and server based actions

2 Scope This document outlines the design specifications for the proof-of-concept and prototype

model of Audolok The design specifications will cover the mechanical and electrical

components used in the design 3D conceptual models of the product and subsystems

the microcontroller design as well as software design and UI requirements It will make

cross references to the functional requirements listed in Functional Specifications for

Audolok [2] to justify the design choice The classifications referenced in Functional

Specifications for Audolok have the form [Rn-p] where Rn is the requirement number

and p is the priority of the specification In addition this document will also include test

cases for each component and the expected behavior of each test

3 Audience

Our design specifications are intended for use by all members of the eLOK Systems

team Each member will use this document as a reference guide when designing and

testing Audolok to ensure the proof-of-concept and prototype model meets the design

specifications and correct behaviour In addition the design specifications document will

be used to measure progress during the development period and to aid the marketing

department of eLOK Systems to find potential investors

Copyright copy 2015 eLOK Solutions 2

4 System Overview Figure 1 below shows the block diagram of the system overview of Audolok

Figure 1 Block Diagram of Audolok Systems

Each section of the block diagram is described below

Input

Mobile Application The mobile app communicates with the microcontrollers

and the server Users are able to lockunlock openclose the door with the app

as well as check the door status and view a log of when the door has been

unlocked In addition the users are able to share keys to other users

Controller

Microcontrollers The microcontrollers receive signals from both the server and

the application When a command is received the microcontroller tells the

motors to run

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 7: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions vi

Table 1 Specifications for the LS-3006 Servo Motor [4] 6

Table 2 Specifications for 28BYJ-48 Stepper Motor [6] 6

Table 3 Specifications for Linear Actuator [9] 9

Table 4 Pin Occupation for Arduino 14

Table 5 Specifications for Arduino Mega 2560 [13] 14

Copyright copy 2015 eLOK Solutions vii

Glossary 3G Third Generation of Mobile Telecommunications Technology

4G Fourth Generation of Mobile Telecommunications Technology

3D Three Dimensional

AC-DC Alternating Current - Direct Current

API Application Program Interface

GUI Graphical User Interface

HTTP Hypertext Transfer Protocol

IDE Integrated Development Environment

IEEE Electrical Electronic Engineers

iOS iPhone Operating System

IP Internet Protocol

JDBC Java Database Connectivity Technology

MCU Microcontroller Unit

MVC Model-View-Controller

PC Personal Computer

PCB Printed Circuit Board

PHP Hypertext Preprocessor

PWM Pulse Width Modulation

RampD Research and Development

RFID Radio Frequency Identification

SMT Surface Mount Technology

SSID Service Set Identifier

TCP Transmission Control Protocol

UDP User Datagram Program

UI User Interface

USB Universal Serial Bus

WPA Wi-Fi Protected Access

Copyright copy 2015 eLOK Solutions 1

1 Introduction New technologies and innovations are constantly showing up on todayrsquos market One

new technology is electronic locks These locks are controlled by Smartphonersquos or RFID

cards eLOK Systems has designed a product called Audolok which improves electronic

locks by adding more features Audolok has three main features

LockUnlock using mobile application

Automatically open and close door

Electronic shareable keys

Since Smartphonersquos are becoming very popular in todayrsquos generation all the features

are conveniently accessed via the companion mobile application Audolok App Mobile

phones require very little movement so it will alleviate the challenges faced by

individuals with limited mobility and strength Audolok is an assembly of systems

containing an Arduino microcontroller Wi-Fi shields and motor drivers Mechanical parts

controlled by the MCUrsquos are motors rotating arms and linear actuators A database will

provide locations for authority and server based actions

2 Scope This document outlines the design specifications for the proof-of-concept and prototype

model of Audolok The design specifications will cover the mechanical and electrical

components used in the design 3D conceptual models of the product and subsystems

the microcontroller design as well as software design and UI requirements It will make

cross references to the functional requirements listed in Functional Specifications for

Audolok [2] to justify the design choice The classifications referenced in Functional

Specifications for Audolok have the form [Rn-p] where Rn is the requirement number

and p is the priority of the specification In addition this document will also include test

cases for each component and the expected behavior of each test

3 Audience

Our design specifications are intended for use by all members of the eLOK Systems

team Each member will use this document as a reference guide when designing and

testing Audolok to ensure the proof-of-concept and prototype model meets the design

specifications and correct behaviour In addition the design specifications document will

be used to measure progress during the development period and to aid the marketing

department of eLOK Systems to find potential investors

Copyright copy 2015 eLOK Solutions 2

4 System Overview Figure 1 below shows the block diagram of the system overview of Audolok

Figure 1 Block Diagram of Audolok Systems

Each section of the block diagram is described below

Input

Mobile Application The mobile app communicates with the microcontrollers

and the server Users are able to lockunlock openclose the door with the app

as well as check the door status and view a log of when the door has been

unlocked In addition the users are able to share keys to other users

Controller

Microcontrollers The microcontrollers receive signals from both the server and

the application When a command is received the microcontroller tells the

motors to run

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 8: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions vii

Glossary 3G Third Generation of Mobile Telecommunications Technology

4G Fourth Generation of Mobile Telecommunications Technology

3D Three Dimensional

AC-DC Alternating Current - Direct Current

API Application Program Interface

GUI Graphical User Interface

HTTP Hypertext Transfer Protocol

IDE Integrated Development Environment

IEEE Electrical Electronic Engineers

iOS iPhone Operating System

IP Internet Protocol

JDBC Java Database Connectivity Technology

MCU Microcontroller Unit

MVC Model-View-Controller

PC Personal Computer

PCB Printed Circuit Board

PHP Hypertext Preprocessor

PWM Pulse Width Modulation

RampD Research and Development

RFID Radio Frequency Identification

SMT Surface Mount Technology

SSID Service Set Identifier

TCP Transmission Control Protocol

UDP User Datagram Program

UI User Interface

USB Universal Serial Bus

WPA Wi-Fi Protected Access

Copyright copy 2015 eLOK Solutions 1

1 Introduction New technologies and innovations are constantly showing up on todayrsquos market One

new technology is electronic locks These locks are controlled by Smartphonersquos or RFID

cards eLOK Systems has designed a product called Audolok which improves electronic

locks by adding more features Audolok has three main features

LockUnlock using mobile application

Automatically open and close door

Electronic shareable keys

Since Smartphonersquos are becoming very popular in todayrsquos generation all the features

are conveniently accessed via the companion mobile application Audolok App Mobile

phones require very little movement so it will alleviate the challenges faced by

individuals with limited mobility and strength Audolok is an assembly of systems

containing an Arduino microcontroller Wi-Fi shields and motor drivers Mechanical parts

controlled by the MCUrsquos are motors rotating arms and linear actuators A database will

provide locations for authority and server based actions

2 Scope This document outlines the design specifications for the proof-of-concept and prototype

model of Audolok The design specifications will cover the mechanical and electrical

components used in the design 3D conceptual models of the product and subsystems

the microcontroller design as well as software design and UI requirements It will make

cross references to the functional requirements listed in Functional Specifications for

Audolok [2] to justify the design choice The classifications referenced in Functional

Specifications for Audolok have the form [Rn-p] where Rn is the requirement number

and p is the priority of the specification In addition this document will also include test

cases for each component and the expected behavior of each test

3 Audience

Our design specifications are intended for use by all members of the eLOK Systems

team Each member will use this document as a reference guide when designing and

testing Audolok to ensure the proof-of-concept and prototype model meets the design

specifications and correct behaviour In addition the design specifications document will

be used to measure progress during the development period and to aid the marketing

department of eLOK Systems to find potential investors

Copyright copy 2015 eLOK Solutions 2

4 System Overview Figure 1 below shows the block diagram of the system overview of Audolok

Figure 1 Block Diagram of Audolok Systems

Each section of the block diagram is described below

Input

Mobile Application The mobile app communicates with the microcontrollers

and the server Users are able to lockunlock openclose the door with the app

as well as check the door status and view a log of when the door has been

unlocked In addition the users are able to share keys to other users

Controller

Microcontrollers The microcontrollers receive signals from both the server and

the application When a command is received the microcontroller tells the

motors to run

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 9: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 1

1 Introduction New technologies and innovations are constantly showing up on todayrsquos market One

new technology is electronic locks These locks are controlled by Smartphonersquos or RFID

cards eLOK Systems has designed a product called Audolok which improves electronic

locks by adding more features Audolok has three main features

LockUnlock using mobile application

Automatically open and close door

Electronic shareable keys

Since Smartphonersquos are becoming very popular in todayrsquos generation all the features

are conveniently accessed via the companion mobile application Audolok App Mobile

phones require very little movement so it will alleviate the challenges faced by

individuals with limited mobility and strength Audolok is an assembly of systems

containing an Arduino microcontroller Wi-Fi shields and motor drivers Mechanical parts

controlled by the MCUrsquos are motors rotating arms and linear actuators A database will

provide locations for authority and server based actions

2 Scope This document outlines the design specifications for the proof-of-concept and prototype

model of Audolok The design specifications will cover the mechanical and electrical

components used in the design 3D conceptual models of the product and subsystems

the microcontroller design as well as software design and UI requirements It will make

cross references to the functional requirements listed in Functional Specifications for

Audolok [2] to justify the design choice The classifications referenced in Functional

Specifications for Audolok have the form [Rn-p] where Rn is the requirement number

and p is the priority of the specification In addition this document will also include test

cases for each component and the expected behavior of each test

3 Audience

Our design specifications are intended for use by all members of the eLOK Systems

team Each member will use this document as a reference guide when designing and

testing Audolok to ensure the proof-of-concept and prototype model meets the design

specifications and correct behaviour In addition the design specifications document will

be used to measure progress during the development period and to aid the marketing

department of eLOK Systems to find potential investors

Copyright copy 2015 eLOK Solutions 2

4 System Overview Figure 1 below shows the block diagram of the system overview of Audolok

Figure 1 Block Diagram of Audolok Systems

Each section of the block diagram is described below

Input

Mobile Application The mobile app communicates with the microcontrollers

and the server Users are able to lockunlock openclose the door with the app

as well as check the door status and view a log of when the door has been

unlocked In addition the users are able to share keys to other users

Controller

Microcontrollers The microcontrollers receive signals from both the server and

the application When a command is received the microcontroller tells the

motors to run

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 10: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 2

4 System Overview Figure 1 below shows the block diagram of the system overview of Audolok

Figure 1 Block Diagram of Audolok Systems

Each section of the block diagram is described below

Input

Mobile Application The mobile app communicates with the microcontrollers

and the server Users are able to lockunlock openclose the door with the app

as well as check the door status and view a log of when the door has been

unlocked In addition the users are able to share keys to other users

Controller

Microcontrollers The microcontrollers receive signals from both the server and

the application When a command is received the microcontroller tells the

motors to run

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 11: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 3

Server

Server The server communicates with the microcontroller and the mobile

application The server is where all the authentication data is stored Once the

server confirms the identity of the user it allows access to the system It also

stores data of when the door is locked and unlocked which can be shown in a log

on the mobile application

Mechanics

Motor A motor is used to rotate the deadlock Once the microcontrollers receive

command to unlock or lock the door it sends the signal to the motor and the

motor will rotate in its respective direction clockwise for locking and counter

clockwise for unlocking

Linear Actuator A linear actuator is used to open and close the door One end

of the linear actuator is connected to the door and the other is connected to the

wall Once it receives the command to openclose the door the linear actuator

will retractextend

Outputs

Lock The motor along with mechanical parts such as rotating arms will turn the

lock which unlocks the door When the door closes these mechanisms will turn

back to lock the lock

Door When the linear actuator retracts the door will be pulled open When the

linear actuator extends the door will be pushed closed

5 Overall System Design This section provides an overview of the entire Audolok system design The design

specifications for each component of Audolok are separated into the following sections

mechanical structural electronics software and communications A conceptual 3D

model of Audolokrsquos systems is shown below in figure 2

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 12: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 4

Figure 2 3D Conceptual model of Audolok

Figure 3 3D Conceptual Model of Lock System

Figure 4 3D Conceptual Model of Handle Opener

In figure 2 the placement of the linear actuator is shown which is used to open and

close the door When the linear actuator is fully extended the door will be closed When

the linear actuator is fully retracted the door will be fully open The installation of the

linear actuator follows requirement [R3-iii] as it is simple and only needs two brackets to

be fastened one into the wall and the other into the door Requirement [R4-iii] is also

satisfied here as the linear actuator can easily be replaced if damaged Since all the

mechanical parts of Audolok are placed on the inside of the door each part will be

protected from the weather [R5-iii]

Figure 3 shows the 3D conceptual model of the locking system The motor and the lock

have arms attached which are connected by a wire When the motor rotates it will push

and pull the arm of the lock Figure 4 shows how the door handle will be opened A

linear actuator will push the handle down and then when it retracts the handle will go

back to its original state

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 13: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 5

6 Mechanical Design Specifications This section covers all the mechanical design specifications for Audolok It includes the

motors and linear actuators

61 Motor Module A motor is required to turn the deadbolt lock Two of the most popular types of motors

are servo motors and stepper motors The two models which are considered for

Audoloks purposes are the LS-3006 analog servo motor and the 28BYJ-48 stepper

motor The torque supplied by the motor is one of the most important features to

consider for Audolok The torque required to turn a deadbolt varies from 23kg-cm to

3kg-cm depending on the stiffness of the lock and both models satisfy this torque Both

requirements [R38-i] and [R39-ii] are also satisfied with both locks as they rotate

bidirectional and will be used to rotate the deadbolt lock

611 Servo Motor The servo motor that was considered for the design is the LS-3006 analog servo motor

For the prototype design this motor is useful as it comes with servo arms which makes

it easier to attach locking structures Servo motors are also fast and have high torque

however they are more complicated when setting up with PWM tuning Looking at Table

1 below we note that the servo motor supplies a minimum torque of 55kg-cm which is

plenty to turn the deadbolt lock

Figure 5 LS-3006 Servo Motor [3]

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 14: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 6

Table 1 Specifications for the LS-3006 Servo Motor [4]

Specification Value Value

Rated Voltage 48V 60V

Operating Speed 014s60deg 012s60deg

Running Current 250mA 300mA

Stall Current 13A 15A

Torque 55kg-cm 6kg-cm

Weight 40g 40g

Manual Override yes yes

The servo motor has 3 inputs ground power and signal therefore the servo motor will

occupy 3 pins in the Arduino

612 Stepper Motor Stepper motors are slower than servo motors but have precise rotation and easy setup

and control The advantage stepper motors have over servo motors are that they are

better in positional control Stepper motors operate via rotation by fractional increments

whereas servos require feedback mechanisms and support circuitry to drive positioning

[5] The specifications for the 28BYJ-48 stepper motor are shown in table 2

Table 2 Specifications for 28BYJ-48 Stepper Motor [6]

Specification Value

Rated Voltage 5V DC

Number of Phases 4

Speed Variation Ratio 164

Stride Angle 5625deg64

Frequency 100Hz

Torque 35kg-cm

Weight 32g

Manual Override No

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 15: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 7

Figure 6 28BYJ-48 Stepper Motor and ULN2003 Motor Driver [6]

The stepper motor has 5 inputs however a motor driver is needed to power the stepper

motor (for details see section 614 Motor Driver) In addition the stepper motor

requires external power as the Arduino does not supply an efficient amount of power to

power the motor

613 Motor Comparison

Comparing both types of motors we note that both have an equal amount of pros and

cons to consider for Audoloks design Where servo motors are fast strong and can be

manually overridden they lack positional accuracy On the other hand stepper motors

are slower less strong and canrsquot be manually controlled but they offer positional

accuracy easier to setup and control and are light weight Since the motor will be used

to rotate the deadbolt to specific positions the stepper motor is chosen as it has more

precise positioning

614 Motor Driver Stepper motors require motor driver boards to function The motor driver separates the

power flowing to the microcontroller from the power flowing to the motor since motors

need more power than the microcontrollers can supply [7] Stepper motor drivers

provide fractional steps which smoothens the rotation of the motor gears and satisfies

requirement [R21-iii] The motor driver board selected for our product is the ULN2003

model shown in figure 6 above The schematics for the ULN2003 motor driver is shown

in figure 7 where it shows that pins 8 through 11 of the Arduino are connected to the

motor driver inputs 1 through 4 respectively When implementing the code inputs [1 2 3

4] of the motor driver correspond to inputs [8 10 9 11] of the Arduino

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 16: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 8

Figure 7 Schematic Diagram of the ULN2003 Motor Driver [8]

62 Linear Actuator

Figure 8 PA-14 Linear Actuator [9]

One key requirement of Audolok is to automatically open and close the door As

mentioned in the functional specifications [R18-ii] and [R19-ii] the door shall open and

close automatically A linear actuator is chosen to perform the opening and closing

action The torque of the linear actuator must be strong enough to pull and push the

door Requirement [R22-iii] will also be satisfied with the linear actuator as the door

should open and close smoothly To choose the model of the linear actuator torque

speed and load has to be considered Figure 9 shows a graph of speed vs load for

12VDC linear actuators [9]

Comparing the loads and speeds in figure 9 it is shown that faster speeds can only

handle light loads of up to 35lbs Standard doors weigh about 80-120lbs depending on

the material therefore our application requires a linear actuator that can withstand a

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 17: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 9

weight of that range [10] The 150lbs option is the best which supplies a speed of 050

ins or 127cms

Figure 9 12 VDC Speed vs Load for Linear Actuator [9]

Figure 10 Comparison Between No Load and Full Load for Linear Actuator [9]

The length of the linear actuator must also be considered because it needs to be long

enough to fully open the door When the linear actuator is fully extended the total length

is 413rdquo+stroke+stroke whereas when it is fully retracted the length is 413rdquo+stroke For

the PA-14 model linear actuator there are stroke length options of 1rdquo to 40rdquo Table 3

shows the specifications of the PA-14 linear actuator model

Table 3 Specifications for Linear Actuator [9]

Specification Value

Input Voltage 12 VDC

Current 4A at full load

Load Capacity 35lbs 50lbs 150lbs

Stroke Length range 1rdquo-40rdquo

Fully Retracted Length 413rdquo+stroke

Fully Extracted Length 413rdquo+stroke+stroke

Operation Temperature -25ordm C - +65 deg C

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 18: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 10

The linear actuator requires a 12V input therefore a converter will be used to convert

the wall power voltage to the required 12V The linear actuator also needs a motor

driver The same motor driver used for the stepper motor can be used for this function

Placement of the linear actuator can be at any height of the door but is recommended

to be placed in the middle or top so it does not interfere or get accidentally hit One end

of the linear actuator should be placed as close to the middle of the door as possible

and the other end should be placed on the wall making a small triangle (figure 11)

Since all doors are placed differently inside a house different stroke sizes can be

selected to accommodate the different placement Brackets are used to fasten the ends

of the linear actuator in place This design specification is described in section 72

Figure 11 Top View of Linear Actuator Placement

A linear actuator will also be used to open and close the door handle The linear

actuator will be pointing to the handle and when it extends it will push the handle

down retracting the mishandling device Once the linear actuator retracts the handle

will be released and the mishandling device will extract

7 Structural Specifications

71 ConnectorsArms In order to turn the lock arms are needed to connect the motor and lock together The

arms should not obstruct the lock so that the lock can be turned manually In addition

the arms must be strong enough to withstand the torque of turning the lock For this

reason metal or thick plastic arms can be used Figure 12 shows an example of arms

that can be used for our application A wire will attach the two arms together so that

when the motor rotates both arms will move at the same time

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 19: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 11

Figure 12 Example of Arms Required to Connect Motor and Lock [11]

Figure 13 Lock System Design

Another proposed design for Audolok is made out of gears This design is desired for

the final product of Audolok Two gears will be used one attached to the motor and one

that fits over the deadbolt lock When the motor rotates both gears will turn

lockingunlocking the deadbolt Figure 14 shows the ideal conceptual model of the

Audolok locking system

Figure 14 Ideal Gear Design for Lock System

72 Brackets The brackets used to support the linear actuator and fasten it to the wall and door is

shown below in figure 15 These brackets require a screw to secure them They are

easy to install and are light and compact The two brackets will be in different positions

The bracket attached to the door will have the holes facing the top and bottom of the

door This allows the linear actuator to swing left and right when the door is moving The

bracket connected to the wall will have the holes facing left and right This placement

allows the linear actuator to swing up and down when the door moves

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 20: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 12

Figure 15 Brackets Used to Fasten Linear Actuator [12]

73 Enclosure

731 Lock System Enclosure

The prototype enclosure for Audolokrsquos lock system will be made from acrylic plastic The

motor and the microcontroller will be attached to the plastic sheet and suspended so it

doesnrsquot touch the wall The plastic sheet will be big enough for all the components and

wires so nothing is exposed A 3D model of the enclosure is shown below in figure 16

Figure 16 Prototype Model of Enclosure

Figure 17 Product Model of Enclosure

The enclosure for the final product will satisfy requirements [R10-iii] [R11-iii] and [R12-

iii] to have round edges not exceed 10cmx10cmx5cm in dimension and weigh no more

than 2kg The final enclosure will be a box that can fit over the lock and be easily

attached to the door (Figure 17)

8 Electronic Design Specifications This section outlines the full electronic design of Audolok There are 4 sections

included Microcontroller Motor Driver Power System and Wi-Fi Module The

schematic diagram of the electronic system design is shown in figure 18 It shows all the

inputs and outputs and which pin each component is connected to

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 21: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 13

Figure 18 Schematic Diagram of Electronic System

81 Microcontroller In order to meet requirements [R51-i][R52-i][R53-i][R58-i] and [R60-i] an Arduino

Series Microcontroller was selected as the control unit for Audolok In addition it has

the following advantages strong community support well encapsulated and various

peripherals choices

In the proof-of-concept designing stage since the eLOK System team had several

Arduino Unorsquos from previous projects and since some of the RampD team members had

conflicting schedules Arduino Unorsquos were selected for testing each subsystem so they

could be individually tested At the start the Arduino Uno was considered to be the

microcontroller for Audolok as it is more affordable and occupies little space However

the ESP8266 Wi-Fi Module requires the pair of serial communication pinsTX0 and

RX0 This makes it impossible to monitor and debug the Arduinorsquos activity on the Com

Monitor from its PC end IDE without an external TTL-USB board which will occupy 4

additional pins That being said there will be an insufficient number of available pins for

the motor and linear actuator modules if an external TTL-USB module was added to the

Arduino Uno Therefore we had to consider other microcontroller options with more

available pins

In the prototype phase in order to integrate and control the motor module linear

actuator module and communications between the mechanics and software and under

consideration of pin occupancy specification of each subsystem as listed in Table 4 the

Arduino Mega 2560 microcontroller with the technical specifications in Table 5 was

selected The Arduino Mega 2560 is better suited for Audolok as it offers 4 pairs of

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 22: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 14

serial communication which enables serial communication with the TX0 and RX0 pins

which is for USB communication with the PC and it has more pins than the Arduino

Uno

Table 4 Pin Occupation for Arduino

Sub System Occupied Pins

Linear Actuator for door movement

Pin 23 for PWM output

Motor system for door lock Pin 4567 to connect with ULN2003

Motor System for door handler Pin 891011 to connect with ULN2003

ESP8266 Wi-Fi Module for communication

Pin Tx1 Rx1 for serial communication with serial ESP8266 Wi-Fi board

Serial Monitor on PC Pin Tx0 Rx0 for serial-usb communication with PC

Table 5 Specifications for Arduino Mega 2560 [13]

Microcontroller ATmega2560

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital IO Pins 54 (of which 15 provide PWM output)

Analog Input Pins 16

DC Current per IO Pin 20 mA

DC Current for 33V Pin 50 mA

Flash Memory 256 KB of which 8 KB used by bootloader

SRAM 8 KB

EEPROM 4 KB

Clock Speed 16 MHz

Length 10152 mm

Width 533 mm

Weight 37 g

82 Motor System and Linear Actuator Drive Module All motor subsystem will be integrated with the ULN2003 driver module and Arduino

Uno for the proof-of-concept design on several characteristics such as how to control

angular displacement with specified steps for the motor As the linear actuator is simply

controlled by the PWM signal the proof-of-concept is only concerned about controlling

the stretch speed with the microcontroller

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 23: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 15

In the prototype and product phase as stated in microcontroller section 81 the motor

system and linear actuator will be integrated with an Arduino Mega

83 Power System In the proof-of-concept phase all subsystem will be powered by the USB power port or

DC power supply In the prototyping phase of the product the power system will be

divided into 2 parts MCUCommunication and Dynamic parts in order to meet [R14-ii]

for reduction of signal crossing In order to satisfy [R13-i] and [R54-i] the MCU

communication component is powered by a 110V-9V AC-DC adapter and the Wi-Fi

module is powered through 33V pin from Arduino as it has low power consumption In

addition the dynamic system which includes the motor and linear actuator is powered

by a 110v-12V AC-DC adapter with a voltage division circuits to meet [R13-i]

84 Wi-Fi Module In order to meet [R60-i] and [R24-ii] an ESP 8688 serial to Wi-Fi 24GHz module was

selected for all design phases of Audolok for its simplicity of use well encapsulated

library and low power consumption compared to the Arduino Wi-Fi Shield Equipped

with external pins it can be connected to the Arduino via jumper wires or soldering

board for the proof-of-concept and prototype by [R52-i] and it is also an SMT(Surface

Mount Technology) suitable for PCB designs in the product phase

85 Firmware Design In order to satisfy [R66-ii] on response time an external interrupt driven firmware

structure is desired In this structure all mechanical movement will be wrapped up to

increase the reliability of the system with a 5s delay between each procedures such as

unlocking the lock turning the door handle and opening the door In addition to meet

[R60-i] the Wi-Fi auto connection will be performed to establish a communication

between the hardware and Wi-Fi router with a preset SSID and password Furthermore

to meet the security requirement [R24-ii] a timeout exception is also desired in case

users forget to close the door The general flow chart of the firmware has been provided

in Figure 19

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 24: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 16

Figure 19 General Flow of the Firmware

9 Software Design Specifications eLOK Systems has developed a mobile app for user interaction and system feedback It

will be the primary interface for users and will be the intuitive way and ultimate key to

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 25: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 17

usersrsquo homes All that is required is a mobile Smartphone and wireless Bluetooth

connection 3G4G or Wi-Fi The app software system will meet requirements [R61-i]

[R65-ii] and [R66-ii]

The first phase of the app will be launched on the Apple iOS platform for the proof-of-

concept and prototype phases The Android compatible applications will be supported in

future enhancements and will be determined by user experience from customers and

market feedback

91 MVC Architecture The app is built on the basis of the Model-View-Controller design paradigm which is

also known as the MVC prototype as per Applersquos recommended guidelines for iOS app

development The sections for data (model) logic (controller) and user interface (view)

with interactions among each part are demonstrated in the MVC relationship diagram in

Figure 20 Controllers will be responsible for transmission and performance to bridge

the UI and updated data

Figure 20 Model-View-Controller Relation Diagram [14]

92 Data Models The data model of the Audolok app consists of two classes UI (views) and network

bridge (controllers) These two classes facilitate all aspects of the Bluetooth discovery

network connection establishment data transformation data transmission and data

security The detailed data structure will be demonstrated in database design in the

following section

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 26: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 18

921 Database Design

The database server is where usersrsquo data is stored securely and remotely updated from

UI inputs MySQL database will be implemented as the main database server where the

web server and database is connected via JDBC(Java Database Connectivity

Technology) JDBC is a Java API that defines the clientrsquos access to a database The

database is responsible for [R63-i] and [R69-ii]

Figure 21 is a database schema describing the database system structure among all

tables Each table is storage for different types of data the primary keys are defined

and the relationships between each other are also clear The implementation of the

database will follow the schema and inner logics of figure 21

Figure 21 Relational Database Schema for Mobile Application

93 Controllers Referring to the development guidelines of Apple iOS applications controller classes

are where data models are defined for each view and their dedicated functions Every

view which also can be seen as an interface should have at least one controller

Multiple controllers exist for handling delegations and complicated data structure

combinations

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 27: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 19

931 Network Specifications

Besides controllers for each single view of the app data model management for

network connections is an essential part of the general application logic The classes

are defined for two circumstances where there is Wi-Fi3G4G network and where there

is not In the later situation Bluetooth connection will be necessary However Bluetooth

integration has been moved out of the first prototype designs and will be integrated in

further phases as well as the final product The controllers also include responses to UI

actions when data is updating from controllers to the database which means at least

one of the two classes should function properly Requirements defined in [R64-i] are the

ultimate goals of the final product

9311 Wi-Fi

According to the Captive Network Reference provided by the Apple iOS Developer

Library [15] the Captive Network Support will be responsible for detecting networks that

require user interaction before providing internet access

By calling the function defined in Captive Network the application can register a list of

wireless network SSIDs with Captive Network Support thereby assuming responsibility

for authenticating with those networks If the Wi-Fi network is not available in some

areas Bluetooth controllers will be called alternatively instead of the Captive Network

Support

9312 Bluetooth

This section will cover Bluetooth capabilities however it should be noted that Bluetooth will be available in later phases of Audolok designs and this section only introduces the topic When the Audolok app is launched the Bluetooth connection will start immediately after scanning for a Wi-Fi network and getting negative feedback The classes needed are defined in the Core Bluetooth framework referring to Core Bluetooth Programming Guide provided by the Apple iOS Developer Library

If the device is discovered the request will be sent to the user to confirm Bluetooth connection by appearing on screen as a notification If the connection is confirmed successfully the device will be connected The same behaviour occurs for Wi-Fi network connection If the connection is unsuccessful the notification will appear repetitively on the screen until the connection successful

The timeout interval is five seconds for the first try to connect via Bluetooth and the user will be notified when it has timed out Packages of requests will keep being sent to the device until the connection is set up after one timeout If an abrupt disconnection in Bluetooth occurs a notification will be sent from Core Bluetooth to the application

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 28: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 20

terminal [16] This notification will trigger a warning on the interface to inform the user about the disconnection and also suggest the Bluetooth connection for the user

94 Client-Server Communications After the creation of the database and verification functionalities on PHPSQL the

implementation of PHP web service will be responsible for authentication each time the

owner logs in and retrieves the information stored in MySQL [17] GET and POST are

the main strategies to redeem parameters throughout URL or any requested body and

they are parts of the HTTP protocol running over TCPIP

The general algorithm is to make sure the required parameters are passed through

POST then to confirm the code is actually in the SQL database After checking to see if

the code is in the SQL database the redeem loop will run to start the web service

implementation Overall the implementation will be in PHP

95 Views (User Interface) In order to create a simple user-friendly app careful attention to the user interface has

been made The GUI design patterns all follow the Human Interface Guidelines

provided by Apple iOS Developer Library The GUI design will meet requirements [R62-i]

and [R68-iii]

The views are organized into two groups one for the owners and the other for guests

Requirements [R72-ii] and [R73-ii] are met to prevent safety problems When the

authentication of the user is confirmed through the inputs of the login page owners and

guests will encounter two different sets of features and functions This enables the

owner to manage who can access their door while guests only have permission to open

the door but not share the key Performance requirements [R74-i] to [R78-ii] are defined

in the implementation of the app

Figures 22 and 23 show the main menu of the owner when they have multiple guests

sharing the access to the same entrance and the invitation page which allows the

owner to add more guests respectively

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 29: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 21

Figure 22 Owner GUI of list of users

Figure 23 Owner GUI of invitation page

10 Communication System Specifications The communication between software (App) and hardware (Arduino Core System) is

achieved by 24Ghz Wi-Fi connection via a router Requirements [R61-i] and [R60-i] are

met as iOS devices have Wi-Fi capability for the app to connect to the router and the

ESP8266 Wi-Fi board also enables the hardware system to connect to the router IEEE

certified Wi-Fi protocols such as 80211b and 80211g also enables connections to

exchange data within the same networkrouter

In addition information safety is also an important concern according to [R24-ii] and

Wi-Fi network has enabled various levels of security protocols such as WPA and WPA2

Furthermore as most mainstream routers allow multiple Wi-Fi channels to be

broadcasted at the same time it enables us to set up a special channel for Audolok to

increase the security level

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 30: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 22

11 Test Plans This section includes test plans for all systems and components of Audolok These tests

are to be used to ensure the components and systems behave as expected First unit

tests will be listed and then an overall integrated system test plan will be covered

111 Unit Test Plans For the proof of concepts design unit tests are desired to test if each unit satisfies the functional specification mentioned in our functional specification document The unit tests will cover microcontroller peripherals power supply unit Wi-Fi communication between apps and ESP8266 software units and mechanical components

1111 Microcontroller Unit Peripherals Test The test for the microcontroller unit focuses on achieving the desired outputs obtained from the specified peripherals such as serial and PWM For the serial port and control sequences the COM monitor from Arduino IDE can be used to monitor the real time data IOs For the PWM wave oscilloscope can be used to monitor and PWM wave and measure characteristics like space ratio

Pepherials Test Procedure Required Results

Peripherals Tests

PWM Connect PWM port to oscilloscope

The space ratio from Oscilloscope should match set space ratios for Arduino and the error should not exceed 5 of the expected value

Serial Communication

When communicating through

serial 1(Tx1 and Rx1) print every received or transmitted bits to COM Monitor

The data from serial 1 should be identical to the sendreceived bits

1112 Power Supply Unit Test Pepherials Test Procedure Required Results

Component Tests

Power Supply Connect multimeter to desired nodes

Voltagecurrent obtained should not exceed 5 of expected value

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 31: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 23

1113 Wi-Fi Communication System Test The test of Wi-Fi Communication System will be achieved by using COM Monitor from

Arduino IDE the ESP8266 library and an app called UDP TCP Server which is available

from Google Play

Subsystem Test Procedure Required Results

Components Tests

ESP8266 Module

Check connection to Wi-Fi by Wi-Fi configuration command from the ESP8266 library

Message will be printed to the COM Monitor via serial port TX0 and RX0

Send message from UDP TCP Server to ESP8266 via Wi-Fi Router

Proper message received from app and printed on COM monitor Received message should be identical to the sent message of the Cellphone

1114 Software Unit Test Subsystem Test Procedure Required Results

Components Tests

Application Operation

Click on app icon on mobile device

Application UI with the starting view (login page) appears within a responding time of 3 seconds or less If the timeout is reached the app will quit itself asking for a reboot

User Authentication

Input username and password to ask for permission to enter the owner dashboard

After the authentication is confirmed the view will be changed to the owner dashboard with submenus for owners to choose from

Network Connection

Under Wi-Fi network conditions try asking for a Wi-Fi network first if there is no Wi-Fi network try connecting with server via Bluetooth

If there is no Wi-Fi network or Wi-Fi network is weak Bluetooth connections should appear automatically after the failure of connections via Wi-Fi

Information Security

Try to get into the dashboard or state of lock page without logging in through correct username and password

There should be no way to get into the dashboard or state page without logging in the notifications asking users to log in should appear respectively on usersrsquo screen

Temporary Access(guests)

Try to extend the access time of the guest using guest account

No option is available or the section will be greyed out Guests should not be able to shorten or extend their temporary access only the owner (administrator) has the authority

Temporary Access(owner)

Try to extend the access time of a guest using Admin account

The owner should be able to shorten or extend temporary access assigned to any guests

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 32: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 24

Assigning Access(guests)

Try to assign access to guests in contacts by sending them invitations when the user is a guest

The guest cannot assign access to any other guests Option should be disabled

Assigning Access(owner)

Try to assign access to guests in contacts by sending them invitations when the user is the owner

The owner can assign access to any guests already existed or new guests

In-app Doorbell Guests press in-app doorbell button

The owner receives notifications of guests ringing the virtual doorbell

Lock State Swipe right for lock swipe left for unlock

The page should show the current state of the lock

1114 Mechanical Unit Test This section describes unit tests for each mechanical component Several tests will be

made for different stages of the development The order of tests for each component is

hierarchical The first test is the most basic test and then following are the tests leading

to the desired function

Subsystem Test Procedure Required Results

Components Tests

Motor Upload Arduino ldquoSweeprdquo sample code and run

Motor sweeps clockwise and then counter clockwise one full rotation

Run code to make motor sweep 90 degrees and then back to 0 degrees

start at 0 deg motor rotates 90 degs and then returns to 0 deg

Run lock code several times to make sure the pin doesnrsquot offset

After a few tests motor still works properly and positions remain the same without any shifting

Connect 2 buttons to control when motor turns clockwise and counter clockwise

When button1 is pressed motor will sweep clockwise to 90deg When button2 is pressed motor will sweep counter clockwise back to 0deg

Linear Actuator

Connect to the DC power supply and use the hinge to fully connect to the door

door can move freely with linear actuator (no resist force from linear actuator)

Run sample code for linear actuator Linear actuator should extend and then retract

Door Use physical key to open the lock and push to open

Door unlocks and opens with no resistance

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 33: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 25

Electronic box

All electronic components are in a closure environment

Strongly placed on the door without losing connection while system is in different states

Time Delay Observer real time delay between each function

Observed time delay does not exceed 10 of preset delay from firmware

112 Regression Test Plan After unit tests on all subsystems and components are performed related

troubleshooting and debugging is performed to adjust all subsystems and components

in order to reach the desired requirement The regression test will start immediately on

the mechanical system as it requires most trouble shooting adjustments and tuning In

the testing process fine tuning and modification will also be performed to satisfy the

overall requirements such as unlocking turning the door handle and opening the door

Several iterations will be required to satisfy the overall functional specification For the

mechanical parts push buttons will take place of software commands

Subsystem Test Procedure Required Results

Components Tests

Phase 1 Each Individual System

Lock Press button 1 (unlock button) Motor will rotate counter clockwise and turn the lock to unlock

Press button 2 (lock button) Motor will rotate clockwise and lock the lock

Linear Actuator (Door Control)

Press button 1 (extend) Linear actuator will extend fully and door will close

Press button 2 (retract) Linear actuator will fully retract and door will open

Linear Actuator (Door Handle)

Press button 1 (extend) Linear actuator will extend fully and door handle will be pushed down retracting the mishandling device

Press button 2 (retract) Linear actuator will retract fully and door handle will be released back up extending the mishandling device

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 34: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 26

Phase 2 Integration of all Mechanical Parts

Button 1 pressed (unlock) Lock unlocks then after a short delay linear actuator pushes the handle open and finally the other linear actuator pulls the door open

Button 2 pressed (lock) Linear actuator pushes door closed second linear actuator retracts allowing the handle to pull up and the mishandling device to extract and finally lock will lock

In addition to mechanical system integration regression tests the software system

power system microcontroller system and wireless communication system will be

integrated for regression test as well and the output pins and for the mechanical system

will also be monitored in real time by a multimeter and oscilloscope The following tests

are for checking the software outputs via an oscilloscope Apptium and Matlab

Test Case Test Procedure Required Results

User switch lock state to lock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

User switch lock state to unlock from app

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

After receiving notifications from the server switch to lock and then switch back to unlock

Use oscilloscope to observe output PWM wave and record time delay from consecutive procedures

PWM waveform and space ratio should satisfy desired outputs for the mechanical system The delay from input time to output time should not exceed 1s

Set Apptium Scripts to perform 1000 times lock and unlock switches

Set Matlab Scripts to record data from Oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 35: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 27

Set Apptium Scripts to automate app between 2 cellphones on notification transceiver activity and switches between lock and unlock states

Set Matlab Scripts to record data from oscilloscope and analyze it to obtain PWM wave frequency and space ratio

The standard deviation from all sample data should not exceed 1 and the error between the mean value and desired value should not exceed 7 The mean delay time should not exceed 1s

113 Prototype Integrated Test After each subsystem has gone through and passed their regression tests all systems

are integrated together and tested The following test plan lists the tests for the overall

system

Subsystem Test Procedure Required Results

Components Tests

Unlock Swipe switch to the left (Unlock mode) App will display Unlock State

Motor will rotate counter clockwise unlocking the deadbolt

Handle linear actuator will push the door handle down

After lock and handle actions are complete(delay of a few seconds) door linear actuator will pull the door open

Lock Swipe switch to the right (Lock mode) App will display Lock State

Door linear actuator will push the door closed

After the door closes (after a few seconds) handle linear actuator will pull the door handle up

Motor will rotate clockwise locking the deadbolt

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 36: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 28

12 Conclusion This document has outlined all the design specifications for Audolok to meet with all the

functional specifications Each system specifies which design is used for the proof-of-

concept prototype and product however some design specifications apply for all of the

developmental phases All specifications such as schematic diagrams electronic

component models placement of each component and software requirements are

outlined in detail and make cross reference to each functional specification that is

justified in each design choice In addition this document includes a full test plan

required to test each component system and overall system Through the test plans

we can ensure that each system behaves as expected The first stage of the prototype

is planned to be completed by December 17 2015 Further development and

enhancements will be considered if time permits

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 37: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 29

References

[1] Fall Prevention Center of Excellence ldquoHome Modificationsrdquo [Online] Available

httpwwwhomemodsorgresourcesdoable-homeadaptabilityshtml [Accessed 10

October 2015]

[2] eLOK Systems ldquoFunctional Specifications for Audolokrdquo [Online] Available

httpwww2enscsfuca~whitmorecoursesensc305projects2015vfuncpdf [Accessed

5 November 2015]

[3] Tiger Direct ldquoLS-3006 Servo Motorrdquo [Online] Available

httpwwwtigerdirectcomapplicationsSearchToolsitem-detailsaspEdpNo=4368546

[Accessed 1 November 2015]

[4] Osepp ldquoDatasheet for LS-3006 Servo Motorrdquo [Online] Available

httposeppcomwp-contentuploads201209LS-3006_datasheetpdf [Accessed

November 1 2015]

[5] ModMyPi ldquoWhatrsquos the Difference between Stepper and Servo Motorsrdquo[Online]

Availablehttpwwwmodmypicomblogwhats-the-difference-between-dc-servo-

stepper-motors [Accessed November 6 2015]

[6] Aimagin ldquoStepper Motor(28BYJ-48)rdquo [Online] Available

httpswwwaimagincomstepper-motor-28byj-48-5vhtml [Accessed November 3 2015]

[7] Wikipedia ldquoStepper Motor Driverrdquo [Online] Available

httprepraporgwikiStepper_motor_driver [Accessed November 6 2015]

[8] GEtech Wiki ldquoStepper Motor 5V 4-Phase 5-Wire amp ULN2003 Driver Board for

Arduinordquo [Online] Available

httpwwwgeeetechcomwikiindexphpStepper_Motor_5V_4-Phase_5-

Wire_26_ULN2003_Driver_Board_for_Arduino [Accessed Novemeber 4 2015]

[9] Progressive Automation ldquoPA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscomimagespdfMini_Linear_Actuator_PA-14pdf

[Accessed November 8 2015]

[10] Solid Wooden Doors ldquoHow much do doors weighrdquo [Online] Available

httpwwwsolidwoodendoorscomweighthtml [Accessed November 3 2015]

[11] Aliexpress ldquoFlat Steel Bracketsrdquo [Online] Available

httpwwwaliexpresscompopularflat-steel-bracketshtml [Accessed November 9 2015]

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]

Page 38: November 12th, 2015 School of Engineering Sciencewhitmore/courses/ensc305/projects/2015/vdesi.… · November 12th, 2015 Dr. Andrew Rawicz School of Engineering Science Simon Fraser

Copyright copy 2015 eLOK Solutions 30

[12] Progressive Motors ldquoBrackets for PA-14 Linear Actuatorrdquo [Online] Available

httpwwwprogressiveautomationscombrk-14ig_lightbox2[gal]3 [Accessed

November 9 2015]

[13] Arduino ldquoArduino Board Mega 2560rdquo [Online] Available

httpswwwarduinoccenMainArduinoBoardMega2560 [Accessed November 7 2015]

[14] Stevenrsquos Presentation ldquoHow APIs are changing Application Developmentrdquo [Online]

Available httpwwwslidesharenet3scalehow-apis-are-changing-software-

development [Accessed November 7 2015]

[15] Apple Developers ldquoCaptive Network Referencerdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationSystemConfigurationReference

CaptiveNetworkRefindexhtml [Accessed November 10 2015]

[16] Apple Developers ldquoCore Bluetooth Programming Guiderdquo [Online] Available

httpsdeveloperapplecomlibraryiosdocumentationNetworkingInternetWebConceptu

alCoreBluetooth_conceptsAboutCoreBluetoothIntroductionhtml [Accessed November

11 2015]

[17] Ray Wenderlich ldquoHow to Write a Simple PHP MYSQL web Service for an iOS apprdquo

[Online] Available httpwwwraywenderlichcom2941how-to-write-a-simple-

phpmysql-web-service-for-an-ios-app [Accessed November 11 2015]