- 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
Coursework
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 |
Grading Policy
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
- Show up for the lecture.
(Attendance will be taken 30 minutes after the session starts) - Take the quiz.
(which will cover all the materials that we will discuss) - Complete ONE of the homework.
(I will release a homework for this class on the 19th of July)
What should you expect from this session?
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
- Understand the idea of Internet of Things.
- Basic technical aspects involved with the Internet of Things.
- Familiar with the Raspberry Pi hardware architecture.
- Working knowledge on setting up a Raspberry Pi for IoT development.
- Able to ssh into your Raspberry Pi IoT module
What do you expect from these 3 sessions?
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.)
Connect to WiFi AP
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
Do NOT connect to iotclass
If you cannot see iotclass-5, let me know.
What is IoT
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
- Current top Tech buzzwords
- Large corporations value its market in tens of trillions of dollars.
- There are also plans to release tens of billions of connected devices.
-
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.
What is IoT
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
- Internet of Everything
- Web of Things
- Internet of People and Things
- Machine-to-Machine
- Cyber-Physical Systems
(...)
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
What is IoT
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Before we define IoT, let's look at why IoT?
- IoT was a term first coined by Kevin Ashton, a British technology pioneer in 1999 when most data on the Internet was entered or captured by human beings.
- Ashton coined the term to illustrate the power of using Radio-Frequency Identification (RFID) tags in order to count and track goods more efficiently and without any human intervention.
- But, if systems can access data captured by sensors directly, of course, the data will be both more abundant and more correct . This was known decades ago and is a field of study in its own right, labeled "sensor networks".
What is IoT
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
- So IoT = Sensor networks?
IoT is not same as sensor networks since `Things` doesn't have to be sensors and similarly sensor networks doesn't HAVE to be connected to Internet. -
So IoT = Big data?
IoT is not same as Big Data because `Things` are not required to capture or generate data. -
M2M?
IoT is not part M2M because being on Internet, it is implied that humans can access these `Things` directly.
And No, IoT is also not CPS because CPS concern themselves with non-Internet protocols for transfer of messages between devices etc.
What the .... is IoT ?
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.
This is IoT
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..
Is Cellphone a `Thing` in IoT
Communication Models
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
Communication Models
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
Communication Models
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!
Communication Models
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
Communication Models
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
Communication Models
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
Raspberry Pi
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Introduction to Rpi as an IoT module
Raspberry Pi
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
That's all it takes to start using Raspberry Pi
Get to know your IoT module
Total of 4 USB 2.0 ports
10/100 Mbps Eth port
28 GPIO Pins*
MicroSD card
Video
Out
5V 2A
DC_supply
Raspberry Pi
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Get to know your IoT module
26 "general use" GPIO pins
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!
Not So Fast!
Get to know your IoT module
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
Why?
Example
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
SensorX
Rpi
0, 1
Analog
Digital
So?
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
How?
ADC
Raspberry Pi
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Get to know your IoT module
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
Installing Raspbian
Default Raspbian Jessie [Lite and Desktop]
Customized Raspbian
Other OS [Ubuntu, Windows IoT Core]
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Default Raspbian Jessie
[Lite and Desktop]
Download the Raspbian Jessie image
Prep the micro SD card
Flash micro SD card
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Customized Raspbian
Download PiBakery
Fire up PiBakery
CUSP IoT2017
PiBakery
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Other OS*
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
Poll Check!!
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Our Lab!
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Hands On!
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
Coursework
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
What should you expect from this session?
- Understand the configuration for different network interfaces
- Logging!!
- Using python to parse information about network interfaces and using them in the script
- Developing a fully-functional IoT module
- Setting up VPN server and connecting your Pi's to it
- Technologies for client server communication.
- Sending some sensing data to the server
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Connect to WiFi AP
Connect to WiFi: iotclass-5,
(authentication: iotclass)
Do Not Stay on NYU or NYU-legacy or any other AP
Do NOT connect to iotclass
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
Keep Updating the shared Document
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
Uh - Oh!
(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
Coursework
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
What should you expect from this session?
- Understanding basics of VPN
- Setting up VPN client on your nodes and laptops and connecting to the VPN server
- Collecting Stats from Pi
- Things involved in setting up server - client communication
- Basics of Websocket
- Real-time Visualization
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Connect to WiFi AP
Connect to WiFi: iotclass-5,
(authentication: iotclass)
Do Not Stay on NYU or NYU-legacy or any other AP
Do NOT connect to iotclass
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
Keep Updating the shared Document
mohit sharma (mohit.sharma@nyu.edu)
©2017 NYU CUSP
Downloading VPN Client
Mac Users: Tunnelblick
https://tunnelblick.net/downloads.html
Ubuntu Users: OpenVPN client
sudo apt-get install openvpn
Windows Users: OpenVPN client
https://openvpn.net/index.php/open-source/downloads.html