- Mohit Sharma
Internet of Things and Microservices
©2017 NYU CUSP
https://slides.com/mohitsharma44/cusp-gx-6004-c/live
https://github.com/Mohitsharma44/CUSP-GX-6004-C
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Day 1 |
---|
Introduction to IoT - What is IoT - Why IoT |
Communication Models |
-- BREAK -- 15 minutes -- |
Introduction to using Raspberry Pi as an IoT module - What is a Raspberry Pi - Using Raspberry Pi as a platform for prototyping |
Hands-on - Demo installing OS on Raspberry Pi - Refresher on basic Linux commands - First login and setting things up for next session |
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Live Poll: http://etc.ch/NYXt
(I will check the polls by the end of the lecture today )
Shared Document: bit.ly/iot17-notes
(For adding notes, points, need clarification, misc.)
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Connect to WiFi: iotclass-5,
(authentication: iotclass)
Do Not Stay on NYU or NYU-legacy or any other AP
If you cannot see iotclass-5, let me know.
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Despite this, nobody seems to agree on what Internet of Things (IoT) actually is.
The only thing people agree on is that whatever it is, it is worth a lot of money.
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
And where there is a lot of money, there is a lot of competition, which means there is a lot of confusion!
But in order to proceed, we need to Define IoT
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Before we define IoT, let's look at why IoT?
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
A very simple definition would go something like this:
The IoT is what we get when we connect `Things`, which are not operated by humans, to the Internet.
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Something you can connect to..
Something that can connect to you..
Something that is connected to internet..
Something that senses..
Something that crunches and exchanges data..
Something that automates..
Something that connects to other things..
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
From an operational perspective, it is useful to think technically about how the IoT devices connect and communicate. (RFC 7452)
Device to Device Communication
Device to Cloud Communication
Device to Gateway Model
Back-End Data-Sharing Model
mohit sharma (mohit.sharma@nyu.edu)
Device to Device (D2D) Communication
Devices will be the main users in the IoT ecosystem and thus D2D communication[1]
Smart Bulb
Smart Switch
Wireless Network
e.g. Bluetooth, Z-Wave, ZigBee
These network allows devices that adhere to a particular communication protocol to communicate.
Eg. Home Automation -- lights, door locks, thermostat etc.
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
Device to Cloud (D2C) Communication
In this model, the IoT device connects directly to an Internet cloud application service provider.
Device with Sound sensor
Device with CO
sensor
©2017 NYU CUSP
HTTP, TLS, TCP, IP
CoAP, UDP, IP
Application Server
Eg. NEST, Samsung Smart TVs, etc.
CUSP's $4.2M NSF-funded project -- SONYC uses this model in production!
And so will we, in this course!
mohit sharma (mohit.sharma@nyu.edu)
Device to Gateway (D2G) Communication
In this model, the IoT device connects to an Internet cloud application service provider via Local Gateway.
Device with Sound sensor
Device with CO
sensor
©2017 NYU CUSP
HTTP, TLS,
TCP, IP
CoAP, UDP,
IP
Application Server
Local Gateway
IPv4 / IPv6
Bluetooth, WiFi, Ethernet, LR-WPAN
mohit sharma (mohit.sharma@nyu.edu)
Back-End Data-Sharing Model
Users can export and analyze the smart object data from a cloud service in combination with data from other sources.
Device with Sound sensor
Device with CO
sensor
©2017 NYU CUSP
HTTP, TLS,
TCP, IP
CoAP, UDP,
IP
Application Server 1
Application Server 2
Application Server 3
Protocol Buffers,
JSON
mohit sharma (mohit.sharma@nyu.edu)
What governs the selection of communication models?
Technical complexity
Availability of resources
Open versus Proprietary nature of the IoT devices
Device interoperability
Enabling user (adding value to the user)
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Total of 4 USB 2.0 ports
10/100 Mbps Eth port
28 GPIO Pins*
MicroSD card
Video
Out
5V 2A
DC_supply
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
UART / serial communication (Pin 8, 10)
Communicate with external peripheral like Arduino (I2CPin 3, 5, 27, 28)
Pulse code modulation (Pin 12, 35, 38, 40)
General Purpose Clock (Pin 7, 29, 31) and so on ...
You may want to check out: https://pinout.xyz
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
image credit: http://www.flaticon.com/authors/eucalyp
SensorX
Rpi
Data!
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
SensorX
Rpi
Data!
0.46020967, 2.34629644, 0.16289884, 1.7682243 , 1.09522783
0, 1
Analog
Digital
Example
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
SensorX
Rpi
0, 1
Analog
Digital
Example
ADC
ADC
1.10, 1.66, 2.21, 2.77, 3.33, 3.89, 4.44, 5.00
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
1.10, 1.66, 2.21, 2.77, 3.33, 3.89, 4.44, 5.00
0, 1,
10, 11,
100, 101, 110, 111
Analog
Digital
ADC
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Debian optimized for the Raspberry Pi hardware
Debian has a reputation within the Linux community for being very high-quality, stable and scalable.
Extensive and friendly user community.
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Default Raspbian Jessie [Lite and Desktop]
Customized Raspbian
Other OS [Ubuntu, Windows IoT Core]
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Download the Raspbian Jessie image
Prep the micro SD card
Flash micro SD card
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Download PiBakery
Fire up PiBakery
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Windows 10 IoT Core: https://developer.microsoft.com/en-us/windows/iot/getstarted
* I haven't tested these in-depth
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Connect to WiFi: iotclass-5, (authentication: iotclass) Go to: http://192.168.1.100:8888 (note the port number) Login with your NYU net-id Download the ssh key (Make note of the IP address (this will be your Pi for the next 3 sessions)
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Day 2 -- All Hands On!! |
---|
Networking Fundamentals - Ethernet - WiFi |
Python wrapper for above Networking tools (Reg-ex) |
-- BREAK -- 15 minutes -- |
Setting up VPN Server - Connecting Pi's to VPN server |
Technologies for Client - Server communication - Setting up Server - pycurl to send data to the server |
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Connect to WiFi: iotclass-5,
(authentication: iotclass)
Do Not Stay on NYU or NYU-legacy or any other AP
If you cannot see iotclass-5, let me know*.
* well, I really dont have spare laptops, so just peep into your neighbors
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Shared Document: bit.ly/iot17-notes
(For adding notes, points, need clarification, misc.)
I have updated the document with some comments. I will add the notes on flashing your memory card by tomorrow
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
(Check): sudo dpkg -L wireless-tools (If not installed): sudo apt-get install wireless-tools (Install): sudo apt-get update (Install): sudo apt-get install python-dev python-pip (Install): sudo pip install virtualenv ipython==5.0
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Day 3 -- All Hands On!! |
---|
Connecting to VPN Server - Connect Pi to VPN - Connect your laptop to VPN |
Collecting Stats from Pi |
-- BREAK -- 15 minutes -- |
Sending Data to server - Setting up server for this lab (demo / hands on) - Setting up client for HTTP upload |
Questions |
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Connect to WiFi: iotclass-5,
(authentication: iotclass)
Do Not Stay on NYU or NYU-legacy or any other AP
If you cannot see iotclass-5, let me know*.
* well, I really dont have spare laptops, so just peep into your neighbors
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
https://tunnelblick.net/downloads.html
sudo apt-get install openvpn
https://openvpn.net/index.php/open-source/downloads.html