IoT Security Alarm System

Overview

This project is an Internet-connected security system that connects multiple mbeds and sensors together through the Internet. There is also an accompanying web application. The system consists of a main mbed and sensor mbeds. The main mbed has a screen, keypad, speaker, RGB LED, sensor, and Ethernet. The sensor mbeds have a sensor, speaker, and Ethernet (or Wi-Fi). The sensor mbeds communicate with the main mbed through the Internet using a web server and database server in the cloud. When one of the sensors is triggered, the entire system begins going off, and must be disarmed using the web app or keypad on the main mbed. Two codes must be entered into the keypad: first a random code that is generated through the web app and second a random code that is sent via text message after the first code is entered correctly. Temporary codes can be generated via the web app, such that personal codes do not have to be shared with contractors, babysitters, etc. The temporary codes will expire after a designated time has passed. All mbeds must have access to the Internet. They do not need to be on the same local network as they don't talk to each other directly. This is a continuation of https://developer.mbed.org/users/jbenamy/notebook/iot-ir-driven-security-alarm/.

ECE 4180 Group

  • Joseph Benamy (Section A)
  • Tal Landes (Section A)
  • Jacob Smith (Section A)

Demo

Block Diagram

/media/uploads/jbenamy/block_diagram.png

Web Component

The system is supported by an external web server and database server hosted in the cloud. The web server is Apache and the database server is MySQL. The web application is written in PHP and MySQL with an HTML/CSS frontend. The web application supports communication between the mbeds as well as communication between the web app and the system. The web app is responsive, so it can be used on a mobile device or desktop with ease. The mbeds talk to the web app using HTTP GET requests with various parameters entered as query strings. The server will provide a simple response to the mbed.

Description of Web Files

index.php: The homepage of the web app. Includes an arm/disarm button (depending on system status) as well as a link to the temporary codes management page.

manage.php: The temporary codes management page. Includes links to go back to home page as well as the page to view codes and add new codes.

addcode.php: The page to add temporary codes. This page automatically generates a 4-digit random code, which is included in the form along with fields for name and expiration.

viewcodes.php: The page to view temporary codes. This page lists the name, code, and expiration of all entries. There are checkboxes to delete the codes.

conf.php: The configuration file for the web app. This page does not display anything, but contains the debug status, authentication code, array of message recipients, and the database credentials. This page must be configured properly for the web app to work.

validatecode.php: The script for validating access codes. This page is intended to be accessed only by the mbeds in order to validate submtited codes. The script returns "True" if the code is valid and "False" if the code is invalid. The codes validate against the database of temporary codes. The form of this URL is http://domain.tld/validatecode.php?code=CODE, where "CODE" is the submitted code.

readstatus.php: The script for reading the status of an mbed. This page is intended to be accessed only by the mbeds in order to determine the status of the system or individual mbeds. The script returns "Status=#" where # is a digit between 0 and 9. The request must include an mbed ID number in the form http://domain.tld/readstatus.php?mbedID=NUM, where "NUM" is the ID of the mbed of interest.

updatestatus.php: The script for updating the status of an mbed. This page is intended to be accessed only by the mbeds in order to update their statuses in the database for other mbeds to fetch. The script requires an mbed ID and a status value (0-9). The form of the URL is http://domain.tld/updatestatus.php?mbedID=NUM1&status=NUM2, where "NUM1" is the mbed ID number and "NUM2" is the status number.

sendalert.php: This script sends alert notifications to defined recipients. This script only requires an authentication code defined in conf.php. The form of this URL is http://domain.tld/sendalert.php?authcode=AUTHCODE, where "AUTHCODE" is the pre-defined authentication code.

sendcode.php: This script sends the two-factor random code generated by the main mbed to recipients. The script requires the authentication code and the randomly generated code. The form of this URL is http://domain.tld/sendcode.php?authcode=AUTHCODE&randomcode=CODE, where "AUTHCODE" is the pre-defined authentication code and "CODE" is the randomly generated code from the mbed.

Web Source Code

Photos of Web App

/media/uploads/jbenamy/sms_alert.png /media/uploads/jbenamy/sms_code.png /media/uploads/jbenamy/web_app_home.png /media/uploads/jbenamy/web_app_manage.png /media/uploads/jbenamy/web_app_add.png /media/uploads/jbenamy/web_app_view.png

mbed Component

The system consists of at least two mbeds. The main mbed runs a different code file than the sensor mbeds. The sensor mbeds run different code files depending on whether they are using Ethernet or Wi-Fi. The mbeds must be connected to the Internet (not just a local network) for the system to behave properly. They do not need to be on the same local network.

Main mbed State Diagram

/media/uploads/jbenamy/main_state_machine.png

Main mbed Components

uLCD Connections

mbeduLCD
VU5V
GndGnd
P28RX
P27TX
P29Reset

Ethernet Connections

mbedMagJack
TD+P1
TD-P2
RD+P7
RD-P8

Speaker Connections

P26

https://developer.mbed.org/media/uploads/4180_1/x_scaled_speakerdriverschem.png.pagespeed.ic.ZyP3lIY8da.png

RGB LED Connections

mbedShiftBrite
GndGnd
P11DI
P15LI
P16EI
P13CI
VUV+

IR Sensor Connections

mbedIR Sensor
GndGnd
VUVcc
VoP20

Keypad Connections

mbedKeypad
VoVcc
P30IRQ
P10SCL
P9SDA
GndGnd

Solenoid Connections

mbedSolenoidDriver circuit (transistor)12V power supply
GndGndGndGnd
-+V+V-
--+V+12V
P21-Base-

Sensor mbed State Diagram

/media/uploads/jbenamy/sensor_state_machine.png

Sensor mbed Components

Ethernet Connections

mbedMagJack
TD+P1
TD-P2
RD+P7
RD-P8

Wi-Fi Connections

mbedESP8266
VoVcc
GndGnd
P26Reset
P28RX
P27TX
VoCH_PD

Speaker Connections

P26

https://developer.mbed.org/media/uploads/4180_1/x_scaled_speakerdriverschem.png.pagespeed.ic.ZyP3lIY8da.png

IR Sensor Connections

mbedIR Sensor
GndGnd
VUVcc
VoP20

mbed Source Code

Main mbed:

Import programIoT_V3

IoT for mbed1

Sensor mbed (Ethernet):

Import programIoT_Security_Ethernet

ethernet for mbed2

Sensor mbed (Wi-Fi):

Import programIoT_Security_WIFI

wifi for mbed2

Future Features

  • Wi-Fi support on main mbed
  • Offline mode so that mbeds can still function without Internet access
  • Text notifications to individual recipients instead of the entire list
  • Code optimizations to improve memory usage and thread synchronization


Please log in to post comments.