You are on page 1of 10

CS 589 Project

Smart Home Hub, Phase I


Due before 9am on October 21, 2015
Overview
So far, we have learned the basics and underlying principles of embedded software
and systems, and have begun to study the details of this field. Through this course
project, we are going to use our knowledge to solve a problem in this domain. In this
project we are going to implement a Smart Security System (S3). S3 is a system that
acts as a hub for all network-enabled devices in a domestic environment and is able
to gather, process, and share information in that environment to provide users with
added values in the area of home security. First, let’s define a couple of terms.

Smart Systems
According to Wikipedia, “Smart systems incorporate functions of sensing, actuation,
and control in order to describe and analyze a situation, and make decisions based on
the available data in a predictive or adaptive manner, thereby performing smart
actions.”

Smart Homes
As defined in the Oxford Dictionary, a smart home is “a home equipped with lighting,
heating, and electronic devices that can be controlled remotely by phone or
computer”.
If you look up “smart home systems” on the Internet, you will find a lot of products
and services, all claiming to make your house “smart”. In this project, we are going to
make a smart home service. Due to our limited time, our system will have restricted
functionality of a smart home device; however, we will do enough to see how an
embedded system is made in practice and what the issues are concerning the
development of such systems.

Project Definition
The functionalities of the S3 system can be categorized into two parts: onboard and
online requirements. For the project’s 1st phase, you will only work on designing and
modeling the system, so be creative and do not worry about the implementation (yet).
We are going to design an embedded system that will help us monitor our domestic
environment. The heart of our project is an embedded board that acts as a hub in the
system. We call this device (Boards) Smart Security Beacon.
Again, for the first deliverable, you are not required to implement anything. But you
have to design different parts of the system that we are going to implement based on
embedded systems principles.

Onboard Requirements
This group of functionalities is going to be performed offline. Any embedded system
can be viewed by the following diagram that we had in class.

The S3 system is going to have a set of Sensors, you can see details of these sensors at
the provided links:
 Air Quality
 Temperature and Humidity
 Sound
 Light Exposure
 Button
For the Actuator part, you will have a buzzer that can create sounds. You have to use
it to inform the user about temperature, humidity, and level of air pollution by
creating an indicator.

For the User Interface part, you will get an LCD to show different environmental
information gathered from around the device. Users can ask for different kinds of
information. Also, information should be shown in familiar units to the user. You do
not need to show light and sound information since they will be used for other
purposes.

On the LCD, whenever a user presses the button, indicator will switch
between showing different information.

You should define a range for all of the input data you get from sensors, and
whenever one of them goes beyond that standard range, the system should alert users
through the LCD display.
This project, like many software-intensive projects, is based upon your creativity. You
have the building blocks and tools, so you can combine them in “your way” and with
your architecture. But there is a set of basic functionalities that should be covered.
1- Each board will be installed in a room to monitor it. In this environment, each
board should use all the sensors to observe the following information:
a. Temperature
b. Light exposure level
c. Air quality (in terms of carbon monoxide level)
d. Humidity
e. Sound Level
2- For your convenience, we consider that only one board is installed in any
environment, so you do not have to be worried about connecting the boards
together or how to inform the user of each room in his apartment.
3- Each board should show environmental information to user through an LCD
monitor. Information on the monitor should change by pressing a button by a
user.
4- For each value there should be some boundaries defined. Whenever a value
goes outsides of bounds LCD backlit should turn red and show only the value
that is out of bounds. You will also have to send out a sound alarm with buzzer
under such circumstances.
5- Combination of these pieces of contextual information also has a value for us.
A rise in the temperature and carbon monoxide level, along with a decrease in
humidity, indicates a fire. So your system should be able to notice a fire. Can
you find any other useful combinations?

Online Requirements
This is the second group of functionalities the S3 systems should have. First, it should
be able to connect to the Internet. After the connection, it should be able to send
various data types and information to a target on a regular basis. For this part, you
are free to choose the type of communication and media you want that satisfies the
mentioned properties (e.g., HTTP, local network, Bluetooth, etc.) Also, users should
be able to receive critical information about their apartments. A good example of an
echo system that delivers these functionalities altogether is a server program that
gets information from the hub and then updates an application on the user’s mobile
devices.
In addition, by submitting your information to another platform with more computing
power, you can add analyzing power that is not possible on your limited boards. For
example, consider the following scenario: You can store the times during which a user
is normally present at the house, by measuring the sound activity, and inform the user
if there is an anomaly in that pattern (e.g., it may be a robbery). Again, you do not
have to implement this in the 1st phase, but it should be considered in your
architecture and designs.

Non-Functional Requirements
As you know, there are some quality attributes and design principles that are as
important as the main functionality requirements of embedded systems. Since we are
already familiar with these from the lectures, we are just going to list them here:
1. Concurrency
2. Responsiveness
3. Liveness
4. Extensibility
5. Heterogeneity
6. Scalability
7. Fault tolerance and reliability
You should consider all these while developing your embedded system and its
architecture. In order to achieve these qualities, we have to keep them in mind from
the early stages of development. For example, with concurrency in mind, one would
not go through a “taking turns” type of design, since it would harm concurrency.
Similarly, responsiveness requires the ability for sensor information to get to the
monitor or fire detector in a short period of time, so we may have to keep
environmental information updated on the LCD component all the time. These are
just suggestions and we will refrain from explaining them in detail so as not to
influence the ideas you may have.
Approach
To implement the S3 system, we will go through development steps that we have
learned so far.

Hardware/Software Co-Development
Based on what you have learned in the class, try to find answers for the following
questions:
 Is this a real-time system? If it is, is it soft real-time or hard real-time?
 Discuss at least three principles of embedded systems for our project. E.g. is it
distributed in nature? What about liveness? What level of reactivity does this
system require?
 What is the critical response time for each of the inputs of this system? Discuss
your reasons for each.
 What kinds of errors can happen in this type of system? What is your recovery
policy for each of them?
 Is this system implementable using a “Super Loop” pattern?
 What are our options for implementing this as a hardware device?
 Based on the chosen option for hardware, do we need to use a software part? If
so, then what programming language do you think we should use for the
implementation?
 Choose a good prototyping process for you development (e.g., simulation, FPGA
or VHDL implementation).

Modeling and Design


Now that you know enough about the characteristics of the system you want to build,
we can move to the next step, modeling and design.
Logical Design
In the logical design part, you are required to design two groups of artifacts.
1. Sketch a draft of your system architecture. This architecture should be
component-based and should comply with the software engineering principles
we discussed in the first lecture. Examples are modularity, separation of
concerns, isolation of change, etc.
2. Build a state-based behavior model. Suppose that we have two sub-systems in
charge of temperature and air quality monitoring. Design a StateChart diagram
(or FSM) for these two, showing how their state changes with different events
in the environment. What happens if we want to combine information gathered
from temperature and air quality sensors and have a fire detection unit, which
checks if there is a fire based on temperature and level of CO on air? Draw a
StateChart diagram for such a system.
Physical Design
Now, consider that we want to prototype this system on an Intel Galileo Board (link),
using any one of Arduino, C, C++, Javascript or Python. Do you think you should
change your design based on this new information? If so, sketch the new design. If not,
why?
Important note to be remembered during design and modeling is that you will be
required to evolve this design in the next phase based on new requirements, with
minimal changes to the based model. This means that keeping design principles in
mind is absolutely necessary.

Implementation
In this step, we are going to implement the system based on our designs. We will use
Intel Galileo boards as the hardware platform, since it supports Arduino standards. To
start implementation, we need to first gather some basic building blocks. It is not a
part of your first deliverable, but it is just added to give you an idea of how to
implement your physical design, and get ready for next deliverables. This means that
you can receive your boards and start working with them for now just to get to know
their different aspects and limitations.
Intel Galileo Boards
Each team can request to receive an Intel Galileo Gen 2 Development Board. These
boards are microcontroller boards based on Intel Quark system-on-chip systems. You
can see the board diagram for Intel Galileo Gen 2 in the diagram below.
You can see how this picture resembles the general diagram that we have for all
embedded systems. You can read the board overview to get more familiar with this
SoC and its abilities.
Sensors and Cables
Intel Galileo does not come with all the necessary cables and sensors needed for this
project. In fact, it does not have Terminal and USB cables necessary to operate this
board. But everything that you will need in this project will be made available to you.
And be sure to get them along with the boards.
You will be responsible for all of the equipment you receive. Lost or damaged
equipment may results in a lower course grade—in part naturally, because you will not
be able to demonstrate your solution.
Arduino IDE
For a good first step with these boards, we suggest going to this tutorial page to
download appropriate drivers for your OS of choice, install Arduino IDE, and blink the
LED on the board with a short pre-written Arduino program.

Getting Started with Sensors


All the sensors that you get in this are made by Seeed Studio and support Arduino
standards. Since there is not enough space on each board for all of the sensors to be
connected, we use a base shield to provide communication support for all sensors.

You can find out how to connect base shield to your boards and add a sensor after
that here. You will have to download starter kit code from Github to get a sense of
the coding required for different sensors. Starter Kit has sample codes for all the
sensors that you have. You can also read more about each sensor and its API on the
links that are provided in the Project Definition section. Keep in mind that every
sensor and actuator may need a specific type of input, although they all look the
same in that they have 4 pins each.
Coding
After getting familiar with all the sensors and their APIs, we can move on to the next
level, by starting to implement our design. You can choose a language that can be
installed on Galileo (e.g., Arduino, C/C++, Javascript, Python).
The most important part of the implementation is having your code conform to your
design. This means there should be a logical connection between building blocks of
your design and your code. Providing such coherence is not easy. Thus, a really good
option will be using a development framework. One of the frameworks that you can
(but are not required to) use for this assignment is DISC. Before any further
explanation of this framework, you have to make you board able to interpret
Javascript code. The basic operating system of Galileo does not support Javascript or
any other languages you may be familiar with. But with Yokto, a Linux distribution
specifically designed for Galileo, you will be able to run Jacascript (on top of NodeJS),
GCC, and Python.
Not a Fan of Arduino? No problem.
If you want to code in anything other than Arduino, you will have to install the Yokto
Linux distribution on your boards. Here are resources and tutorials explaining how to
do this. With Yokto, you will have access to an upgraded OS capable of running
various programming languages.
User Interface
Information will be shown on the LCD and user can choose which information to see
with a button. Also, you should use the buzzer when you want to alarm the user.

Deliverables
For this project you will have to deliver the following artifacts:
1. A document contacting answers to every question asked in “Approach” and
“Non-functional Requirements” sections, with mentioned details in mind.
2. Your logical models of the embedded system. In addition to the detailed
StateChart diagrams asked in the approach section, please submit your
detailed architectural design of the whole system, explaining the architectural
styles and design patterns that you used and their goal. You may use UML for
your architectural design, but you should provide any additional information,
annotations, etc. Your architectural design should follow design principles
explained in class (It should be modular, support separation of concerns,
extensible, etc.). Your model should include connections to cloud and mobile
devices but there is no need to specify the design of those parts of the system.
3. You have to install an operating system on your boards and write a short
program that blinks the LED and run it through terminal connection, not an
Arduino Sketch (Use a language other than Arduino as well). Since there is no
simulator for these board available, DEN students should write a simple
application for their smartphones that shows one of the user’s contextual
information, like gyroscope data. DEN student should work individually.

You might also like