46
Scalable, Cloud-Based Data Aggregation and Analysis Platform for Internet of Things Applications Invention by Marc Gong Bacvanski

IoTReport

Embed Size (px)

Citation preview

Page 1: IoTReport

Scalable,(Cloud-Based(Data(Aggregation(and(Analysis(Platform(for(Internet(of((Things(Applications((Invention(by(Marc(Gong(Bacvanski(

Page 2: IoTReport
Page 3: IoTReport

Table of Contents

1 INTRODUCTION 3 1.1 PROBLEM: IOT DATA AND ANALYSIS 3 1.2 PROJECT DESCRIPTION 3 1.3 POTENTIAL APPLICATIONS 3

2 RESEARCH 4 2.1 NEED 4 2.2 EXISTING SOLUTIONS 4 2.2.1 SCIRES 4 2.2.2 SPLUNK 4 2.2.3 AMAZON KINESIS 4 2.2.4 APACHE STORM 4 2.2.5 PATENT US6434512 B1 5 2.3 PROBLEMS WITH EXISTING SOLUTIONS 5 2.3.1 CLOSED SYSTEMS 5 2.3.2 STORAGE PROBLEMS 5 2.3.3 CONNECTIVITY 5 2.3.4 DATA ACCESS 5 2.4 DESIGN CONSIDERATIONS 6 2.4.1 SPEED 6 2.4.2 SCALABILITY 6 2.4.3 RELIABILITY 7 2.4.4 EXPANDABILITY 7 2.5 POTENTIAL SOLUTIONS 7 2.5.1 DECENTRALIZED SENSING COMPUTERS 8 2.5.2 CENTRALIZED CLIENT-BASED 8 2.5.3 CLOUD-BASED ARCHITECTURE 9 2.6 TECHNOLOGIES: IOT, BIG DATA, CLOUD COMPUTING, REACTIVE SYSTEMS 10 2.6.1 NODE.JS 11 2.6.2 JAVASCRIPT 11 2.6.3 JADE 11 2.6.4 GOOGLE CHART API 11 2.6.5 MONGODB 11 2.6.6 INTERNET OF THINGS (IOT) 12 2.6.7 CLOUD COMPUTING 12 2.6.8 WEB SERVERS AND CLIENTS 12 2.7 CONCLUSION 13

3 PROJECT DESIGN 14

4 DETAILED EXPLANATION OF MY SOLUTION 15 4.1 OVERALL STRUCTURE AND DESCRIPTION 15 4.2 TESSEL SIDE 15 4.2.1 OVERVIEW 15 4.2.2 CODE AND EXPLANATIONS 15 4.3 SERVER SIDE 18

Page 4: IoTReport

2

4.3.1 USER INTERFACE 18 4.3.2 OVERVIEW 22 4.3.3 JAVASCRIPT CODE: DATA RECEIVING AND STORAGE 22 4.3.4 JAVASCRIPT CODE: REQUEST HANDLING 23 4.3.5 JADE CODE: HOME PAGE 27 4.3.6 JADE CODE: CURRENT DATA 29 4.3.7 JADE CODE: GRAPHS 30 JADE CODE: NO MORE DATA 30 4.4 DEPLOYING ON GOOGLE CLOUD 30 4.4.1 HOME PAGE: CREATE SERVER 31 4.4.2 CREATED SERVER 32 4.4.3 UPLOAD PROGRAMS TO SERVER 33 4.4.4 RUN PROGRAMS 33 4.5 TOTAL INTERACTION BETWEEN PARTS 33

5 WHY MY SOLUTION IS BETTER THAN EXISTING 35

6 PROBLEMS ENCOUNTERED AND SOLUTIONS 36 6.1 LEARNING TECHNOLOGIES USED 36 6.2 TESSEL INTERNET TROUBLESHOOTING 36 6.3 DOCUMENTATION 36

7 SUMMARY 37 7.1 WHAT IS MY SOLUTION 37 7.2 WHY MY SOLUTION IS BETTER THAN EXISTING 37 7.3 APPLICATIONS 38

8 FUTURE WORK 39

9 ACKNOWLEDGEMENTS 40

10 REFERENCES 41

11 GLOSSARY 43

Page 5: IoTReport

3

1 Introduction

1.1 Problem: IoT Data and Analysis In a multitude of industries, there is a need to collect, analyze, and effectively display data from a wide variety of sensors and sources.

1.2 Project Description This invention seeks to provide humanity with an effective, reliable, and scalable means of collecting, analyzing, and displaying data from a variety of different sensors and sources. My invention provides an effective problem to the growing IoT (Internet of Things) data aggregation and analysis problem. This system can be applied to numerous industries to improve their efficiency and unlock new application areas.

1.3 Potential Applications This system can be applied in almost any industry where precise gathering of data is required from a variety of sensors and locations. The open standards, protocols, and procedures allow anyone to connect their sensing stations to the system.

Page 6: IoTReport

4

2 Research

2.1 Need Our rapidly advancing world is becoming increasingly dominated by computing devices, many of which are connected to sensors. There is a great demand for a public, efficient, simple, and scalable approach to collect and analyze the large amounts of sensor data that are collected by these computing devices. This collected data can be used for various means and applications. Among these applications is farming. Farmers can use soil-sensing devices efficiently to analyze the conditions in their soil, allowing them to correlate crop yield with certain factors, such as humidity, soil electrical conductivity, and sunlight. Before setting out to implement this project, I have conducted research on existing solutions, possible solutions, and the technologies that could be utilized.

2.2 Existing Solutions To meet similar problems of data collection, numerous companies have developed systems to collect sensor data.

2.2.1 SciRes Among these is a system developed by SciRes using mobile relay nodes. SciRes’s solution is intended for reliable urban data collection using interconnected relay nodes. Data is then transferred between the nodes to the user. However, this system has not seen much popularity due to its closed and proprietary nature.

2.2.2 Splunk Splunk is a company that develops data collection and analytics programs for large companies. Their product is scalable, versatile, and utilizes a modular approach for data collection. They allow data input from a number of different industrial protocols, and are used by many major companies such as General Electric and Siemens. It is a closed and expensive commercial system.

2.2.3 Amazon Kinesis Amazon Kinesis offers another similar solution for large, cloud-based processing of large streams of input data. Kinesis is a commercial service that is scalable, cloud-based, low cost, and easy to use. This makes it very attractive to companies. In companies, it can be used for powering real-time dashboards, generating alerts, implementing dynamic pricing, and advertising. Kinesis is a closed, proprietary system offered as a subscription.

2.2.4 Apache Storm Apache Storm, originally developed by Twitter and now managed by the Apache foundation, is an open source project to meet the demand for processing of real-time data. It is a free and open source real-time computation system, meaning that the data is processed right away as it comes in as an input stream. It can be used as the

Page 7: IoTReport

5

foundation for real-time analytics, online machine learning, and continuous computation at a fast pace. It processes input streams, but does not store the data.

2.2.5 Patent US6434512 B1 A patent (US6434512 B1) has already been created for a vehicle data collection system that monitors the status of vehicles operating under a certain company, such as a bus system. This allows the owners of the company to understand the factors on the bus that are creating breakages, and to sense beforehand when a breakage is going to occur. Numerous respected companies, such as Caterpillar Inc., Xerox, and IBM have referenced this system.

2.3 Problems with Existing Solutions Problems with existing solutions can be classified into several categories.

2.3.1 Closed Systems All proprietary, commercial systems such as Splunk are closed in their very nature; they all require money to utilize them. The focus of this invention is to have an open system where the whole world can see the collected data of the whole world; charging for usage would not fit in with this scenario. People will be able to expand and customize the system if it were open, which is not the case with many existing solutions.

2.3.2 Storage Problems Systems designed for streaming processing such as Storm and Kinesis of data do not support storing the data. Although one can build a custom component to do so, it is not straightforward nor the intent of the system. Storing the data is an essential part of data analysis. My invention seeks to solve both storage and processing problems. Other systems, such as SciRes’s solution, store data locally and not in a centralized fashion. It would be cumbersome, therefore, to extract the data from all the individual nodes. One would need to create an application to merge the data after individually collecting it.

2.3.3 Connectivity Other systems that require directly connected sensors can be applicable; however, the required use of wire communication does not allow for scaling. In other words, this system cannot accommodate sensors that cannot be connected by wire to the collection system, such as sensors on the other side of the world.

2.3.4 Data Access The other technologies and systems are useful for large companies that need to internally collect and analyze their data. However, none of these technologies allow for a shared, open database of information that can be used by individuals for their own gain and purposes. This is the primary purpose of this invention. The goal is to have a global, shared collection of public data that can then be used for analytical purposes by private individuals. Of course, private companies that wish to have private data repositories will be able to do so by paying a certain small amount. This would be a future step in development.

Page 8: IoTReport

6

2.4 Design Considerations When designing a complex system as the one detailed in the need section, there are several design considerations one must analyze. Among these are the speed, scalability, reliability, expandability, and openness.

2.4.1 Speed Speed is, intuitively, the rapidity at which the user receives the data. When a consumer goes to a web page from his browser, the browser sends a request to the server at the specified URL. When the server there receives this request, it sends the data back to the browser with a response. These request types are internationally accepted standards. When a server receives a large amount of requests at a time, the time before the server can respond will increase because there are already numerous requests queued before it can be handled. One way to deal with this slowdown is to scale, as discussed below.

2.4.2 Scalability Scalability is the ability of an application to handle a growing amount of load, or number of requests per unit of time, effectively and speedily. This can be accomplished either by having more powerful computers or by spreading the load across many. Spreading the load across many is generally favored due to the lower costs and ease of growing incrementally. In order to be able to split the tasks onto multiple computers, however, the programs must be designed in such a way as to make this possible. Servers that send data to the consumer must be separate from those that collect data from the sensing stations; otherwise, if the same program that both collects and sends data was run on multiple computers, one could not effectively manage the number of computers each task needs to run on. This is known as "separation of concerns," which is one of the important design principles in hardware and software design. Load management must also be instituted to direct the http requests to the server with the least load to ensure fastest response time.

HTTP$Request$

Data$Storage$HTTP$Response$

Client$ HTTP$Connec7ons$ Server$and$Data$Storage$

Data$Storage$

Data$Storage$

Data$Storage$

Data$Storage$

Scaling$

Page 9: IoTReport

7

2.4.3 Reliabil ity Reliability is also a relatively intuitive term; it is the system’s resilience to faults, errors, and breakages. These breakages could occur on the sensor’s side, where a sensor fails, or it could occur with the actual hardware that the data collection programs run on. By splitting the computing power over multiple servers, as discussed above in scalability, reliability is increased. Even if one server fails, the other ones can take its place in handling requests.

2.4.4 Expandability In this project, expandability will be defined as the ability for people to expand upon this data collection system by updating its code and adding new sensing stations. The benefits of expandability allow anyone to access this common pool of knowledge and collected data and to benefit from its use. By making this project Open Source through Github, a social coding site, others are invited to improve upon this design and to fix bugs as they come up, for the benefit of all. This will benefit humanity; anyone from across the world will be able to benefit from this system. Rather than have a company maintain this project, anyone who feels inclined to help can do so. Open, standardized protocols such as http allow anyone to add a sensing station to the project and contribute to the data pool.

2.5 Potential Solutions Before implementing a solution, I have created and analyzed several potential designs, their problems, and their advantages.

Page 10: IoTReport

8

2.5.1 Decentralized Sensing Computers

In this diagram, S stands for an individual sensor. This is a decentralized approach to the problem at hand. Each sensing station acts as a full computer, both collecting and storing its own data. The disadvantages of this design is that it will not be scalable with hundreds of thousands of sensing stations, it is more expensive, if one sensing computer breaks, all the data from it is lost. In addition, retrieving data will be slow from all the sensing computers.

2.5.1.1 Problems The disadvantages of this design is that it will not be scalable with hundreds of thousands of sensing stations, it is more expensive, if one sensing computer breaks, all the data from it is lost. In addition, retrieving data will be slow from all the sensing computers. No external users will be able to view the data.

2.5.1.2 Advantages Since there is no central computer that stores all the data from all the sensing stations, upfront costs are minimized. However, having duplicate storage systems on all of the sensing stations would become expensive.

2.5.2 Centralized Client-Based

Modular Data Collection System - Decentralized!

Data!Storage!

Sensor!Computer!

S!

S!

S! Data!Storage!

Sensor!Computer!

S!

S!

S!

Data!Storage!

Sensor!Computer!

S!

S!

S!

Page 11: IoTReport

9

In this diagram, S stands for an individual sensor. This approach to the problem is centralized; however, the user’s computer itself does all the data collection programs, storage, and analysis.

2.5.2.1 Problems This would create much more cost for the user, since he would have to supply the data storage hardware devices. In addition, the user’s computer would have to be constantly on and the data collection program constantly running in order to handle the constant flow of data.

2.5.2.2 Advantages Minimal architecture reduces total upfront costs.

2.5.3 Cloud-Based Architecture

Modular Data Collection System – User Based!

Sensor!Computer!

S!

S!

S!

Data!Storage! Sensor!

Computer!

S!

S!

S!

Sensor!Computer!

S!

S!

S!

Page 12: IoTReport

10

In this example, S stands for each individual sensor connected to the Sensor Station. There can be as many or as few sensors connected to each sensor station depending upon the application. The advantages of this system is that it is fault-tolerant toward sensor station failures, fault-tolerant toward user computer failure, is scalable, fast, reliable, and can support many different types of sensing stations.

2.5.3.1 Problems There is a high upfront cost of a web server and data storage system, but afterwards, cost is saved on the minimal architecture of each sensor station. However, this cost can be successfully overcome by utilizing cloud computing, a system where users rent servers at a low price from large companies. This is discussed in more detail in 2.6.7.

2.5.3.2 Advantages The advantages of this system are that it is fault-tolerant toward sensor station failures, fault-tolerant toward user computer failure, is scalable, fast, reliable, and can support many different types of sensing stations. Servers and data storage in the cloud can be made replicated, so that a failure of a server or a database does not affects the whole system. To achieve redundancy, other servers and database replicas can run and process the requests.

2.6 Technologies: IoT, Big Data, Cloud Computing, Reactive Systems

Modular Data Collection System – Cloud-Based!

Servers!in!the!Cloud!

Data!Storage!

Sensor!Sta3on!

S

S

S

Sensor!Sta3on!

S

S

S

Sensor!Sta3on!

S

S

S

Page 13: IoTReport

11

2.6.1 Node.js Node.js is a framework for asynchronous computing using JavaScript. Asynchronous computing is a concept where no action waits for another action to complete; rather, many tasks are executed in parallel. When a task finishes, it calls another function, known as a callback, that handles the result of that task. This allows Node.js to be able to handle a large amount of server load rapidly; this is the primary reason for utilizing it in this invention. Node.js is the state of the art system for widely scalable and high performance systems. EBay, Microsoft, Walmart, and PayPal utilize Node, among others.

2.6.2 JavaScript JavaScript is a programming language commonly used in web browsers. It is a functional programming language. In this invention, JavaScript will be the primary programming language used because it is the language utilized by Node.js. Thanks to Google’s V8 execution engine, JavaScript has now good execution speed. In addition, JavaScript is the only language that runs in all browsers.

2.6.3 Jade Jade is a Node template engine that compiles into HTML code. It allows development of web pages to be faster due to a much simpler syntax. My invention utilizes it for the creation of its website for displaying measurement data.

2.6.4 Google Chart API The Google Chart API is a chart interface library developed by Google. It makes it easier to create interactive charts in web pages. My project utilizes it to display graphical diagrams of sensor data on the website.

2.6.5 MongoDB MongoDB is a non-relational, document-oriented database, meaning that it stores data in JSON-like documents. My invention utilizes MongoDB to store the data that the sensors collect since it is a fast and scalable database.

Page 14: IoTReport

12

2.6.6 Internet of Things (IoT)

Internet of Things is a concept where devices and objects are interconnected through the Internet. This interconnection is expected to aid automation of routine tasks when some event happens. My invention facilitates this by allowing a network of sensors to be connected to actuation devices, such as sprinkler systems.

2.6.7 Cloud Computing In many cases, individuals and companies want to run their programs on multiple computers at once, or on a very powerful computer. In the past, these individuals would have to buy, setup, and maintain their own servers. However, this is expensive and very labor-intensive, especially maintaining these servers. Recently, many companies have introduced cloud computing abilities for individuals, where individuals can rent computers and run their programs on them. Users connect to remote servers that they rent through the Internet, and upload their programs onto these servers. Users can then run their programs on these servers. Cloud computing allows for the reduction of costs for individuals or companies, since users pay only for the resources they use. In this invention, I am utilizing Google Cloud, which is a cloud computing service from Google.

2.6.8 Web Servers and Clients A web server is a computer connected to the Internet that provides information when it receives a request from a client. For example, when a user desires to go to view the sensor data, the web servers receive a request from the client. Then, the servers read the data for the user requested page from a file and send a response containing this data back to the user’s computer. The web browser then renders this data, and the user sees it as values and charts. A web server can also receive data from a sensing station. Web protocols are used to send data from a sensing station to the web server. The web server, seeing that it is

Page 15: IoTReport

13

data from sensors, will write this data into the database. This will allow it to be accessed and viewed later.

2.7 Conclusion Due to the need for a public, efficient, simple, and scalable approach to collect and analyze the large amounts of sensor data produced by today’s fast-paced, computerized world, I will invent the Modular Data Collection System. This system aims to address the lack of an open source, online, data collection application that facilitates the public use of collected data for the benefits of humanity. Before setting out to implement this project, the above research has been conducted.

Page 16: IoTReport

14

3 Project Design After analyzing the factors pertaining to this invention, I have concluded that this system architecture would be the most beneficial. As listed above in the Research (2.5.3) section of this report, this is the cloud-based approach.

My Solution

MongoDB

Servers in the Cloud running scalable

node.js application

Mobile Devices

Users' Computers

Sensor Station Se

nsor

s

Sensor Station

Sens

ors

Sensor Station

Sens

ors

Scalable NoSQL Database

Page 17: IoTReport

15

4 Detailed Explanation of my Solution

4.1 Overall Structure and Description Each sensor is connected to a sensor station, a microcomputer or microcontroller with an Internet connection. Each sensor station receives data from each sensor connected to it, and sends the sensor data to a server in the cloud. On the server in the cloud, two programs are run. One of them handles the POST requests from the server and stores the data in the data storage system, a MongoDB database. The second program handles requests from users’ browsers. It reads the requested data from the database and sends it to the user via the Internet. The user then sees the data in his or her browser. In the code listed underneath, I have included comments in my code. Comments are text that explains further on the true meaning of the code, eliminating confusion for those who read the code. Comments are either listed as block Javadoc comments, which are in green and follow tags, or in grey as comments right next to the referred code.

4.2 Tessel Side As a demonstration of a type of sensor station, I have created a basic one using the Tessel microcomputer. Tessel is an open source microcomputer manufactured by Technical Machine Co. It supports Node.js programming, and has a built-in Internet connection. Through its four expansion slots, seen as black rectangles off the side of the board, peripherals such as sensors, motors, and indicators can be easily attached and programmed. These factors make it an attractive way to build low-cost Internet servers that connect to the external world. Tessel is used in my invention to simulate a potential sensor station that sends sensor data to the web server.

4.2.1 Overview In my invention, Tessel will read sensor values and issue POST requests to the Internet server that will collect the data.

4.2.2 Code and Explanations * @description Reads sensor values, then posts them to a remote server. * @author Marc Bacvanski */ //Imports the necessary libraries for the program. //Library for tessel itself var tessel = require("tessel"); //For the climate module var climateLib = require("climate-si7020"); //For the ambient module

Page 18: IoTReport

16

var ambientLib = require("ambient-attx4"); //What port to use for the climate module var climateModule = climateLib.use(tessel.port["C"]); //What port to use for the ambient module var ambientModule = ambientLib.use(tessel.port["D"]); //HTTP library for Internet connections and protocols. var http = require("http"); /** * @description Checks if the climate module is ready to send data * @param No parameters * @callback checkAmbientReady */ function checkClimateReady() { console.log("Checking if climate module is ready..."); climateModule.on("ready", checkAmbientReady); } /** * @description Checks if the ambient module is ready to send data * @param No parameters * @callback getAndPostValues */ function checkAmbientReady() { console.log("Checking if ambient module is ready..."); ambientModule.on("ready", getAndPostValues); } /** * @description Initiates the getting and posting of sensor data * @param No parameters * @callback No callback, recursively calls itself. */ function getAndPostValues() { console.log("Got into getAndPostValues!"); climateModule.readTemperature(postTemperature); climateModule.readHumidity(postHumidity); ambientModule.getLightLevel(postLight); ambientModule.getSoundLevel(postSound); setTimeout(getAndPostValues, 5000); //Wait before reading values again } /** * @description Assembles the temperature post to the server * @param err If there was any sort of error from reading temperature * @param temperature The value of temperature from the sensor * @callback post */ function postTemperature(err, temperature) { //Reads and posts the temperature. if (err) { console.log("Error in getting temperature!"); console.log(err); } else { console.log("Got temperature!"); console.log("This is the temperature: " + temperature); //Assembles the JSON object to post. var JSONTemperature = {time : new Date().toJSON(), valueType : "temperature", value : temperature}; post(JSONTemperature); } } /** * @description Assembles the humidity post to the server

Page 19: IoTReport

17

* @param err If there was any sort of error from reading humidity * @param humidity The value of humidity from the sensor * @callback post */ function postHumidity(err, humidity) { //Reads and posts the humidity. if (err) { console.log("Error in getting humidity!"); console.log(err); } else { console.log("Got humidity!"); console.log("This is the humidity: " + humidity); //Assembles the JSON object to post. var JSONHumidity = {time : new Date().toJSON(), valueType : "humidity", value : humidity}; post(JSONHumidity); } } /** * @description Assembles the light post to the server * @param err If there was any sort of error from reading light * @param light The value of light from the sensor * @callback post */ function postLight(err, light) { //Reads and posts the light. if (err) { console.log("Error in getting light!"); console.log(err); } else { console.log("Got light!"); console.log("This is the light: " + light); //Assembles the JSON object to post. var JSONLight = {time : new Date().toJSON(), valueType : "light", value : light}; post(JSONLight); } } /** * @description Assembles the sound post to the server * @param err If there was any sort of error from reading sound * @param sound The value of sound from the sensor * @callback post */ function postSound(err, sound) { //Reads and posts the sound. if (err) { console.log("Error in getting sound!"); console.log(err); } else { console.log("Got sound!"); console.log("This is the sond: " + sound); //Assembles the JSON object to post. var JSONSound = {time : new Date().toJSON(), valueType : "sound", value : sound}; post(JSONSound); } } /** * @description An omniscient function for posting to the server * @param whatToPost What to post to the server * @callback No callback */ function post(whatToPost) { console.log("About to post: " + JSON.stringify(whatToPost));

Page 20: IoTReport

18

var postOptions = { //Options to post, such as destination, port, type, and headers. host: 'postAddress', port: '8080', path: '/whereToPost/', method: 'POST', headers: {'Content-Type' : 'application/json'} }; var postRequest = http.request(postOptions, function(response) { response.setEncoding('utf8'); //Set what encoding to use for the server response response.on('data', function(chunk) { //Handle what to do with the server response console.log("Response: " + chunk); }); response.on('error', function(err) { console.log("Error: " + err); //Handle post errors }) }) console.log("Posting!"); postRequest.write(JSON.stringify(whatToPost)); //Post to the server postRequest.end(); console.log("Finished posting."); } checkClimateReady(); //Initiate the program.

4.3 Server Side A web server is utilized in my experiment to receive, store, and send sensor data. A web server is essentially a computer with an Internet connection and setup to receive and send data through the Internet. Web servers can be owned by anyone, but for economic purposes, many companies and individuals utilize cloud computing. Cloud computing is when a large company owns many web servers, but they do not use all of them at once. When not all of them are being used, users can rent servers for whatever purpose they desire, and pay only for the amount that they use. This is significantly more cost-effective than buying, maintaining, and powering one’s own web servers. Also see 2.6.7 for cloud computing.

4.3.1 User Interface These are screen shots of the various features and pages of the website that displays data to the user.

http://en.wikipedia.org/wiki/File:SunFire-X4200.jpg

Page 21: IoTReport

19

4.3.1.1 Home Page

From here, the user can choose to go to any of the links in the navbar. Those are the Current Data page and the Graphs page. This page is displayed any time a user goes to the web page without specifying a path.

4.3.1.2 Current Values

This is the page that the user can go to view the most recent values from the sensors. Here, it is setup for only three sensors, but it can be easily expanded to accommodate an infinite number of sensors. It displays the sensor value, along with the time at which it was measured. Users can set parameters at when to alert them of some action - here, it was set up so that the current temperature value exceeded the limit and thus it displayed the alert.

Page 22: IoTReport

20

4.3.1.3 Graphs

Note how some points are marked by numerals and there are reference numerals on the sidebar. Based on several parameters the user can specify, custom alerts are set up. Here, alerts are set up so that the user is notified if values drop below a certain value or increase above a certain value. To accommodate a large amount of data, pagination has been implemented for displaying graphs to the user. This limitation of the data the user sees at one time ensures that not too much data (the whole data set) is going to the user’s machine through the Internet, as this would significantly slow down the application. For a different, significantly larger set of data, this would be the most recent data displayed.

This was the most recent page. One can see that the timeline goes only from September to the end of December. By clicking the previous link, one goes to the next most recent page.

Page 23: IoTReport

21

One can see that this data set goes from April to August. By clicking Previous again, one gets to the beginning of the data set.

One can see that this data set goes from January to March. Since this is the end of the data set, if the user clicks Previous again, the website shows an error page. This simple, intuitive interface is easily expandable, intuitive, and reliable.

Page 24: IoTReport

22

4.3.2 Overview In this invention, the web server will take on an important role. Two programs will run on it. The first will receive data from a sensing station and store it in the database. The second program will, upon a user request, read from the database and send the data to the user via the Internet.

4.3.3 JavaScript Code: Data Receiving and Storage This following program is the code that receives data from sensing stations and stores the data into a MongoDB database. /** * @description receives and stores data from sensing station. * It stores the data into a mongoDB database. */ //Used to parse the content of requests var bodyparser = require("body-parser"); //Used to create a web server easily var express = require("express"); //Importing the database module var mongoClient = require("mongodb"); var server = express(); //Initializing the server //Connecting to the mongodb server mongoClient.connect("mongodb://localhost:27017/measurementsDB", startListening); var db = null; var data = null; //Setting up what the server uses. server.use(bodyparser.urlencoded({extended: true})); server.use(bodyparser.json()); //Handle each post request server.post("/postHere/", postFromTessel); /** * @description Sticks data into the database. * @param measurement What data to stick into the database. */ function stickIntoDatabase(measurement) { data.insert(measurement, function() {}); } /** * @description The post handling function - receives data and returns 200 OK * @param request The request body from each post * @param response The response object to respond to * @callback stickIntoDatabase - to write into the database */ function postFromTessel(request, response) { console.log("Got into postFromTessel"); var measurement = request.body; console.log(measurement); console.log("=**********************************************************************="); response.write("200 OK"); response.end(); stickIntoDatabase(measurement, function(){}); }

Page 25: IoTReport

23

/** * @description Begins the server listening on port 8080 * @param err If there was any error linking to the database * @param db The database object. */ function startListening(err, db) { if (err) { return console.dir(err); } else { server.listen(8080); data = db.collection("data"); } }

4.3.4 JavaScript Code: Request Handling This program handles the requests from users for data. Once it receives a request, it reads from the database and returns those values to the user. //Import the libraries needed for the program var express = require("express"); var mongoClient = require("mongodb"); var server = express(); //Initiate the web server mongoClient.connect("mongodb://localhost:27017/measurementsDB", startListening); //Connect to the database server.locals.title = "Modular Data Collection"; var data = null; var currentPage = 0; var totalLength = 0; var totalPages = 0; var maximumValue = 0.2; //Hardcoded; just to try out things. var minimumValue = 0.3; const PAGE_SIZE = 750; //setup middleware var pub = __dirname + "/public"; server.use(express.static(pub)); server.use(function (err, req, res, next) { server.send(err.stack); }); //Setup the server pages and public directories server.set('views', __dirname + '/views'); server.set("index", "views"); //Where the Jade file is server.set("view engine", "jade"); //Set up the Jade view engine server.get("/", getHomePage); server.get("/currentData", function (request, response) { getCurrentValues(response, "light"); getCurrentValues(response, "sound"); getCurrentValues(response, "temperature"); getCurrentValues(response, "humidity"); }); //Implements pagination for the data display server.get('/graphs', function (request, response) { console.log("About to render!"); //Response is passed in as a parameter that goes all the way down var direction = request.query.direction; if (direction == "next" && currentPage > 0) { currentPage -= 1;

Page 26: IoTReport

24

getGraphValues(response, "light", currentPage); getGraphValues(response, "sound", currentPage); getGraphValues(response, "temperature", currentPage); getGraphValues(response, "humidity", currentPage); } else if (direction == "previous" && currentPage < totalPages - 1) { currentPage += 1; getGraphValues(response, "light", currentPage); getGraphValues(response, "sound", currentPage); getGraphValues(response, "temperature", currentPage); getGraphValues(response, "humidity", currentPage); } else if (direction == undefined) { currentPage = 0; getGraphValues(response, "light", currentPage); getGraphValues(response, "sound", currentPage); getGraphValues(response, "temperature", currentPage); getGraphValues(response, "humidity", currentPage); } else { response.render("noMoreData"); } }); //Oops. server.get("*", function (request, response) { console.log("If you're seeing this, the site is broken. OOPS!"); }); /** * @description Gets the current values from the database with a certain type. * @param response The variable for the response back the user. It is passed * all the way down to whichever function needs it to render the response. * @param type The type of values to look for from the database. */ function getCurrentValues(response, type) { console.log("getCurrentValues was called with type " + type); var valueStream = data.find({valueType: type}).sort({time: 1}).stream(); var allValues = new Array(); var currentValue = null; valueStream.on("data", function (item) { allValues.push(item); }); valueStream.on("end", function () { currentValue = allValues[0]; checkIfAllDone(response, type, currentValue, displayCurrent); }); } var temperature = null; var humidity = null; var light = null; var sound = null; function checkIfAllDone(response, type, data, callback) { console.log("CheckIfAllDone was called with type " + type); console.log(type + " has a value of "); if (type === "light") { console.log("Checking if all is done from light!"); light = data; } else if (type === "temperature") { console.log("Checking if all is done from temperature!"); temperature = data; } else if (type === "sound") { console.log("Checking if all is done from sound!"); sound = data;

Page 27: IoTReport

25

} else if (type === "humidity") { console.log("Checking if all is done from humidity!"); humidity = data; console.log("Finished assigning humidity!"); } else { console.log("Couldn't recognize the type!"); } if (temperature != null && humidity != null && light != null && sound != null) { console.log("All is done - displaying data!"); callback(response, temperature, humidity, light, sound); temperature = null; humidity = null; light = null; sound = null; } } function displayCurrent(response, temp, humid, li, sou) { console.log("Got into displayCurrent!"); var temperature = temp.value.toFixed(2); var temperatureDate = new Date(temp.time); var temperatureTime = temperatureDate.toDateString(); var humidity = humid.value.toFixed(2); var humidityDate = new Date(humid.time); var humidityTime = humidityDate.toDateString(); var sound = sou.value.toFixed(2); var soundDate = new Date(sou.time); var soundTime = soundDate.toDateString(); var light = li.value.toFixed(2); var lightDate = new Date(li.time); var lightTime = lightDate.toDateString(); var temperatureAboveAlert = 'false'; var temperatureBelowAlert = 'false'; var humidityAboveAlert = 'false'; var humidityBelowAlert = 'false'; var soundAboveAlert = 'false'; var soundBelowAlert = 'false'; var lightAboveAlert = 'false'; var lightBelowAlert ='false'; if (temperature > maximumValue) { temperatureAboveAlert = 'true'; } else if (temperature < minimumValue) { temperatureBelowAlert = 'true'; } else if (humidity > maximumValue) { humidityAboveAlert = 'true'; } else if (humidity < minimumValue) { humidityBelowAlert = 'true'; } else if (sound > maximumValue) { soundAboveAlert = 'true'; } else if (sound < minimumValue) { soundBelowAlert = 'true'; } else if (light > maximumValue) { lightAboveAlert = 'true'; } else if (light < minimumValue) { lightBelowAlert = 'true'; } response.render('currentData.jade', { temperature : temperature, temperatureTime : temperatureTime,

Page 28: IoTReport

26

tempAboveAlert : temperatureAboveAlert, tempBelowAlert : temperatureBelowAlert, humidity : humidity, humidityTime : humidityTime, humidityAboveAlert : humidityAboveAlert, humidityBelowAlert : humidityBelowAlert, sound : sound, soundTime : soundTime, soundAboveAlert : soundAboveAlert, soundBelowAlert : soundBelowAlert, light : light, lightTime : lightTime, lightAboveAlert : lightAboveAlert, lightBelowAlert : lightBelowAlert }); } function getHomePage(request, response) { response.render("layout", {}); } ///////////////////////////////////////////////////////////////////////// function getGraphValues(response, type, start) { var dataRows = new Array; //Will be used later var dataStream = data.find({valueType: type}).sort({time: -1}). skip(start * PAGE_SIZE).limit(PAGE_SIZE).stream(); console.log("Finished creating the data stream!"); dataStream.on("data", function (item) { console.log("Streaming data!"); var time = item.time; var value = item.value; if (value < minimumValue) { dataRows.push([time, value, "<div style = 'color : #B80000'> Humidity Low: Water Crops! </div>", undefined]) } else if (value > maximumValue) { dataRows.push([time, value, "<div style = 'color : #282b66'> Humidity High! </div>", undefined]); } else { dataRows.push([time, value, undefined, undefined]); } }); dataStream.on("end", function () { checkIfAllDone(response, type, dataRows, graphData); console.log("Finished streaming data!"); }); } function graphData(response, temperatureArray, humidityArray, lightArray, soundArray) { console.log("Got into graphData!"); var temperatureJSON = JSON.stringify(temperatureArray); var humidityJSON = JSON.stringify(humidityArray); var lightJSON = JSON.stringify(lightArray); var soundJSON = JSON.stringify(soundArray);

Page 29: IoTReport

27

console.log("Finished making the JSON gurgles!"); response.render('graphs.jade', {dataToRender: humidityJSON}); } ///////////////////////////////////////////////////////////////////////// function startListening(err, db) { if (err) { return console.dir(err); console.log("Errored!"); } else { data = db.collection("data"); console.log("Got to before finding!"); data.find({}).count(function (err, count) { if (!err) { totalLength = count; totalPages = totalLength / PAGE_SIZE; server.listen(8123); console.log("Listening!"); updateCount(); } else { console.log("Oi Jeeb! Errored in counting the database..."); } }); console.log("Got to after finding and counting; before calculating pages"); } } function updateCount() { data.find({}).count(function (err, count) { if (!err) { totalLength = count; totalPages = totalLength / PAGE_SIZE; } else { console.err("Oi Jeeb! Error in counting database!"); } }); setTimeout(updateCount, 1500); }

4.3.5 Jade Code: Home Page This is the home page of the website. Jade is a language that compiles into HTML code, which can be displayed by web browsers. Compared to HTML, however, Jade is much more terse and compact with its syntax, allowing higher productivity when coding. //doctype html html head title= title link(rel='stylesheet', href='/stylesheets/style.css') meta(name='viewport', content='width=device-width, initial-scale=1.0') script(src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js') link(rel='stylesheet', href='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap-theme.min.css') link(rel='stylesheet', href='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.min.css') script(src='//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js') body block navBar

Page 30: IoTReport

28

nav(class='navbar navbar-default', role='navigation') .container-fluid .navbar-header button(class='navbar-toggle', data-toggle='collapse', data-target='#bs-example-navbar-collapse-1') span.sronly span.icon-bar span.icon-bar span.icon-bar a(class='navbar-brand', href='/#') Modular Data Collection System #bs-example-navbar-collapse-1(class='collapse navbar-collapse') ul(class='nav navbar-nav') li a(href='/currentData') Current Data li a(href='/graphs') Graphs //These are populated by extension views block pageTitle .jumbotron h3 You are at the home page right now! p Some things you can do are see the current data and go to the new page. block pageContent This file defines the overall layout of the whole page, including the navbar at the top. Under block pageTitle, the main text of the page is shown. In this file, it is shown under h3 and p. These are tags that define how text looks on the screen. In the extensions, which are below, the page inherits all the characteristics of this one. However, the block pageTitle section can be overridden by merely rewriting that portion of the code. This is shown below. // Created by marc on 1/17/15. extends layout block pageTitle .jumbotron h1 This is the current data page! h2 Here is the most recent last data in our database: .well h3 Temperature: #{temperature} h5 Measured At: #{temperatureTime} script. if (#{tempAboveAlert} === true) { console.log("Got into if!"); document.write("<h2> <div style = 'color : #f65700'> Temperature value exceeded! </div> </h2>"); } .well h3 Humidity: !{humidity} h5 Measured at: !{humidityTime} script. if (#{humidityAboveAlert} === true) { console.log("Got into if!"); document.write("<h2> <div style = 'color : #f65700'> Humidity value exceeded! </div> </h2>"); } .well h3 Sound: !{sound} h5 Measured at: !{soundTime}

Page 31: IoTReport

29

script. if (#{soundAboveAlert} === true) { console.log("Got into if!"); document.write("<h2> <div style = 'color : #f65700'> Sound value exceeded! </div> </h2>"); } .well h3 Light: !{light} h5 Measured at: !{lightTime} script. if (#{lightAboveAlert} === true) { console.log("Got into if!"); document.write("<h2> <div style = 'color : #f65700'> Light value exceeded! </div> </h2>"); }

4.3.6 Jade Code: Current Data Notice that although this page displays the same, uniform arrangement as the home page, it is written with much less code. This is because it extends layout, which is the file shown right above this one. All the code is therefore the same, except for the block pageTitle, which overrides that section in the home page code. \ extends layout block pageTitle h2 This is the graph for the light measurements: block pageContent .well script(src='http://www.google.com/jsapi') //Need the period to say that it applies to everything from here down! script. google.load('visualization', '1', {'packages': ['annotatedtimelineu']}); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('date', 'Date'); //Must have here since this is a time line. console.log("Printing before the number light levels line"); data.addColumn('number', 'Light levels'); console.log("Printing right here!"); data.addColumn('string', 'title1'); console.log("Printing right afterwards!"); data.addColumn('string', 'text1'); var lightRows = !{dataToRender}; //Use the exclamation mark to not escape console.log(lightRows); for(var i = 0; i < lightRows.length; i++) { lightRows[i][0] = new Date(lightRows[i][0]); //replace ISO string date with a Date object } data.addRows(lightRows); var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div')); chart.draw(data, {displayAnnotations: true}); //Draw it out! } google.setOnLoadCallback(drawChart);

Page 32: IoTReport

30

style. //Style options for the text... body { padding: 50px; font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; color: #2e2e2e; /*Color of the big text*/ } a { color: #57524f; /*Color of the links reload, previous, next*/ } #chart_div { background-color: #aba6a2; /*What is shown before the graph is rendered*/ width: 1000px; height: 240px; } body h1 Terrestrial Data System a(href='/graphs') Reset to default Zoom //-Make this not reload but reset to default zoom a(href='/graphs?direction=previous') &nbsp &nbsp&nbsp Previous &nbsp &nbsp &nbsp a(href='/graphs?direction=next') Next p #chart_div

4.3.7 Jade Code: Graphs Again, this extends the home page. This page displays the data in a chart using the Google Chart API.

Jade Code: No More Data extends layout block pageTitle h2 Oops! You have exceeded the bounds of the data! h3 Use the back option on your browser to return to the page you were at. This extends the home page. This page is shown when the user goes beyond the bounds of the data.

4.4 Deploying on Google Cloud Google Cloud Platform is a system for cloud computing provided by Google. Users can rent computers by the minute and pay a minimal cost for usage. The advantages of cloud computing is that one does not have to pay the large upfront cost of buying and maintaining one's own servers, especially if one is to use these servers for a

Page 33: IoTReport

31

limited amount of time. In this invention, Google Cloud is the service I selected to run my application on.

4.4.1 Home Page: Create Server When one first signs in to Google Cloud, one views an interface to create a server instance.

By clicking on Create Instance, one is led through several steps to configure the server.

Page 34: IoTReport

32

Here, one can select several things for the server, such as firewall settings, machine hardware settings, system image, and boot disk type.

4.4.2 Created Server After one selects the configuration one desires for the server, a new server is created for the user. The console is displayed:

On the side of this console, there are buttons labeled SSH and the IP address of the server. The SSH button allows the user to connect to the server through SSH, which stands for Secure Shell. This command-line interface allows the user to connect to the server through the Internet and issue commands to it. It is through this interface that programmers can upload, run, and test their programs on the servers.

Page 35: IoTReport

33

4.4.3 Upload Programs to Server Before uploading programs to the servers, the programmer must upload his program files to a Github repository, a site where anyone can view and download the program. As covered previously, Github allows for social coding. Users can clone the repository, which means that all the program code and files are copied to the user's computer. By issuing commands to the server, one can download all the program files to the server. Through the command line SSH to the server, the programmers can then run the downloaded programs.

4.4.4 Run Programs Now that the programs are downloaded onto the computer, it is possible for the programmer to deploy and run the server programs. In a real, large-scale application, one would implement load balancing to distribute the user requests between multiple computers, allowing for scalability. Since my program is comprised of 3 parts, the data receiving and storage, user request handling, and the database, three separate groups of computers would be run, each with independent load balancing. This would allow for independent scaling; for example, if there was a great number of user requests but not as much data coming in, the number of servers serving users could increase while the servers handling incoming data would not have to increase at all. The end goal, of course, is to provide faster reaction and response times to user requests.

4.5 Total Interaction Between Parts When the Tessel’s data reading program is started, it automatically begins sending data to the web server. Regardless of the state of the web server, whether it be on, off, or unresponsive, nothing will break on the Tessel’s side merely because of the web server. To start the server, both the data receiving and storage program and the request handling program must be initiated. On a separate server, there also must be the MongoDB database initialized and setup properly. This portion is not focused on by me because it is done automatically; all one has to do is to download it and run the setup program. Once the data receiving and storage program is running, it connects to the MongoDB database. When it has successfully connected, it is ready to begin receiving data from sensing stations. Upon startup, the request handling program also connects to the MongoDB database. It is then ready to receive user requests for data. When the data receiving and storage program receives data, it checks if it is in the proper format to be stored in the database. If it is not in the proper format, the program formats it into JSON, or JavaScript Object Notation, which is a data format that is composed of keys and values. Once this is done, the program writes it into the MongoDB database and sends a 200 OK response to the sensing station, letting it know that it has received the data and successfully written it into the database. When the request handling program receives a user request for data, it first parses the URL that the user has requested. It determines what page the user wants to visit. Then, depending on the user requested page, different data is returned to the user. This is facilitated through the numerous Jade pages that have been created. On

Page 36: IoTReport

34

many of the Jade pages, there are parameters that can modify the page that is displayed. When the server renders these pages, it passes these parameters to the Jade page, which allows different data to be shown to different users depending on their request. If by chance the user enters an inappropriate path on the website, the server returns a 404 Page Not Found error, signifying that the request was bad and the page the user was looking for was not found. My server side program approach utilizes the REST style web interface. REST stands for REpresentational State Transfer. It is a state-of-the-art software technology for allowing for machine-to-machine communications over the Internet through HTTP protocols. Instead of Internet servers merely responding to requests with a web page, servers are capable of sending, retrieving, and storing data from other connected servers. Other servers can request data from other servers using a representation of the whole data set, as is the case with JSON objects.

Page 37: IoTReport

35

5 Why my Solution is Better Than Existing Reflecting upon the deficiencies of the existing systems, we have classified their faults into four categories: Closed Systems, Storage Problems, Connectivity, and Data Access. Under Closed Systems, we have established that numerous systems require money to utilize, and therefore, do not support a global community around it. Under Storage Problems, we have established that several existing solutions only deal with data streams, and therefore do not store data in any way. Under Connectivity, we have understood that most current systems require sensors to be directly connected to the sensing station, and do not allow for a global system of sensing stations. Under Data Access, we have seen that these systems do not allow for a shared database of knowledge and data for anyone around the world to access and benefit. My solution overcomes the drawbacks seen in Closed Systems. This system that I have developed is open source and open to anyone to edit and modify. It does not depend upon money to utilize it, and therefore allows a global community to support and further develop it. The benefits of this are that a company is not necessary to own this solution, and that it benefits anyone in the world who wants to utilize this system. My solution alleviates the deficiencies in Storage Problems. Several other existing systems do not deal with the storage of data; they only process input streams. Although that can be more useful in other situations, that approach is not beneficial in this scenario. This use case specifically requires effective storage of all sensor data. My solution effectively stores sensor data in a MongoDB database. The problems listed under Connectivity are all addressed by my solution. My solution makes use of modular sensing stations connected through the Internet to gather data, instead of having all sensors connected by wire to the main data gathering station. This allows anyone to easily connect their sensors to the system from wherever they want. My solution remedies the drawbacks of Data Access, where most current systems do not allow for a shared database of knowledge and data for anyone around the world to access and benefit from. My solution, being open source, open, and completely online, allows anyone to access it. My solution satisfies all design criteria of being able to collect, analyze, and effectively display data from a variety of sensors and sources. Collection is provided for through numerous data collection centers, all connected to sensors and to servers in the cloud through the Internet. Analysis is provided through specialized database queries to locate specific types of data. Displaying data is seen through the numerous graphs provided to the user.

Page 38: IoTReport

36

6 Problems Encountered and Solutions While implementing this invention, I overcame several problems.

6.1 Learning Technologies Used Before setting out to program the applications in this invention, it was necessary to learn the numerous concepts that my invention involved. Among these are Node.js, JavaScript, MongoDB, Jade, and deploying, configuring, and administering computer clusters in Google Cloud. In total, merely learning these technologies took me well over 4 weeks of continuous work.

6.2 Tessel Internet Troubleshooting Since Tessel is a relatively new microcomputer, there has been very limited support, and the firmware is in some places shaky. While Tessel has built in Wi-Fi capabilities in its hardware, the software interface to this software is not completely bug-free. When I was writing my code, Tessel would occasionally and randomly just drop its Internet connection for certain reasons, as I would find out. Tessel, having a small board size, has a small Wi-Fi chip. This does not allow it to open numerous sockets at once, nor connect over a very long range. Sockets are the endpoints of Internet communication; each is unique and referenced by an IP address. The ability to not open multiple sockets at once is a drawback when sending data to remote servers, as each separate data packet sent opens a new socket. Since Tessel’s limit is 6 and 2 are utilized by the firmware itself, the user is left with only 4 sockets to use. To prevent my program from crashing because all the sockets are already in use when it tries to open a new one, I had to make appropriate monitoring of the socket statuses to only open a new one when there is a free socket. Another reason for the seemingly abrupt and unexplainable drop of Wi-Fi at times was due to buggy firmware. After numerous tests and diagnostics, I contacted the original inventors of Tessel. They recommended to overwrite the current firmware with a previous version of it because apparently this version had a bug. When I downloaded and overwrote the new firmware to Tessel, the Wi-Fi worked properly.

6.3 Documentation Since all of these technologies are new and developing, there are few tutorials online, and most of them are buggy. To complete this invention, it was necessary to study other people's examples that were posted online. For example, the Google Cloud tutorial had defective examples, so it was necessary to study other people's examples online, composed of documentation, blog posts, and user forums to resolve the issues.

Page 39: IoTReport

37

7 Summary In numerous industries today, there is a need for a system to collect, analyze, and effectively display data from a wide variety of sensors and sources. This invention provides an effective, reliable, and scalable means of doing so. For example, farmers can implement this system utilizing soil-sensing devices to efficiently analyze the conditions in their soil, allowing them to correlate crop yield with certain factors such as humidity, soil electrical conductivity, and sunlight. From there, farmers can improve their farming practices to generate the most crop yield. Open standards, protocols, and procedures will allow anyone to connect their own sensing stations to the system. The key elements of this system are sensing stations, which gather data, a web server that collects the data from the sensing stations and stores them in the database, and a database, which stores data collected from the sensing stations. It allows the users to access data through the website hosted by the web server. After research into numerous current solutions and finding that none of them match the criteria, I set out to design and create such a system. The part of this system I have focused upon is that of the web server and database storing data from sensing stations. Users can view sensor data on the website. The vision of this system is to create a public repository of sensor data from all over the world where people can access and utilize this data for their benefit. This effective, reliable, and scalable system satisfies the criteria of collecting, analyzing, and effectively displaying data from a variety of sensors and sources.

7.1 What is my Solution My solution provides an open source, scalable system to collect, store, and analyze large amounts of sensor data. A design diagram of my solution can be found in section 3 of this report. An overview of the system can be found in section 4.4, and a detailed report, along with code and explanations, can be found in section 4.5.

7.2 Why my Solution is Better Than Existing My system provides numerous advantages of existing systems. Where other solutions are proprietary and closed in nature, my solution is open source. This allows for a community to develop around it, fixing and advancing the system beyond that which any sole company or individual can. Where other systems require directly connected sensors to be able to measure sensor values, my system makes use of the Internet to allow for remote sensing and data acquisition by measuring environmental parameters through sensing stations that can be located anywhere around the world. My system is built with technologies that allow it to easily scale, such as MongoDB, the Express framework for Node.js, and running my server applications in the cloud.

Page 40: IoTReport

38

Summarily, my system meets the defined needs better than any other currently available system. It allows for much more expandability, data storage, and scalability than other systems offer for the same task.

7.3 Applications My system can be applied to numerous very concrete tasks and industries. Any industry that requires precision data acquisition, storage, and analysis would benefit from my system; examples would be farming and environmental monitoring. Farmers are implementing soil-sampling devices in their fields that measure numerous environmental parameters such soil temperature, humidity, and electrical conductivity of the soil. Farmers collect this data and correlate these factors with crop yield. This allows them to analyze which environmental factors increase their crop yield most. From there, they can improve their farming practices. These soil-sampling devices have grown relatively advanced; however, what is lacking is a system to gather, analyze, and store all this data. The system I invented can be used in this scenario.

Another example of where this system could be implemented would be in environmental monitoring. Scientists monitor the environment through remote probes and sensors measuring a wide variety of data. Data received from these sensors can be used to further understand the ecosystem and how we can conserve and protect it.

Page 41: IoTReport

39

8 Future Work In the future, some further improvements would consist of implementing privacy and security for cloud storage, integrating with Hadoop Big Data systems, and creating a library of pluggable analytics algorithms. This is made easy through the well-designed program architecture that promotes the addition of new modules and plug-ins.

Page 42: IoTReport

40

9 Acknowledgements I would like to thank my dad for his invaluable guidance and support, and my mom for her perseverance and patience.

Page 43: IoTReport

41

10 References AL-MUTLAQ, SARAH. "Soil Moisture Sensing by Hacking a Solar Light." Sparkfun. Sparkfun Electronics. Web. 5 Dec. 2014. <https://learn.sparkfun.com/tutorials/soil-moisture-sensing-by-hacking-a-solar-light>. Barbosa, Roberto, and Charles Overstreet. "What Is Soil Electrical Conductivity." LSU AgCenter. LSU AgCenter. Web. 11 Dec. 2014. <https://www.lsuagcenter.com/NR/rdonlyres/E57E82A0-3B99-4DEE-99B5-CF2AD7C43AEF/77101/pub3185whatissoilelectricalconductivityHIGHRES.pdf>. Capewell, Martin. "The Why and How to Testing the Electrical Conductivity of Soils." The Why and How to Testing the Electrical Conductivity of Soils. Web. 11 Dec. 2014. <http://www.agriculturesolutions.com/resources/92-the-why-and-how-to-testing-the-electrical-conductivity-of-soils>. Grisso, Robert, Mark Alley, David Holshouser, and Wade Thomason. "Precision Farming Tools: Soil Electrical Conductivity." Virginia Cooperative Extension. Virginia Cooperative Extension, 6 Dec. 2006. Web. 13 Dec. 2014. <http://pubs.ext.vt.edu/442/442-508/442-508_pdf.pdf>. "JavaScript Reference." Mozilla Developer Network. Mozilla, 1 Jan. 2005. Web. 1 Jan. 2014. <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference>. "Low Voltage Temperature Sensors." Cloudfront. 1 Jan. 1996. Web. 4 Dec. 2014. < http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/Temp/TMP35_36_37.pdf >. Node.js v0.12.0 Manual & Documentation. Nodejs.org,. ' Node.Js V0.12.0 Manual & Documentation'. N. p., 2015. Web. 8 Mar. 2015. "Ohm's Law Calculator and Formulas." Microphone Recording Technology and Studio Equipment. Alexander Sengpiel. Web. 4 Dec. 2014. <http://www.sengpielaudio.com/calculator-ohmslaw.htm>. Quickstart: Creating an instance and launching Apache. Google Developers,. 'Quickstart: Creating An Instance And Launching Apache'. N. p., 2015. Web. 8 Mar. 2015. "Soil Electrical Conductivity." United States Department of Agriculture. United States Department of Agriculture. Web. 11 Dec. 2014. <http://www.nrcs.usda.gov/Internet/FSE_DOCUMENTS/nrcs142p2_053280.pdf>. "Tessel API Documentation." Tessel. Technical Machine. Web. 4 Dec. 2014. <https://tessel.io/docs/hardwareAPI>.

Page 44: IoTReport

42

"Tessel Documentation." Tessel. Technical Machine, 1 Jan. 2013. Web. 4 Dec. 2014. <https://tessel.io/docs/home>. "Tessel Modules." Tessel. Technical Machine, 1 Jan. 2013. Web. 4 Dec. 2014. <https://tessel.io/modules>.

Page 45: IoTReport

43

11 Glossary These are not full definitions of the terms; they are only the basic essence of them as used in this report.

• Amazon Kinesis: A subscription service provided by Amazon for the processing of data from input streams.

• Apache Storm: An open source system for the processing of data from input streams.

• Asynchronous: Able (of a programming language or framework) to execute multiple tasks in parallel, thus speeding up execution.

• Cloud-Based: A concept where instead of buying and maintaining one’s own computer hardware, one rents computers from other companies at a cheap rate.

• Database: A system for the storage and easy access of a large amount of data.

• Github: A social coding website that facilitates the sharing of open source code and numerous people collaborating on a single project.

• Google Charts API: An API made public by Google that facilitates the easy development of charts and graphs in web pages.

• Google Compute Engine: A cloud computing service provided by Google that this invention runs on.

• HTTP: A standard Internet protocol that defines the behavior of web servers. • Internet of Things: A concept where everything one owns (or in the world) can

communicate with each other, the end goal being human’s lives are made easier as all devices they interact with become smarter.

• Jade: A high performance templating engine for JavaScript and Node.js • JavaScript: A functional programming language that runs in browsers, web

servers, and on the Tessel. • MongoDB: A document-oriented database. • Node.js: A framework for scalable, asynchronous server-side processing using

JavaScript. • Open Source: The state of a project to be posted on a social coding site, such

as Github, and made available for all to use and contribute to. • REST: Representational State Transfer, a design technique for web server

APIs allowing for the transmission of data between two remote servers on the Internet by utilizing a representation of the data storage.

• Scalable: Able to expand to accommodate an increased amount of users and data without changing the program itself.

• Splunk: A commercial system for the collection and analytics of large amounts of data.

• Tessel: A programmable microcomputer with built in hardware implementation of Internet and numerous ports to connect sensors to.

• Web Client: A computer connected to the Internet that sends requests to web servers.

Page 46: IoTReport

44

• Web Server: A computer connected to the Internet that can send data to other computers connected to the Internet.