1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Sensor Network Data Collection and Storage Chuck Bell, Sr. Software Developer, MySQL.

Slides:



Advertisements
Similar presentations
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1.
Advertisements

1 Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
ARDUINO FRAMEWORK.
A Java Architecture for the Internet of Things Noel Poore, Architect Pete St. Pierre, Product Manager Java Platform Group, Internet of Things September.
What is MySQL? MySQL is a relational database management system (A relational database stores data in separate tables rather than putting all the data.
CONNECT TO THE CLOUD IOT Course Vijay Janapa Reddi Intel (UT Austin)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Track the changes in your Apex application between releases: Yes you can Plsql.
Security Awareness: Applying Practical Security in Your World, Second Edition Chapter 5 Network Security.
Senior Design Project 2004/2005 Web Enabled Calling Number Delivery Daniel St. Clair Barron Shurn Professor Soules 10/28/2004.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Oracle SQL Developer What’s New in Version 4.1 Jeff Smith
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Advanced Metadata Modeling Modeling for the Oracle Business Intelligence Cloud.
Data Networking Fundamentals Unit 7 7/2/ Modified by: Brierley.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |
CON Software-Defined Networking in a Hybrid, Open Data Center Krishna Srinivasan Senior Principal Product Strategy Manager Oracle Virtual Networking.
Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 2 Hidden Gems of APEX David Gale Software Engineer Oracle Application Express November,
Creating Database Tables CS 320. Review: Levels of data models 1. Conceptual: describes WHAT data the system contains 2. Logical: describes HOW the database.
The Safe Harbor The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated.
Best Practices for Supporting Oracle Hyperion EPM and Business Intelligence Solutions Mitra Veluri Senior Principal Technical Support Engineer David Valociek.
Best Practices for Upgrading Oracle PeopleSoft Environments
Oracle Database 12c Data Protection and Multitenancy on Oracle Solaris 11 Xiaosong Zhu Senior Software Engineer Copyright © 2014, Oracle and/or its affiliates.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit The Newest JDE Module – Rental Management Joel Sandberg Sales Consultant.
QAD .Net UI: New Enhancements
Getting Started with Oracle Compute Cloud
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Download & Play E-Learning System PROPOSAL draft1.0.
Tele-presence – Connecting Two Processing Platforms via Internet Controlling the Screen based on Distant User Input ServerClient 1.
Overview of SQL Server Alka Arora.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1.
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
Midterm Review - Network Layers. Computer 1Computer 2 2.
1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8 Reporting from Contract.
Oracle E-Business Suite Order Management: Presenting the HTML and Mobile User Experience Durgaprasad Bodapati Director, Product Management Bhavana Sharma.
Oracle Application Express 3.0 Joel R. Kallman Software Development Manager.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. An Auto-Join Network of Things Wong, H. and Wesson, B. Oracle Confidential – Internal/Restricted/Highly.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 1 Quick Tutorial – Part 2 Open Data Web Services for Oracle BPM August, 2013 Forms.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 17 This presentation © 2004, MacAvon Media Productions Multimedia and Networks.
1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8 Contract Management.
1 Working with MS SQL Server Textbook Chapter 14.
(Chapter 10 continued) Our examples feature MySQL as the database engine. It's open source and free. It's fully featured. And it's platform independent.
CON Software-Defined Networking in a Hybrid, Open Data Center Krishna Srinivasan Senior Principal Product Strategy Manager Oracle Virtual Networking.
Computer Emergency Notification System (CENS)
Kirkwood Center for Continuing Education Introduction to PHP and MySQL By Fred McClurg, Copyright © 2015, Fred McClurg, All Rights.
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. JD Edwards Summit Really Cool Demo Stuff – 2015 Edition!!!!! For demo content, please.
Application Block Diagram III. SOFTWARE PLATFORM Figure above shows a network protocol stack for a computer that connects to an Ethernet network and.
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
1Copyright © 2011, Oracle and/or its affiliates. All rights reserved.
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
Workforce Scheduling Release 5.0 for Windows Implementation Overview OWS Development Team.
RESTful Microservices In Java With Jersey Jakub Podlešák Software Engineer Oracle, Application Server Group September 29, 2014 Copyright © 2014, Oracle.
Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 17 This presentation © 2004, MacAvon Media Productions Multimedia and Networks.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
Basic Circuits – Lab 5 Wireless Networking Xmedia Spring 2011.
COMPUTER NETWORKS Hwajung Lee. Image Source:
Final Presentation Smart-Home Smart-Switch using Arduino
CMPE 226 Database Systems April 19 Class Meeting Department of Computer Engineering San Jose State University Spring 2016 Instructor: Ron Mak
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 1.
Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 12 1.
1 Copyright © 2005, Oracle. All rights reserved. Oracle Database Administration: Overview.
Oracle Java Cloud Service Oracle Develop July 2013.
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | What You Need to Know About User Defined Objects (UDOs) With Tools Release 9.2.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Daddy, what's a middle wear? An incredibly oversimplified explanation of what Middleware.
Frequently Asked Questions (FAQ)
Val Manes Department of Math & Computer Science
Data Networking Fundamentals
My Oracle Support (The next generation Metalink experience) lynn
Build a Web App with Oracle REST Data Services &
JD Edwards Support and Oracle Cloud Infrastructure: A Successful Path to Oracle Cloud
QAD Reporting Framework
Multimedia and Networks
Storing and Processing Sensor Networks Data in Public Clouds
Presentation transcript:

1Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Sensor Network Data Collection and Storage Chuck Bell, Sr. Software Developer, MySQL Utilities, Oracle Luis Soares, Sr. Software Engineer, MySQL Replication, Oracle July 18, 2012 v1.0

2Copyright © 2012, Oracle and/or its affiliates. All rights reserved. THE FOLLOWING IS INTENDED TO OUTLINE OUR GENERAL PRODUCT DIRECTION. IT IS INTENDED FOR INFORMATION PURPOSES ONLY, AND MAY NOT BE INCORPORATED INTO ANY CONTRACT. IT IS NOT A COMMITMENT TO DELIVER ANY MATERIAL, CODE, OR FUNCTIONALITY, AND SHOULD NOT BE RELIED UPON IN MAKING PURCHASING DECISION. THE DEVELOPMENT, RELEASE, AND TIMING OF ANY FEATURES OR FUNCTIONALITY DESCRIBED FOR ORACLE'S PRODUCTS REMAINS AT THE SOLE DISCRETION OF ORACLE.

3Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Speakers Chuck Bell, PhD –Senior Software Developer –MySQL Utilities Team Lead Luis Soares –Senior Software Engineer –MySQL Replication Team Lead

4Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Agenda What are Sensor Networks? Sensor Nodes Data Nodes Data Collection Nodes Data Collection Methods Introducing the MySQL Connector/Arduino MySQL Connector/Arduino Examples Summary

5Copyright © 2012, Oracle and/or its affiliates. All rights reserved. What are Sensor Networks? An association of sensors to monitor an event or conditions. Wired –Laboratory monitoring –Manufacturing monitoring Wireless –Environmental monitoring –Security monitoring Hybrid –Many types of sensors

6Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Sensor Nodes Read and propagate values from sensors. Sensor examples –Temperature –Humidity –Proximity –Voltage –Light –… and many more Sensor types –Analog –Digital

7Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Data Nodes More complex than sensor nodes –Require additional circuitry –Require a microprocessor Store the data Types of data –Numeric values of integer, float, etc. –Character data –Datetime –Complex : mix of types Hybrid nodes – sense and store

8Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Data Collector Nodes Dedicated node(s) to manage and store the data –Collect the data –Parse or cull the data –Store the data Relieves sensor nodes of the burden thereby reducing size and complexity of sensor nodes –Easier/cheaper to build –Easier to conceal (smaller size) –Enables lower power requirements

9Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Data Collection Methods Transmit results to a dedicated coordinator or data node Post results to cloud-based services –Pachube: –Nimbits: –Others: ThinkSpeak, Digi, Sensor Cloud, etc. Save data locally to files on removable media Save data locally as part of distributed database Run a small web server on an Arduino node to store and display data (new) Write data to a database server directly –MySQL Connector/Arduino

10Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Pachube (COSM)

11Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Pachube (COSM) Code Excerpt #include #define APIKEY "YOUR API KEY GOES HERE" // replace your Cosm api key here #define FEEDID // replace your feed ID #define USERAGENT "My Project" // user agent is the project name byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; IPAddress ip(10,0,1,20); // initialize the library instance: EthernetClient client; char server[] = "api.cosm.com"; // name address for cosm API unsigned long lastConnectionTime = 0; boolean lastConnected = false; const unsigned long postingInterval = 10*1000;...

12Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Pachube (COSM) Code Excerpt // this method makes a HTTP connection to the server: void sendData(int thisData) { if (client.connect(server, 80)) { Serial.println("connecting..."); // send the HTTP PUT request: client.print("PUT /v2/feeds/"); client.print(FEEDID); client.println(".csv HTTP/1.1"); client.println("Host: api.cosm.com"); client.print("X-ApiKey: "); client.println(APIKEY); client.print("User-Agent: "); client.println(USERAGENT); client.print("Content-Length: "); // calculate the length of the sensor reading in bytes: // 8 bytes for "sensor1," + number of digits of the data: int thisLength = 8 + getLength(thisData); client.println(thisLength);

13Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Pachube (COSM) Code Excerpt // last pieces of the HTTP PUT request: client.println("Content-Type: text/csv"); client.println("Connection: close"); client.println(); // here's the actual content of the PUT request: client.print("sensor1,"); client.println(thisData); } else { // if you couldn't make a connection: Serial.println("connection failed"); Serial.println(); Serial.println("disconnecting."); client.stop(); } // note the time that the connection was made or attempted: lastConnectionTime = millis(); }

14Copyright © 2012, Oracle and/or its affiliates. All rights reserved. New! MySQL Connector/Arduino Simple to Use No Dedicated Computer Needed Provides a minimal client-level access to MySQL Direct connection to a MySQL Server Arduino Library Module Open Source - GPLv2 –Launchpad: Ok, But Why?

15Copyright © 2012, Oracle and/or its affiliates. All rights reserved. MySQL Connector/Arduino Enables sensor networks to realize the Internet of Things Expands the versatility of sensor networks –Home automation with recorded with history of events –Advanced data analysis of sensor data –Another method for making data visual on the internet Motivation –Demonstrate the MySQL client protocol applicability to embeded HW –Open doors for the Arduino community for data storage –Provide a database option for sensor network data

16Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino - Features Supports DML –SELECT, SHOW, etc. Supports DDL –CREATE, DROP, INSERT, UPDATE, DELETE Retrieve Results

17Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino - Limitations Multiple result sets not supported. Data updates and result set rows must fit in memory. Result set returned via Serial interface is CSV. Consumes about 16k of program space. Uses dynamic memory. Server errors sent to Serial interface. Requires a modified version of SHA1 code: –

18Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Getting Started Download Library – Download SHA1 code – Modify SHA1 code See Readme.txt and.diff files included with library In Arduino, open new project and include the library Set the server’s IP, port. Go wild!

19Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Getting Results #include #include "mysql.h” #include byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip_addr(192, 168, 0, 15); IPAddress server_addr(192, 168, 0, 7); char user[] = "root"; char password[] = ”xxxxxxx"; Connector my_conn; // The Connector/Arduino reference...

20Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Getting Results void setup() { Ethernet.begin(mac_addr); Serial.begin(115200); delay(1000); Serial.println("Connecting..."); if (my_conn.mysql_connect(server_addr, 3306, user, password)) { delay(1000); my_conn.cmd_query("SELECT * FROM test.temp LIMIT 8"); my_conn.show_results(); } else Serial.println("Connection failed."); }

21Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Getting Results Connecting... Connected to server version log. id,temp_c,rel_humid 1,24.5,46 2,24.5,45.1 3,24.4,44.8 4,24.4,44.7 5,24.4,44.7 6,24.4,44.7 7,24.4,44.6 8,24.4, rows in result.

22Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Sensor Node #include #include #include #include "mysql.h” #include byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip_addr(192, 168, 0, 15); IPAddress server_addr(192, 168, 0, 7); char user[] = "root"; char password[] = ”xxxxxxx"; Connector my_conn; // The Connector/Arduino reference...

23Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Sensor Node void read_data() { DHT22_ERROR_t errorCode; errorCode = myDHT22.readData(); switch(errorCode) { case DHT_ERROR_NONE: char buf[128]; sprintf(buf, "INSERT INTO test.temp VALUES (NULL, %hi.%01hi, %i.%01i)", myDHT22.getTemperatureCInt()/10, abs(myDHT22.getTemperatureCInt()%10), myDHT22.getHumidityInt()/10, myDHT22.getHumidityInt()%10); my_conn.cmd_query(buf); Serial.println("Data read and recorded."); break;... }

24Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Sensor Node void setup() { Ethernet.begin(mac_addr); Serial.begin(115200); delay(1000); Serial.println("Connecting..."); if (my_conn.mysql_connect(server_addr, 3306, user, password)) delay(500); else Serial.println("Connection failed."); } void loop() { delay(read_delay); read_data(); }

25Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Sensor Node mysql> select * from test.temp limit 8; | id | temp_c | rel_humid | | 1 | 24.5 | 46 | | 2 | 24.5 | 45.1 | | 3 | 24.4 | 44.8 | | 4 | 24.4 | 44.7 | | 5 | 24.4 | 44.7 | | 6 | 24.4 | 44.7 | | 7 | 24.4 | 44.6 | | 8 | 24.4 | 44.5 | rows in set (0.00 sec)

26Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Data Collector Uses Xbee API mode on Coordinator Uses Xbee AT mode on Routers and end points Receives data from sensor nodes Parses data packet from sensor Forms SQL INSERT statement Issues statement to database

27Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Example Network Xbee Sensor Nodes Arduino with Connector/Arduino and Xee Coordinator MySQL Server router databases

28Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Data Collector void loop() { int discard; if (Serial.read() == 0x7e) { // Signal received packet digitalWrite(12, HIGH); delay(500); digitalWrite(12, LOW); delay(500); // Skip to address low for (int i = 0; i < 7; i++) discard = Serial.read(); // Read address low char address[9]; for (int i = 0; i < 4; i++) sprintf(&address[i*2], "%2x", Serial.read());

29Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Data Collector // Skip to sensor data for (int i = 0; i < 7; i++) discard = Serial.read(); // Read sensor data int high_b = Serial.read(); int low_b = Serial.read(); // Check calibrated threshold for analog sensor if (high_b > 2) { char buf[128]; sprintf(buf, "INSERT INTO test.motion VALUES (NULL, '%s')", address); my_conn.cmd_query(buf); }

30Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Connector/Arduino – Data Collector mysql> select * from motion; | event_date | node_id | | :29:07 | db | | :29:12 | db | | :29:17 | db | rows in set (0.00 sec)

31Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Summary There are several ways to collect data in sensor networks There is a new option for sensor network developers The MySQL Connector/Arduino –Simplifies sensor networks used to collect data –Eliminates reliance on internet –Eliminates reliance on dedicated computer (for data collection) –Permits greater granularity of storage allowing developer to create a database schema fitting the data Opens a whole new chapter in sensor networks –Many solutions use MySQL for analysis, presentation, etc. –Another route into the cloud via data ingestion/storage in MySQL

32Copyright © 2012, Oracle and/or its affiliates. All rights reserved.