About US
Mahdi Hosseini Moghaddam
Education:
Industrial Experiences:
Milad Movahedin
Education:
Industrial Experiences:
Goal of This Presentation
Is not:
◦ Business model of IoT
◦ Security of IoT
◦ Application of IoT
Is:
◦ A general architecture for IoT
◦ How to Create a prototype
◦ An overview of some IoT platform
◦ More suitable programming language for IoT
Caution
oI cannot explain everything
oYou cannot get every detail
oTry to get a big picture
oGet some useful keyword
oConnect it with your daily work
Definitions
Internet of things: that we refer to this as IoT.
Wireless Sensor Network: that we refer to this as WSN.
Machine learning: that we refer to this as ML, is a system that can learn from data
Embedded System: is a sort of computer system often with real-time computing constraints.
Content of this presentation
IoT Overview
IoT Architecture
◦ Hardware device
◦ Protocols
◦ Platforms
◦ Etc
Open source Platforms
Programming Languages of choice
Demo
Introduction
• The term Internet of Things was first used
by Kevin Ashton in 1999.
• Refers to uniquely identifiable objects
(things) and their virtual representations in
an Internet-like structure
Wireless Sensor Network
• The networks typically run Low Power
Devices
• Consist of one or more sensors, could be
different type of sensors (or actuators)
Device Layer
oDevices are the ‘things’ of Internet of Things. Every device around us has a potential to connect
to internet and provide us with some useful information.
oEmbedded device has a chip or a circuitry called microcontroller that has all the necessary
ingredients to power or control the device. Ingredients typically include a memory chip, an
embedded processor , IO and network ports etc.
oIt may also have a small OS running like Linux that enables us to drive the device. The ability to
control the device and make it talk to the network is one of key aspects in IoT .
Sensors
oSensors are devices that detect events and
read changes in its environment.
oThe sensed information can be viewed in a
console connected to another device like
desktop or mobile. Sensors come in
connected form and a single form.
oConnected sensors are network of sensor
nodes that capture information from the
physical object or resource within a
particular area and send it across over the
network
Tagged Devices
oRadio Frequency Identification (RFID) tags
are smart bar codes that identifies the
device or a product and works in
conjunction with the RFID reader to track
the product information and send it
across the network.
oNear Field Communication (NFC) enables
devices to communicate with each other
over shorter radio frequencies. It works
more like RFID, but the device with NFC
protocol can act both as a reader and a
tag and therefore it can also be used as a
two way communication.
Application Protocol
MQTT: MQ Telemetry Transport (MQTT) is a lightweight message oriented middleware (MOM) that is
based on publish/subscribe model. The protocol is designed to be used for machine- to-machine
communication that involves small data footprint.
CoAP: The Constrained Application Protocol (CoAP), as the name suggests it is a protocol used with
resource constrained devices and networks.
AMQP: Advanced Message Queuing Protocol (AMQP) is another popular message oriented
middleware that has slowly made its place in the world of IoT . The protocol supports both queue
based and pub/sub messaging model.
AllJoyn: AllJoyn is a collaborative open-source software framework that makes it easy for devices to
discover , publish/broadcast itself and communicate with each other . AllJoyn was created to
promote interoperability and seamless integration between devices and application through a set of
core features.
DDS: DDS (Data Connectivity Standard) is part of OMG IoT standards, which enables network
interoperability for connected machines, enterprise systems, and mobile device.
MQTT(2)
oMessage Queueing Telemetry Transport
oA lightweight publish/subscribe protocol standard for traditional networks
oData-centric – Separates Data (Payload) from Metadata (Topic)
MQTT Topics & Wildcards
Topics are hierarchical (like filesystem path):
– /wsn/sensor/R1/temperature
– /wsn/sensor/R1/pressure
– /wsn/sensor/R2/temperature
– /wsn/sensor/R2/pressure
A Subscriber can use wildcards in topics:
– /wsn/sensor/+/temperature
– /wsn/sensor/R1/+
– /wsn/sensor/#
MQTT - Clean Session flag
When CONNECT-ing to the MQTT Broker the
client can say:
– CleanSession = 1
o Forget all the session settings and subscriptions on connect and disconnect
o So essentially every reconnect will be like a new session
– CleanSession = 0
Do not clean
MQTT - Retain flag
oIf message PUBLISH-ed with Retain flag set to 1 - the MQTT broker will remember it as a last
published value on the topic.
oThis is useful for systems with low update frequency, so new clients will not need to wait for last
known value.
MQTT over WebSocket
oMQTT for the browsers
oJavaScript API
oSend MQTT packets over WS frames
oSupport binary data
oFallbacks for older browsers w/o WS support
MQTT-S Overview
oDesigned to be very similar to MQTT.
– i.e. uses MQTT semantics
oClients are WSN nodes, which communicate via a gateway to a broker on IP network.
oThe gateway may just translate messages between MQTT-S and MQTT , so the broker is a
normal MQTT broker.
oDesigned to work on any WSN architecture/transport.
Core Platform Layer
The core platform layer provides a set of capabilities to connect, collect, monitor and control millions
of devices. Core platform consists of:
oProtocol Gateway: Typically the communication is channelized to the messaging platform or
middleware like MQTT or AQMP .
oIoT Messaging Middleware: Messaging middleware is a software or an appliance that allows senders
(publishers) and receivers (consumer’ s consuming the information) to distribute messages in a
loosely coupled manner without physically connected to each other.
oData Storage: The data storage component deals with storage of continuous stream of data from
devices. Typically, a NoSQL database or high performance optimized storage is used for storing data.
oData Aggregation and filter: The IoT core platform deals with raw data coming from multiple devices
and not all data needs to be consumed and treated equally by your application. As part of your IoT
application, you need to design this carefully as what data needs to be consumed and what data
might not be relevant in that context.
Analytics Platform Layer
The Analytics platform layer provides a set of key capabilities to analyze large volumes of
information, derive insights and enable applications to take required action.
oStream Processing: Real time stream processing is about processing streams of data from
devices (or any source) in real time, analyze the information, do computations and trigger
events for required actions. Stream processing platform like Apache Spark Streaming enables
you to write stream jobs to process streaming data using Spark API.
oMachine Learning: Machine learning process typically consists of 4 phases understanding the
problem definition and the expected business outcome, data cleansing and analysis, model
creation, training and evaluation. This is an iterative process where models are continuously
refined to improve its accuracy.
Cognitive Platform Layer
oCognitive computing are systems that are designed to make computers think and learn like
human brain. Such a system is trained on a set of information or data, so that it can understand
the context and help in making informed decisions.
oCognitive systems in the context of IoT would play a key role in future. Imagine 10 years down
the line where every piece of system is connected to the internet and probably an integral part
of everyday lives and information being shared continuously, how you would like to interact with
these smart devices which surround you.
oA good example can be of a connected car. As soon as you enter the car it should recognize you
automatically, adjust your car seats, start the car and start reading your priority emails. This is
not programmed but learned over a time. The car over a period of time should also provide
recommendations on how to improve the mileage based on your driving patterns.
Solution Layer(2)
oSolution Templates are common set of services which are developed for specific or generalized
use case that provides a head start to build IoT applications and are extended to build custom
IoT applications.
oAs an example, for a connected car solution, the abstract data model could be a vehicle’ s
runtime data + GPS data + asset data of the vehicle, which constitutes the device metamodel
and the application data model.
oOne can use solution templates to build application based on customer requirements.
IoT Security and Management
an enterprise IoT stack need to provide a set of capabilities which would ease the overall
process and take care of end to end cross cutting concerns like security and performance.
oDevice Management: Device management includes aspects like device registration, secure
device provisioning and access from device to cloud platform and cloud platform to device,
monitoring and administration, troubleshooting and pushing firmware and software updates to
devices including gateway.
oMonitoring and administration: Monitoring and administration is about managing the lifecycle
of the device. The lifecycle operations include register, start, pause, stop activities and the ability
to trigger events/commands to and from devices.
oDeployment: Deployment of IoT applications needs to be looked at holistically, right from IoT
devices, networks and topology, cloud services and end solutions and taking care of end to end
security.
Open Source Device SDKs
The open source IoT platform provides support for wide variety of protocols like MQTT, AXMP
and HTTP protocol. For MQTT , we can leverage the Eclipse based Paho library for connecting
any device to the core platform or open source library like cyclon.js which makes it easier to
connect various devices using Node.js. We really liked the cyclone.js library and the extensions
provided by the library to support various devices.
Apache Kafka
Apache Kafka service provides us with a highly scalable, low latency, fast and distributed publish-
subscribe messaging system. Similar to any publish-subscribe messaging system, Kafka maintains
feeds of messages in categories called topics. Producers publish data to topics and consumers
subscribe to topics to read messages. Kafka can retain messages after the specified time interval
has elapsed, unlike other messaging system which deletes messages as soon as they are
consumed.
Cassandra
Apache Cassandra can be used for storing the continuous stream of data coming from devices.
Kafka consumer can be created in order to listens to a specified topic, consumes the message
and stores the message in one of the Cassandra tables. Cassandra also can be used for historical
data analysis to gain insights on various usages, aggregations and computations, build
correlations and to develop our machine learning models iteratively for anomaly detection and
predictive analytics.
ApacheSpark Streaming
Apache Spark streaming component from Apache Spark project adds real time data stream
processing and data transformation for further processing by systems. It provides stack of
libraries including SQL and DataFrames, MLlib for machine learning, GraphX, and Spark
Streaming. Apache Spark streaming supports real time processing as well as batch updates on
top of Spark engine, which makes it perfect choice for applications which requires responding to
real time events and batch processing via Hadoop jobs for complex data analysis.
ApacheSpark MLlib
Apache Spark MLlib service is used to build machine learning models or combine multiple
machine learning models using a standardized API. Building a machine learning models require a
series of step as discussed earlier –like cleansing and transformation, creating feature vectors,
correlation, splitting up data in training and test sets, selecting algorithms for building up
required models (prediction, classification, regression, etc.) and iteratively training the model for
required accuracy.
Custom Rules and Events
Apache Zeppelin project can be used to quickly build an interactive data analytics dashboard.
Zeppelin has built-in support for Spark integration and SparkSQL.
C
It makes sense that a language first
developed to program telephone
switches would be a reasonable choice
for embedded system development. It's
available on nearly every advanced
embedded system platform that exists.
For some platforms where it's not
directly available, it's still the basis for
the dedicated language used in the
SDK.
C++
When the programming world began
moving toward object-oriented
languages in the early 1980s,
procedural languages such as Fortran,
Cobol, and C seemed destined to fade
into obscurity. C++ kept the spare
nature of C but added data abstraction,
classes, and objects. All of these
features make C++ a popular choice for
those who are writing embedded and
IoT code for Linux systems.
JAVA
Java was written to be an object-
oriented language that is incredibly
portable: There are very, very few
hardware dependencies built into the
compiler. In order to get the specific,
fine control over particular pieces of
hardware, Java depends on hardware-
support libraries that are called from
the generic code.
JavaScript
JavaScript is, as the name implies, a
scripting language that is heavily used
for building Web-fronted applications. If
you wanted to use the Apache server
on a Raspberry Pi to gather data from a
network of Arduino-based sensors, for
example, JavaScript would be a good
starting point for the effort.
Python
Python has become one of the "go-to"
languages in Web development, and its
use has spread to the embedded
control and IoT world. Python is very
flexible in many ways. For example, it is
an interpreted language that can either
be submitted to a run-time compiler or
run through one of several pre-
compilers so that compact executable
code may be distributed.
The thing that makes Python good for
programming teams, though, is its
emphasis on readability.
GO
Go was developed at Google and is
available on a wide variety of
processors and platforms. While it is
one of the many languages that owes a
debt to C, there are a number of ways
in which it's superior to C for certain
types of embedded programming.
Go supports concurrent input, output,
and processing on many different
channels. Used correctly, this allows the
coordination of an entire fleet of
sensors and actuators.
RUST
Rust was developed at Mozilla. Like the
rest of Mozilla's software, Rust is an open
source project that is evolving quickly.
Rust shares many of Go's qualities,
though it does solve one major problem
of Go. Because Go doesn't automatically
share information between the different
"channel" data structures, a program can
develop something called a "race
condition." It's basically a runaway
situation in which a system can spiral out
of control because different processes are
working at odds with one another. Rust
includes functions that eliminate race
conditions, making it a less-risky language
than Go for highly concurrent programs.
Erlang
Erlang is a multi-purpose programming
language used primarily for developing
concurrent and distributed systems. It
began as a proprietary programming
language used by Ericsson for
telephony and communications
applications. Released as open source
in 1998, Erlang has become more
popular in recent years thanks to its use
in high profile projects, such as the
Facebook chat system, and in
innovative open source projects, such
as the CouchDB document-oriented
database management system.
Erlang(2)
oIdeal platform for Large-Scale (C1M to C10M) PubSub systems
oIdeal for implementation of Gateways & Proxies
oEasy ZigBee, MQTT & MQTT-S protocol handling using bit-syntax & binary comprehensions
oVery easy to port to ARM-based Embedded Linux systems (not only RPi & BeagleBone/Board,
but also professional SBCs)
oUnique concurrency support
oPerfect for messaging platform
Julia
Julia is a high-level, high-performance
dynamic programming language for
technical computing, with syntax that is
familiar to users of other technical
computing environments. It provides a
sophisticated compiler, distributed
parallel execution, numerical accuracy,
and an extensive mathematical
function library.