0% found this document useful (0 votes)
37 views32 pages

Iot Unit Ii

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views32 pages

Iot Unit Ii

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

UNIT-II

MACHINE TO MACHINE COMMUNICATION:M2M


Machine-to-Machine (M2M) refers to networking of machines (or devices) for the purpose
of remote monitoring and control and data exchange.
 Term which is often synonymous with IoT is Machine-to-Machine (M2M).
 IoT and M2M are often used interchangeably.

Fig. Shows the end-to-end architecture of M2M systems comprises of M2M area networks,
communication networks and application domain.

1
 An M2M area network comprises of machines( or M2M nodes) which have embedded
network modules for sensing, actuation and communicating various communication
protocols can be used for M2M LAN such as ZigBee, Bluetooth, M-bus, Wireless M-Bus
etc., These protocols provide connectivity between M2M nodes within an M2M area
network.
 The communication network provides connectivity to remote M2M area networks. The
communication network provides connectivity to remote M2M area network. The
communication network can use either wired or wireless network(IP based). While the
M2M are networks use either properietorary or non-IP based communication protocols,
the communication network uses IP-based network. Since non-IP based protocols are
used within M2M area network, the M2M nodes within one network cannot
communicate with nodes in an external network.
 To enable the communication between remote M2M are network, M2M gateways are
used.

Fig. Shows a block diagram of an M2M gateway. The communication between M2M nodes and
the M2M gateway is based on the communication protocols which are naive to the M2M are
network. M2M gateway performs protocol translations to enable Ip-connectivity for M2M are
networks. M2M gateway acts as a proxy performing translations from/to native protocols to/from
Internet Protocol(IP).
With an M2M gateway, each mode in an M2M area network appears as a virtualized node for
external M2M area networks.

2
Differences Between IoT and M2M

Basis IoT M2M

Abbreviation Internet of Things Machine to Machine

Communicates directly
Communication IoT sensors automation
between machines

The connection is via using various


Connection Point to Point Connection
communication types
Communication
Communication technology techniques and
HTTP, Ftp, Telnet, etc are used
protocols traditional protocols are
used.
Objects are responsible for decision Observation of some
Intelligence
making degree of intelligence

Hardware and Software based Hardware-based


Technology
technology technology
Devices can be connected
Data Delivery Depending on the Internet protocol through mobile or other
networks
Internet Devices do not rely on an
Active Internet connection is required
Connection internet connection

Many users can connect at a time Communicate with a single


Scope
over the Internet machine at a time

B2C(Business to Customers) and Only B2B(Business to


Business Type
B2B(Business to Business) Business) is used

Open API M2M does not support


IoT supports open API Integrations
support open API

Data is shared with applications that Data is shared with the


Data Sharing tend to improve the end-user communication parties
experience themselves.

3
Interoperability in IOT

Interoperability is a characteristic of a product or system, whose interfaces are


completely understood, to work with other products or systems, present or future,
in either implementation or access, without any restrictions.

 Communicate meaning fully


 Exchange data or services
Current Challenges in IoT
 Large Scale of Co-Operation: The cooperation and coordination of millions
of distributed devices are required on Internet
 Global Heterogeneity: Heterogeneous IoT devices and their subnets
 Unknown IoT Device Configuration: The different configuration modes for
IoT devices which come from unknown owners
 Semantic Conflicts: Different processing logics applied to same IoT
networked devices or applications.

Importance of Interoperability in Context of IoT ?

To fulfill the IoT objectives

 Physical objects can interact with any other physical objects and can share
their information
 Any devices can communicate with other devices anytime from anywhere
 Machine to Machine communication (M2M) , Device to Device
Communication (D2D), Device to Machine Communication (D2M)
 Seamless device integration with IoT network.

Why Interoperability is required?

1.Heterogeneity
 Different wireless communication protocols such as ZigBee(IEEE
802.15.4), Bluetooth (IEEE 802.15.1), GPRS, 6LowPAN, and Wi-Fi (IEEE
802.11)
 Different wired communication protocols like Ethernet (IEEE 802.3) and
Higher Layer LAN Protocols (IEEE 802.1)
 Different programming language used in computing systems and website
such as JavaScript, JAVA, C, C++,Visual Basic, PHP, and Python

4
 Different hardware platforms such as Crossbow, NI, etc.
2.Different operating systems:
As an example for sensor node: TinyOS, SOS,Mantis OS, RETOS, and
mostly vendor specific OS
As an example for personal computer: Windows, Mac, Unix, and Ubuntu
3.Different databases: DB2, MySQL, Oracle, PostgreSQL, SQLite, SQL
Server, and Sybase
4.Different data representations
5. Different control models
6.Syntactic or semantic interpretations

Types of Interoperability

User Interoperability: Interoperability problem between a user and a device


Device Interoperability: Interoperability problem between two different devices

Example of Device and User Interoperability

 Using IoT, both A and B provide a real-time security service


 A is placed at delhi, India, while B is placed at Tokyo, Japan
 A,B, U use Hindi, Japanese, and English language , respectively
 User U wants real-time service of CCTV camera from the device A and B

Problems are listed below


 The user does not know the devices A and B
 Devices A and B are different in terms of syntactic and semantic notions
 Therefore, it is difficult to find CCTV device
 User U can’t understand the service provided by A and B

5
 Similarly, A and B do not mutually understand each other

User Interoperability

The following problems need to be solved

 Device identification and categorization for discovery


 Syntactic interoperability for device interaction
 Semantic interoperability for device interaction

Device identification and categorization for discovery


There are different solutions for generating unique address
 Electronic Product Codes (EPC)
 Universal Product Code (UPC)
 Uniform Resource Identifier (URI)
 IP Addresses
IPv6
There are different device classification solutions
1.United Nations Standard Products and Services Code (UNSPSC) *
an open, global, multi-sector standard for efficient, accurate, flexible
classification of products and services.

2.eCl@ss **
The standard is for classification and clear description of cross-industry
products

Syntactic Interoperability for Device Interaction

 The interoperability between devices and device user in term of message


formats
 The message format from a device to a user is understandable for the user's
computer
 On the other hand, the message format from the user to the device is
executable by the device

6
Semantic Interoperability for Device Interaction
 The interoperability between devices and device user in term of message’s
meaning
 The device can understand the meaning of user’s instruction that is sent
from the user to the device.
 Similarly, the user can understand the meaning of device’s response sent
from the device

Some popular approaches


 Ontology Device ontology
 Physical domain ontology
 Estimation ontology
Ontology-based solution is limited to the defined domain /context

Collaborative conceptualization theory

 Object is defined based on the collaborative concept, which is called cosign

 The representation of a collaborative sign is defined as follows:

cosign of a object = (A, B, C, D ), where A is a cosign internal identifier, B is a natural


language, C is the context of A, and D is a definition of the object

 As an example of CCTV, cosign = (1234, English, CCTV, “Camera Type: Bullet,


Communication: Network/IP, Horizontal Resolution: 2048 TVL”)
 This solution approach is applicable for different domains/contexts Solution approach
for device interoperability

Universal Middleware Bridge (UMB)


 Solves seamless interoperability problems caused by the heterogeneity of several kinds
of home network middleware
 UMB creates virtual maps among the physical devices of all middleware home networks,
such as HAVI, Jini, LonWorks, and UPnP
 Creates a compatibility among these middleware home networks

7
UMB consists of UMB Core (UMB-C), UMB Adaptor (UMB-A)

Fig1:The Architecture of Universal Middleware Bridge

Home Audio Video Interoperability Mean:

Home Audio Video Interoperability (HAVi) is a standard for connecting different


home entertainment and communication devices. It allows these devices to
communicate with, and be controlled from, a single device such as a TV.

In an HAVi setup, there may be two computers and a printer, a TV and set-top box
in the living room, another TV in the master bedroom, and a DVD and USB home
stereo with wireless speakers. This enables users to watch programs from the set-
top box on the bedroom TV, print from both computers to the printer, play music
from the stereo to wireless speakers in the bedroom and many other functions. An
HAVi setup connects all the devices together, enabling the control of all devices
using a single controller. The setup also eases the addition of new devices by
automating the discovery and integration process.

LonWorks : LonWorks is a communication network protocol useful for building


automation applications designed on a low bandwidth, for networking devices
through power lines, fiber optics, and other media.

8
Interoperability, open systems, and a standard protocol are concepts long sought by
facilities managers and others in the electrical industry. People often ask why an
engineer can't select the best sensing and control devices and other products from a
range of manufacturers and have them all work together seamlessly. Those in the
control industry are also concerned that while centralized control products

Hncp: Home Networking Control Protocol (HNCP), an extensible configuration


protocol, and a set of requirements for home network devices. HNCP is
described as a profile of and extension to the Distributed Node Consensus
Protocol (DNCP). HNCP enables discovery of network borders, automated
configuration of addresses, name resolution, service discovery, and the use of
any routing protocol that supports routing based on both the source and
destination address.

9
UPnP (Universal Plug and Play) is a networking protocol that enables devices to
discover each other and connect without the need for manual configuration or user
intervention. The protocol automates all the steps necessary for recognition and
communication between devices on the same network.

10
Jini Technology, can be referred to as a middleware, developed by Sun
Microsystems, in July 1998. It provides its users, with a rich set of Application
Programming Interfaces (APIs) and various protocols, along with a set of
specifications and a starter kit, which includes the implementation of Jini
Technology.

Jini Surrogate Architecture

The Structure of UMB-A is depicted in the following diagram

VDP DB-Virtual Device Proxy Data Base

11
UMB Adaptor
o UMB-A converts physical devices into virtually abstracted one, as described by
Universal Device Template(UDT)
o UDT consists of a Global Device ID, Global Function ID, Global Action ID, Global
Event ID, and Global Parameters
o UMB Adaptors translate the local middleware’s message into global metadata’s
message

UMB Core
The major role of the UMB Core is routing the universal
metadata message to the destination or any other UMB Adaptors
by the Middleware Routing Table (MRT)

The Structure of UMB-C is depicted in the following diagram

Flow when a new device is plugged in is depicted in the following diagram

12
Flow when a device is controlled and monitored is depicted in the following
diagram

13
Introduction to Arduino Programming

Features of Arduino
 Open source based electronic programmable board (micro controller)and
software(IDE)
 Accepts analog and digital signals as input and gives desired output
 No extra hardware required to load a program into the controller board.

Types of Arduino Board

 Arduino boards based on ATMEGA328 microcontroller


 Arduino boards based on ATMEGA32u4 microcontroller
 Arduino boards based on ATMEGA2560 microcontroller
 Arduino boards based on AT91SAM3X8E microcontroller.

Arduino UNO

Feature Value
Operating Voltage 5V
Clock Speed 16MHz
Digital I/O 14
Analog Input 6
PWM 6
UART 1
Interface USB via
ATMega16U2

14
Board Details

 Power Supply: USB or power barrel jack


 Voltage Regulator
 LED Power Indicator
 Tx-Rx LED Indicator
 Output power, Ground
 Analog Input Pins
 Digital I/O Pins

Arduino IDE

 Arduino IDE is an open source software that is used to program


the Arduino controller board
 Based on variations of the C and C++ programming language
 It can be downloaded from Arduino’s official website and
installed into PC

Set Up
 Power the board by connecting it to a PC via USB cable
 Launch the Arduino IDE
15
 Set the board type and the port for the board
 TOOLS -> BOARD -> select your board
 TOOLS -> PORT -> select your port

16
Arduino IDE Overview

Program coded in Arduino IDE is called a SKETCH

 To create a new sketch


 File -> New
 To open an existing sketch
 File -> open ->
 There are some basic ready-to-use sketches available in the
EXAMPLES section
 File -> Examples -> select any program.

17
 Verify: Checks the code for compilation errors
 Upload: Uploads the final code to the controller
board
 New: Creates a new blank sketch with basic structure
 Open: Opens an existing sketch
 Save: Saves the current sketch.

1. Serial Monitor: Opens the serial console


2. All the data printed to the console are displayed
here

Sketch Structure

1. A sketch can be divided into two parts:


2. Setup ()
3. Loop()
4. The function setup() is the point where the code starts,
just like the main() function in C and C++
5. I/O Variables, pin modes are initialized in the Setup()
function
6. Loop() function, as the name suggests, iterates the
7. specified task in the program

18
Supported Datatype
Arduino supports the following

data types-

Void Long
Int Char
Boolean Unsigned char
Byte Unsigned int
Word Unsigned long
Float Double
Array String-char array String-object Short.

Arduino Function Libraries

 Input/Output Functions:
 The arduino pins can be configured to
act as input or output pins using the

19
pinMode() function

Void setup ()
{
pinMode (pin , mode);
}
Pin- pin number on the Arduino boardMode-
INPUT/OUTPUT

 digitalWrite() : Writes a HIGH or LOW value to a


digital pin
 analogRead() : Reads from the analog input pin i.e.,
voltage applied across the pin
 Character functions such as isdigit(), isalpha(),
isalnum(), isxdigit(), islower(), isupper(), isspace() return
1(true) or 0(false)
 Delay() function is one of the most common time
manipulation function used to provide a delay of
specified time. It accepts integer value (time in
miliseconds)

Example- Blinking LED

Requirement:
 Arduino controller board, USB connector, Bread
board, LED, 1.4Kohm resistor, connecting wires,
Arduino IDE
 Connect the LED to the Arduino using the Bread
board and the connecting wires

20
 Connect the Arduino board to the PC using the USB
connector
 Select the board type and port
 Write the sketch in the editor, verify and upload.

Connect the positive terminal of the LED to digital pin 12 and the
negative terminal to the ground pin (GND) of Arduino Board

21
image setup
void setup() {
pinMode(12, OUTPUT); // set the pin mode
}
void loop() {
digitalWrite(12, HIGH); // Turn on the LED delay(1000);
digitalWrite(12, LOW); //Turn of the LED delay(1000);
}

Set the pin mode as output which isconnected to


the led, pin 12 in this case.
Use digitalWrite() function to set theoutput as
HIGH and LOW
Delay() function is used to specifythe delay
between HIGH-LOW transition of the output

22
Connect he board to the PC
Set the port and board type
Verify the code and upload, notice the
TX(transmitter) – RX(receiver) led in the board starts
flashing as the code is uploaded.

23
Integration of Sensors and Actuators with Arduino

Sensors
Electronic elements
Converts physical quantity/ measurements into electrical signals
Can be analog or digital

Types of Sensors
Some commonly used sensors:
Temperature, Humidity, Compass, Light, Sound, Accelerometer.

Sensor Interface with Arduino

Digital Humidity and TemperatureSensor (DHT)


PIN 1, 2, 3, 4 (from left to right)
 PIN 1- 3.3V-5V Power supply
 PIN 2- Data
 PIN 3- Null
 PIN 4- Ground

DHT Sensor Library


o Arduino supports a special library for the DHT11 and DHT22 sensors
o Provides function to read the temperature and humidity values from the data pin
 dht.readHumidity()
 dht.readTemperature()
Connection

Connect pin 1 of the DHT to the 3.3 V supply pin in the board

Data pin (pin 2) can be connected to any digital pin, here 12

24
Connect pin 4 to the ground (GND) pin of the board

Sketch: DHT_SENSOR

Install the DHT Sensor Library


Go to Sketch -> Include Library ->Manage Library

25
 Search for DHT SENSOR
Select the “DHT sensorlibrary” and install it

#include <DHT.h>;

DHT dht(8, DHT22); //Initialize DHT sensor float humidity;


//Stores humidity value

float temperature; //Stores temperaturevalue


void setup()

Serial.begin(9600);

dht.begin();

26
void loop()
{
//Read data from the sensor and store it to variableshumidity
and temperature
humidity = dht.readHumidity(); temperature=
dht.readTemperature();
//Print temperature and humidity values to serialmonitor
Serial.print("Humidity: ");
Serial.print(humidity); Serial.print("%,
Temperature: "); Serial.print(temperature);
Serial.println(" Celsius"); delay(2000); //Delay
of 2 seconds
}

27
Connect the board to the PC

Set the port and board type

Verify and upload the code

Output

The readings are printed at a delay of 2 seconds as


specified by the delay() function.

28
Integration of Actuators with Arduino
 Introduction to ACTUATOR
 Servo Motor
 Servo motor interfaced with Arduino
 Hardware interface
 Sketch

Actuators

 Mechanical/Electro-mechanical device
 Converts energy into motion
 Mainly used to provide controlled motion
to othercomponents

Basic Working Principle


Uses different combination of various mechanical structures like screws, ball
bearings, gears to produce motion.

Types of Motor Actuators

 Servo motor
 Stepper motor
 Hydraulic motor
 Solenoid
 Relay
 AC motor

Servo Motor

 High precision motor


 Provides rotary motion 0 to 180 degree
 3 wires in the Servo motor
 Black or the darkest one is Ground

29
 Red is for power supply
 Yellow for signal pin.

Servo Library on Arduino

Arduino provides different library- SERVO to operate the servo motor

Create an instance of servo to use it in the sketch

Sketch: SERVO_ACTUATOR

#include <Servo.h>

//Including the servo library for the program

int servoPin = 12;

Servo ServoDemo; // Creating a servo object

void setup() {

// The servo pin must be attached to the servo before it can be used
ServoDemo.attach(servoPin);

void loop(){
//Servo moves to 0 degrees
ServoDemo.write(0);delay(1000);

// Servo moves to 90 degrees


ServoDemo.write(90);delay(1000);

30
// Servo moves to 180 degrees

ServoDemo.write(180);
delay(1000);
}

 Create an instance of Servo


 The instance must be attached to the pin before being used in the code
 Write() function takes the degree value and rotates the motor accordingly

Connection
Connect the Ground of the servo to the ground of the Arduino board.
Connect the power supply wire to the 5V pin of the board.
Connect the signal wire to any digital output pin (we have used pin 8).

31
 Connect the board to the PC
 Set the port and board type
 Verify and upload the code

32

You might also like