SlideShare a Scribd company logo
Fundamentals of IoT
Unit-II
4/29/2024 1
Syllabus
4/29/2024 2
Machine-to-Machine (M2M)
• Machine-to-Machine (M2M) refers to
networking of machines (or devices) for the
purpose of remote monitoring and control and
data exchange.
4/29/2024 3
Machine-to-Machine (M2M)
• An M2M area network comprises of machines (or M2M nodes) which have
embedded hardware modules for sensing, actuation and communication.
• Various communication protocols can be used for M2M local area networks such as
ZigBee, Bluetooh, ModBus, M-Bus, Wirless M-Bus, Power Line Communication
(PLC), 6LoWPAN, IEEE 802.15.4, etc.
• The communication network provides connectivity to remote M2M area networks.
• The communication network can use either wired or wireless networks (IPbased).
• While the M2M area networks use either proprietary or non-IP based communication
protocols, the communication network uses IP-based network.
4/29/2024 4
M2M Network
4/29/2024 5
M2M gateway
• Since non-IP based protocols are used within M2M area
networks, the M2M nodes within one network cannot
communicate with nodes in an external network.
• To enable the communication between remote M2M area
networks M2M gateways are used.
4/29/2024 6
M2M gateway
4/29/2024 7
Difference between IoT and M2M
Communication Protocols
• M2M and IoT can differ in how the communication between the machines or devices
happens.
• M2M uses either proprietary or non-IP based communication protocols for
communication within the M2M area networks.
Machines in M2M vs Things in IoT
• The "Things" in IoT refers to physical objects that have unique identifiers and can
sense and communicate with their external environment (and user applications) or
their internal physical states.
• M2M systems, in contrast to IoT, typically have homogeneous machine types within
an M2M area network.
4/29/2024 8
Difference between IoT and M2M
Hardware vs Software Emphasis
• While the emphasis of M2M is more hardware with embedded
modules, the emphasis of IoT is more on software.
Data Collection & Analysis
• M2M data is collected in point solutions and often in on-premises
storage infrastructure.
• In contrast to M2M, the data in IoT is collected in the cloud (can be
public, private or hybrid cloud).
4/29/2024 9
Difference between IoT and M2M
Applications
• M2M data is collected in point solutions and can be accessed by on-
premises applications such as diagnosis applications, service
management applications, and on premises enterprise applications.
• IoT data is collected in the cloud and can be accessed by cloud
applications such as analytics applications, enterprise applications,
remote diagnosis and management applications, etc.
4/29/2024 10
Communication in IoT vs M2M
4/29/2024 11
What is Interoperability?
– 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 ,with out any
restrictions.
– Communicate meaningfully
– Exchange data or services
4/29/2024 12
Why Interoperability is Important in
Context of IoT?
– To fulfill the IoT objectives Physical objects can interact
with any other physical objects and can share their information
– Any device 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
4/29/2024 13
Why Interoperability is required?
– 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 languages used in computing systems and
websites such as JavaScript, JAVA, C, C++, Visual Basic, PHP, and
Python
– Different hardware platforms such as Crossbow, NI, etc.
4/29/2024 14
Why Interoperability is required?
(Contd.)
– 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
• Different databases: DB2, MySQL, Oracle, PostgreSQL, SQLite, SQL
Server, and Sybase
• Different data representations
• Different control models
• Syntactic or semantic interpretations
4/29/2024 15
Different Types of Interoperability?
–User Interoperability : Interoperability
problem between a user and a device
–Device Interoperability : Interoperability
problem between two different devices
4/29/2024 16
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
4/29/2024 17
4/29/2024 18
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
4/29/2024 19
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
4/29/2024 20
Device identification and
categorization for discovery
• There are different device classification solutions
– United Nations Standard Products and Services
Code (UNSPSC) * an open, global, multi-sector standard
for efficient, accurate, flexible classification of products
and services.
– eCl@ss ** The standard is for classification and clear
description of cross-industry products
4/29/2024 21
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.
4/29/2024 22
• Some popular approaches are
• Service-oriented Computing (SOC)-based architecture
• Web services
• RESTfulweb services
• Open standard protocols such as IEEE 802.15.4, IEEE 802.15.1, and
WirelessHART*
• Closed protocols such as Z-Wave*
• *But these standards are incompatible with each other
4/29/2024 23
• Middleware technology Software middleware
bridge
• Dynamically map physical devices with different
domains
• Based on the map, the devices can be discovered
and controlled, remotely
• Cross-context syntactic interoperability
Collaborative concept exchange
• Using XML syntax
4/29/2024 24
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
4/29/2024 25
Semantic Interoperability for Device
Interaction
• Some popular approaches
– Ontology Device ontology
– Physical domain ontology
– Estimation ontology
• Ontology-based solution is limited to the defined
domain /context
4/29/2024 26
Semantic Interoperability for Device
Interaction
• 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
4/29/2024 27
Device Interoperability
• 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
4/29/2024 28
• The Architecture of Universal Middleware
Bridge (UMB)
– UMB consists
• UMB Core (UMB-C)
• UMB Adaptor (UMB-A)
4/29/2024 29
Device Interoperability (Contd.)
• 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) .
4/29/2024 30
4/29/2024 31
Device Interoperability (Contd.)
• UMB Adaptor UMB-A converts physical devices into
virtually abstracted one, as described by Universal Device
Template(UDT)
• UDT consists of a Global Device ID, Global Function ID,
Global Action ID, Global Event ID, and Global Parameters
• UMB Adaptors translate the local middleware’s message
into global metadata’s message
4/29/2024 32
4/29/2024 33
4/29/2024 34
4/29/2024 35
Introduction to Arduino
Programming
4/29/2024 36
Overview
• Background
– Microcontroller defined/Why Arduino's?
– Types of Arduino microcontrollers
• What To Get (Hardware and Software)
• Arduino C
• Electronic Circuits
• Projects
– Blinking light(s)
– Reading inputs (variable resistors)
4/29/2024 37
Microcontrollers – One Definition
• Programmers work in the virtual world.
• Machinery works in the physical world.
• How does one connect the virtual world to the
physical world?
• Enter the microcontroller.
• A microcontroller is basically a small-scale
computer with generalized (and
programmable) inputs and outputs.
• The inputs and outputs can be manipulated by
and can manipulate the physical world.
4/29/2024 38
Arduino – Official Definition
• Taken from the official web site (arduino.cc):
– Arduino is an open-source electronics prototyping
platform based on flexible, easy-to-use hardware
and software. It's intended for artists, designers,
hobbyists, and anyone interested in creating
interactive objects or environments.
4/29/2024 39
Why Arduino?
• For whatever reason, Arduino microcontrollers
have become the de facto standard.
– Make Magazine features many projects using
Arduino microcontrollers.
• Strives for the balance between ease of use
and usefulness.
– Programming languages seen as major obstacle.
– Arduino C is a greatly simplified version of C++.
• Inexpensive ($35 retail).
4/29/2024 40
Arduino Types
• Many different versions
– Number of input/output channels
– Form factor
– Processor
• Leonardo
• Due
• Micro
• LilyPad
• Esplora
• Uno
4/29/2024 41
Leonardo
• Compared to the Uno, a slight upgrade.
• Built in USB compatibility
• Bugs?
 Presents to PC as
a mouse or
keyboard
4/29/2024 42
Due
• Much faster processor, many more pins
• Operates on 3.3 volts
• Similar to the Mega
4/29/2024 43
Micro
• When size matters: Micro, Nano, Mini
• Includes all functionality of the Leonardo
• Easily usable on a breadboard
4/29/2024 44
LilyPad
• LilyPad is popular for clothing-based projects.
4/29/2024 45
Esplora
• Game controller
• Includes joystick, four buttons, linear
potentiometer (slider), microphone, light
sensor, temperature sensor, three-axis
accelerometer.
• Not the standard set of IO pins.
4/29/2024 46
Arduino Uno Close Up
• The pins are in three groups:
– Invented in 2010
– 14 digital pins
– 6 analog pins
– power
4/29/2024 48
Where to Start
• Get an Arduino (starter kit)
• Download the compiler
• Connect the controller
• Configure the compiler
• Connect the circuit
• Write the program
• Get frustrated/Debug/Get it to work
• Get excited and immediately start next project
(sleep is for wimps)
4/29/2024 49
Arduino Starter Kits
• Start with a combo pack (starter kit)
– Includes a microcontroller, wire, LED's, sensors, etc.
• www.adafruit.com
adafruit.com/products/68 ($65)
• www.sparkfun.com
https://www.sparkfun.com/products/11576 ($99.95)
• Radio Shack
Make Ultimate Microcontroller Pack w/ Arduino Kit ($119.99)
• www.makershed.com
http://www.makershed.com/Ultimate_Arduino_Microcontroller_Pack_p/msump
1.htm ($150)
4/29/2024 50
What to Get – My Recommendation
• Required:
– Arduino (such as Uno)
– USB A-B (printer) cable
– Breadboard
– Hookup wire
– LED's
– Resistors
– Sensors
– Switches
• Good Idea:
– Capacitors
– Transistors
– DC motor/servo
– Relay
 Advanced:
 Soldering iron & solder
 Heat shrink tubing
 9V battery adapter
 Bench power supply
4/29/2024 51
Arduino Compiler
• Download current compiler from:
arduino.cc/en/Main/software
• Arrogantly refers to itself as an IDE (Ha!).
• Run the software installer.
• Written in Java, it is fairly slow.
Visit playground.arduino.cc/Main/
DevelopmentTools for alternatives to the
base arduino IDE
4/29/2024 52
Configuring the Arduino Compiler
• Defaults to COM1, will probably need to
change the COM port setting.
• Appears in Device Manager (Win7) under
Ports as a Comm port.
4/29/2024 53
Arduino Program Development
• Based on C++ without 80% of the instructions.
• A handful of new commands.
• Programs are called 'sketches'.
• Sketches need two functions:
– void setup( )
– void loop( )
• setup( ) runs first and once.
• loop( ) runs over and over, until power is lost or a
new sketch is loaded.
4/29/2024 54
Arduino C
• Arduino sketches are centered around the
pins on an Arduino board.
• Arduino sketches always loop.
– void loop( ) {} is equivalent to while(1) { }
• The pins can be thought of as global variables.
4/29/2024 55
Arduino C Specific Functions
• pinMode(pin, mode)
Designates the specified pin for input or output
• digitalWrite(pin, value)
Sends a voltage level to the designated pin
• digitalRead(pin)
Reads the current voltage level from the designated pin
• analog versions of above
– analogRead's range is 0 to 1023
• serial commands
– print, println, write
4/29/2024 56
Compiler Features
• Numerous sample
sketches are included in
the compiler
• Located under File,
Examples
• Once a sketch is
written, it is uploaded
by clicking on File,
Upload, or by pressing
<Ctrl> U
4/29/2024 57
Arduino C is Derived from C++
• avr-libc
#include <avr/io.h>
#include <util/delay.h>
int main(void) {
while (1) {
PORTB = 0x20;
_delay_ms(1000);
PORTB = 0x00;
_delay_ms(1000);
}
return 1;
}
• Arduino C
void setup( ) {
pinMode(13, OUTPUT);
}
void loop( ) {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
 These programs blink an LED on pin 13
4/29/2024 58
Basic Electric Circuit
• Every circuit (electric or electronic) must have
at least a power source and a load.
• The simplest circuit is a light.
• Plug in the light, and it lights up.
• Unplug it, the light goes out.
• Electricity flows from the power source,
through the load (the light) and then back to
the power source.
4/29/2024 59
Basic LED Circuit
• Connect the positive (+) lead of a power
source to the long leg of an LED.
• Connect other leg of the LED to a resistor.
– High resistance means a darker light.
– Low resistance means brighter light.
– No resistance means a burned out LED.
• Connect other leg of the resistor to the
negative lead of the power source.
4/29/2024 60
Let the Good Times Roll!
• At this point we have:
– Purchased a starter kit, including the Arduino
– Connected and configured the Arduino
– Connected a simple LED circuit
• Let's write some code!
4/29/2024 61
Blink Sketch
void setup( ) {
pinMode(13, OUTPUT);
}
void loop( ) {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
Connected to
one end of the
circuit
Connected to
other end of the
circuit
4/29/2024 62
4 LED Blink Sketch
void setup( ) {
pinMode(1, OUTPUT);
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(7, OUTPUT);
}
void loop( ) {
digitalWrite(1, HIGH);
delay (200);
digitalWrite(1, LOW);
digitalWrite(3, HIGH);
delay (200);
digitalWrite(3, LOW);
digitalWrite(5, HIGH);
delay (200);
digitalWrite(5, LOW);
digitalWrite(7, HIGH);
delay (200);
digitalWrite(7, LOW);
}
4/29/2024 63
So What?
• Great. Blinking lights. Not impressed.
• Only covered output thus far.
• Can use analog inputs to detect a physical
phenomena.
4/29/2024 64
Inputs
• Digital inputs will come to the Arduino as either
on or off (HIGH or LOW, respectively).
– HIGH is 5VDC.
– LOW is 0VDC.
• Analog inputs will come to the Arduino as a range
of numbers, based upon the electrical
characteristics of the circuit.
– 0 to 1023
– .0049 V per digit (4.9 mV)
– Read time is 100 microseconds (10,000 a second)
4/29/2024 65
Analog Input
• A potentiometer (variable
resistor) is connected to
analog pin 0 to an Arduino.
• Values presented to pin 0
will vary depending upon
the resistance of the
potentiometer.
4/29/2024 66
Analog Input-Application
• The variable resistor can be replaced with a
sensor.
• For example, a photo resistor.
– Depending upon the light level at the photo resistor:
• Turn on a light
• Increase or decrease the brightness of an LED (or an LED
array)
• Most sensors are simply variable resistors, but
vary their resistance based on some physical
characteristic.
4/29/2024 67
“Competitors”to the Arduino
• PIC controller
– Microcontroller programmed with C or assembler
• Alternatives to the Arduino line
– Pinguino – PIC controller
– MSP430 – Texas Instruments; $4.30
– Others: customs, Teensy, etc.
• Netduino
• Computers
– Raspberry Pi
– BeagleBones – TI; has computer and controller
4/29/2024 68
Introduction to Arduino Programming
4/29/2024 69
Content
 Operators in Arduino
 Control Statement
 Loops
 Arrays
 String
 Math Library
 Random
Number
 Interrupts
 Example
Program
4/29/2024 70
Operators
 Arithmetic Operators: =, +, -, *, /, %
 Comparison Operator: ==, !=, <, >, <=, >=
 Boolean Operator: &&, ||, !
 Bitwise Operator: &, |, ^, ~, <<, >>,
 Compound Operator: ++, --, +=, -=, *=, /=, %=,
|=, &=
4/29/2024 71
Control Statement
 If statement
 if(condition){
Statements if
the condition is
true ;
}
 If…Else statement
 if(condition ){
Statements if
the condition is
true;
}
else{
Statements if
the condition is
false;
}
If…….Elseif…..Else
 if (condition1){
• Statements if the
condition1 is true;
• }
• else if
(condition2){
Statements if the
condition1 is false
• and condition2 is true;
• }
• else{
•Statements if both
the conditions are
false;
• }
4/29/2024 72
Control Statement (contd..)
 Switch Case
 Switch(choice)
{
case opt1: statement_1;
break;
Case opt2: statement_2;
break;
case opt3: statement_3;break;
.
.
.
case default: statement_default; break;
}
 Conditional Operator.
 Val=(condition)?(Statement1): (Statement2)
4/29/2024 73
Loops
 For loop
 for(initialization; condition; increment)
{ Statement till the condition is true;
}
 While loop
 while(condition){
Statement till the condition is true;
}
 Do… While loop
 do{
Statement till the condition is true;
}while(condition);
4/29/2024 74
Loops (contd..)
 Nested loop: Calling a loop inside another loop
 Infinite loop: Condition of the loop is always true, the loop will
never terminate
4/29/2024 75
Arrays
 Collection of elements having homogenous datatype
that are stored in adjacent memory location.
 The conventional starting index is 0.
 Declaration of array:
<Datatype>
array_name[size];
Ex: int arre[5];
4/29/2024 76
Arrays (contd..)
 Alternative Declaration:
int arre[]={0,1,2,3,4};
int arre[5]={0,1,2};
 Multi-dimentional array Declaration:
<Datatype> array_name[n1] [n2][n3]….;
Ex: int arre[row][col][height];
4/29/2024 77
String
 Array of characters with NULL as termination is termed as a
String.
 Declaration using Array:
 char str[]=“ABCD”;
 char str[4];
 str[0]=‘A’;
 str[1]=‘B’;
 str[2]=‘C’;
 str[3]=D;
 Declaration using String Object:
 String str=“ABC”;
4/29/2024 78
String (contd..)
 Functions of String Object:
 str.ToUpperCase(): change all the characters of str to upper
case
 str.replace(str1,str2): is str1 is the sub string of str then it
will be replaced by str2
 str.length(): returns the length of the string without considering
null
4/29/2024 79
Math Library
 To apply the math functions and mathematical constants, “MATH.h”
header files is needed to be included.
 Functions:
 cos(double radian);
 sin(double radian);
 tan(double radian);
 fabs(double val);
 fmod(double val1, double val2);
4/29/2024 80
Math Library (contd..)
 Functions:
 exp(double val);
 log(double val);
 log10(double val);
 square(double val);
 pow(double base, double
power);
4/29/2024 81
Random Number
 randomSeed(int v): reset the pseudo-random number
generator with seed value v
 random(maxi)=gives a random number within the range
[0,maxi]
 r
n
a
i
,
n
m
d
a
o
x
m
i(mini )=gives a random number within the
range [mini,maxi]
4/29/2024 82
Interrupts
 An external signal for which system blocks the current
running process to process that signal
 Types:
 Hardware interrupt
 Software interrupt
 digitalPinToInterrupt(pin): Change actual digital pin to the
specific interrupt number.
 attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);
 ISR: a interrupt service routine
have to be defined
4/29/2024 83
Example: TrafficControlSystem
Requirement:
 ArduinoBoard
 3 different color
LEDs
 330 Ohm resistors
 Jumper wires
4/29/2024 84
Example: Traffic Control System (contd..)
Connection:
 Connect the positive
terminals of the LEDs
to the respective
digital output pins in
the board, assigned in
the code.
 Connect the negative
terminals of the LEDs
to the ground
4/29/2024 85
Example: Traffic Control System
(contd..)
 Sketch
//LED pins
int r =2;
int g = 3;
int y =4;
void setup()
{
Serial.begin(9600);
pinMode(r, OUTPUT);
digitalWrite(r,LOW);
pinMode(g, OUTPUT);
digitalWrite(g,LOW);
pinMode(y , OUTPUT);
digitalWrite(y, LOW);
}
4/29/2024 86
Example: Traffic Control System
(contd..)
void traffic()
{
digitalWrite(g, HIGH);
Serial.println(“Green LED: ON, GO”);
delay(5000);
digitalWrite(g, LOW);
digitalWrite(y, HIGH);
Serial.println(“Green LED: OFF ; Yellow LED: ON, WAIT”);
delay(5000);
4/29/2024 87
digitalWrite(y,LOW);
digitalWrite(r, HIGH);
Serial.println(“Yellow LED: OFF ; Red LED: ON, STOP");
//
delay(5000);
digitalWrite(r, LOW);
Serial.println(“All OFF");
}
void loop()
{
traffic ();
delay (10000);
}
4/29/2024 88
Example: Traffic Control
System (contd..)
Output:
 Initially, all the LEDs are turned off
 The LEDs are turned on one at a
time with a delay of 5 seconds
 The message is displayed
accordingly
 Figure showing all the LEDs
turned on
4/29/2024 89
Output
4/29/2024 90
/
Integration of Sensors and Actuators
4/29/2024 91
Sensors
 Electronic elements
 Converts physical quantity/ measurements into
electrical signals
 Can be analog or digital
4/29/2024 92
Types of Sensors
Some commonly used
sensors:
 Temperature
 Humidity
 Compass
 Light
 Sound
 Accelerometer
4/29/2024 93
SensorInterface with Arduino
 Digital Humidity and
Temperature Sensor (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
4/29/2024 94
DHTSensorLibrary
 A
u
p
r
d
p
u
o
i
r
n
t
o
sa
sspecial library for the DHT11 and
DHT22 sensors
 Provides function to read the temperature and
humidity values from the data pin
dht.readHumidity()
dht.readTemperatue()
4/29/2024 95
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
 Connect pin 4 to the
ground (GND) pin of
the board
4/29/2024 96
Sketch: DHT_SENSOR
Install the DHT Sensor Library
 Go to Sketch -> Include
Library -> Manage Library
4/29/2024 97
Sketch: DHT_SENSOR (contd..)
 Search for DHT
SENSOR
 Select the “DHT
sensor library” and
install it
4/29/2024 98
Sketch: DHT_SENSOR (contd..)
//Initialize DHT
sensor
//Stores humidity
value
//Stores temperature
#include <DHT.h>;
DHT dht(8, DHT22);
float humidity;
float temperature; value
void setup()
{
Serial.begin(9600);
dht.begin();
}
void loop()
{
//Read data from the sensor and store it to
variables humidity and temperature
humidity = dht.readHumidity();
temperature=
dht.readTemperature();
//Print temperature and humidity values to
serial monitor
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print("%, Temperature:
"); Serial.print(temperature);
Serial.println(" Celsius");
delay(2000); //Delay of 2
seconds
}
4/29/2024 99
Sketch: DHT_SENSOR (contd..)
4/29/2024 100
Sketch: DHT_SENSOR (contd..)
 Connect the board to the
PC
 Set the port and board
type
 Verify and upload the
code
4/29/2024 101
Output
The readings are printed at a
delay of 2 seconds as specified
by the delay() function
4/29/2024 102
Actuators
 Mechanical/Electro-mechanical device
 Converts energy into motion
 Mainly used to provide controlled motion to
other components
4/29/2024 103
Basic Working Principle
Uses different combination of various mechanical
structures like screws, ball bearings, gears to
produce motion.
4/29/2024 104
Types of Motor Actuators
 Servo motor
 Stepper motor
 Hydraulic
motor
 Solenoid
 Relay
 AC motor
4/29/2024 105
Servo Motor
 High precision motor
 Provides rotary motion
0 to 180 degree
 3 wires in the Servo
motor
 Black is Ground
 Red is for power
supply
 Yellow for signal pin
4/29/2024 106
Servo Library on Arduino
A
rudinohas library to operate the servo motor-SERVO
 Create an instance of servo to use it in
the sketch
Servo myservo;
4/29/2024 107
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(servo
Pin);
• }
void loop(){
//Servo moves to 0 degrees
ServoDemo.write(0);
delay(1000);
// Servo moves to 90 degrees
ServoDemo.write(90);
delay(1000);
// Servo moves to 180 degrees
ServoDemo.write(180);
delay(1000);
}
4/29/2024 108
Sketch: SERVO_ACTUATOR(contd..)
 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
4/29/2024 109
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).
4/29/2024 110
Board Setup
 Connect the board to the
PC
 Set the port and board
type
 Verify and upload the
code
4/29/2024 111
Output
The motor turns 0, 90 and
180 degrees with a delay of 1
second each.
4/29/2024 112
Do more with the Servo library
• Some other functions available with the Servo
library:
 Knob()
 Sweep()
 write()
 writeMicroseconds()
 read()
 attached()
 detach()
4/29/2024 113
Thank you!
4/29/2024 114

More Related Content

Similar to FIOT_Unit_2 (1)softwaredefinedradio.pptx

lec1.pptx
lec1.pptxlec1.pptx
lec1.pptx
Musab58
 
slides15-1.pdf
slides15-1.pdfslides15-1.pdf
slides15-1.pdf
ElizabethKalekye
 
Chapter-2.pdf
Chapter-2.pdfChapter-2.pdf
Chapter-2.pdf
venui2
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
ijceronline
 
INTERNET OF THINGS.pptx
INTERNET OF THINGS.pptxINTERNET OF THINGS.pptx
INTERNET OF THINGS.pptx
Manikandan Kandasamy
 
Unit - 1.pptx
Unit - 1.pptxUnit - 1.pptx
Unit - 1.pptx
arjun431527
 
Cloud computing
Cloud computingCloud computing
Cloud computing
Mahdi Hosseini Moghaddam
 
Midori ppt
Midori pptMidori ppt
Midori ppt
Keerthi Prakash
 
Grid and Cloud Computing Lecture 1a.pptx
Grid and Cloud Computing Lecture 1a.pptxGrid and Cloud Computing Lecture 1a.pptx
Grid and Cloud Computing Lecture 1a.pptx
DrAdeelAkram2
 
IT6601 MOBILE COMPUTING
IT6601 MOBILE COMPUTINGIT6601 MOBILE COMPUTING
IT6601 MOBILE COMPUTING
Kathirvel Ayyaswamy
 
M2M.pptx
M2M.pptxM2M.pptx
M2M.pptx
AmolMahore
 
IoT & M2M.pdf
IoT & M2M.pdfIoT & M2M.pdf
IoT & M2M.pdf
GVNSK Sravya
 
Cloud Computing_Module3-1.pptxnsjsjajajajaja
Cloud Computing_Module3-1.pptxnsjsjajajajajaCloud Computing_Module3-1.pptxnsjsjajajajaja
Cloud Computing_Module3-1.pptxnsjsjajajajaja
Shivang100
 
Internet of Things.pptx
Internet of Things.pptxInternet of Things.pptx
Internet of Things.pptx
Eshwar Prasad
 
2.pdf
2.pdf2.pdf
1.ppt
1.ppt1.ppt
robotics
roboticsrobotics
robotics
glpsurdukodibag
 
A Survey Embedded Systems Supporting By Different Operating Systems.pdf
A Survey   Embedded Systems Supporting By Different Operating Systems.pdfA Survey   Embedded Systems Supporting By Different Operating Systems.pdf
A Survey Embedded Systems Supporting By Different Operating Systems.pdf
Fiona Phillips
 
Mobile Middleware and Applications of Telemetry
Mobile Middleware and Applications of TelemetryMobile Middleware and Applications of Telemetry
Mobile Middleware and Applications of Telemetry
Piyush yadav
 
Unit 4
Unit 4Unit 4

Similar to FIOT_Unit_2 (1)softwaredefinedradio.pptx (20)

lec1.pptx
lec1.pptxlec1.pptx
lec1.pptx
 
slides15-1.pdf
slides15-1.pdfslides15-1.pdf
slides15-1.pdf
 
Chapter-2.pdf
Chapter-2.pdfChapter-2.pdf
Chapter-2.pdf
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
 
INTERNET OF THINGS.pptx
INTERNET OF THINGS.pptxINTERNET OF THINGS.pptx
INTERNET OF THINGS.pptx
 
Unit - 1.pptx
Unit - 1.pptxUnit - 1.pptx
Unit - 1.pptx
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
Midori ppt
Midori pptMidori ppt
Midori ppt
 
Grid and Cloud Computing Lecture 1a.pptx
Grid and Cloud Computing Lecture 1a.pptxGrid and Cloud Computing Lecture 1a.pptx
Grid and Cloud Computing Lecture 1a.pptx
 
IT6601 MOBILE COMPUTING
IT6601 MOBILE COMPUTINGIT6601 MOBILE COMPUTING
IT6601 MOBILE COMPUTING
 
M2M.pptx
M2M.pptxM2M.pptx
M2M.pptx
 
IoT & M2M.pdf
IoT & M2M.pdfIoT & M2M.pdf
IoT & M2M.pdf
 
Cloud Computing_Module3-1.pptxnsjsjajajajaja
Cloud Computing_Module3-1.pptxnsjsjajajajajaCloud Computing_Module3-1.pptxnsjsjajajajaja
Cloud Computing_Module3-1.pptxnsjsjajajajaja
 
Internet of Things.pptx
Internet of Things.pptxInternet of Things.pptx
Internet of Things.pptx
 
2.pdf
2.pdf2.pdf
2.pdf
 
1.ppt
1.ppt1.ppt
1.ppt
 
robotics
roboticsrobotics
robotics
 
A Survey Embedded Systems Supporting By Different Operating Systems.pdf
A Survey   Embedded Systems Supporting By Different Operating Systems.pdfA Survey   Embedded Systems Supporting By Different Operating Systems.pdf
A Survey Embedded Systems Supporting By Different Operating Systems.pdf
 
Mobile Middleware and Applications of Telemetry
Mobile Middleware and Applications of TelemetryMobile Middleware and Applications of Telemetry
Mobile Middleware and Applications of Telemetry
 
Unit 4
Unit 4Unit 4
Unit 4
 

Recently uploaded

artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
GauravCar
 
integral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdfintegral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdf
gaafergoudaay7aga
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
bjmsejournal
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
171ticu
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
SakkaravarthiShanmug
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
TaghreedAltamimi
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
Nada Hikmah
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 

Recently uploaded (20)

artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
 
integral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdfintegral complex analysis chapter 06 .pdf
integral complex analysis chapter 06 .pdf
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样官方认证美国密歇根州立大学毕业证学位证书原版一模一样
官方认证美国密歇根州立大学毕业证学位证书原版一模一样
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
cnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classicationcnn.pptx Convolutional neural network used for image classication
cnn.pptx Convolutional neural network used for image classication
 
Software Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.pptSoftware Quality Assurance-se412-v11.ppt
Software Quality Assurance-se412-v11.ppt
 
Curve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods RegressionCurve Fitting in Numerical Methods Regression
Curve Fitting in Numerical Methods Regression
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 

FIOT_Unit_2 (1)softwaredefinedradio.pptx

  • 3. Machine-to-Machine (M2M) • Machine-to-Machine (M2M) refers to networking of machines (or devices) for the purpose of remote monitoring and control and data exchange. 4/29/2024 3
  • 4. Machine-to-Machine (M2M) • An M2M area network comprises of machines (or M2M nodes) which have embedded hardware modules for sensing, actuation and communication. • Various communication protocols can be used for M2M local area networks such as ZigBee, Bluetooh, ModBus, M-Bus, Wirless M-Bus, Power Line Communication (PLC), 6LoWPAN, IEEE 802.15.4, etc. • The communication network provides connectivity to remote M2M area networks. • The communication network can use either wired or wireless networks (IPbased). • While the M2M area networks use either proprietary or non-IP based communication protocols, the communication network uses IP-based network. 4/29/2024 4
  • 6. M2M gateway • Since non-IP based protocols are used within M2M area networks, the M2M nodes within one network cannot communicate with nodes in an external network. • To enable the communication between remote M2M area networks M2M gateways are used. 4/29/2024 6
  • 8. Difference between IoT and M2M Communication Protocols • M2M and IoT can differ in how the communication between the machines or devices happens. • M2M uses either proprietary or non-IP based communication protocols for communication within the M2M area networks. Machines in M2M vs Things in IoT • The "Things" in IoT refers to physical objects that have unique identifiers and can sense and communicate with their external environment (and user applications) or their internal physical states. • M2M systems, in contrast to IoT, typically have homogeneous machine types within an M2M area network. 4/29/2024 8
  • 9. Difference between IoT and M2M Hardware vs Software Emphasis • While the emphasis of M2M is more hardware with embedded modules, the emphasis of IoT is more on software. Data Collection & Analysis • M2M data is collected in point solutions and often in on-premises storage infrastructure. • In contrast to M2M, the data in IoT is collected in the cloud (can be public, private or hybrid cloud). 4/29/2024 9
  • 10. Difference between IoT and M2M Applications • M2M data is collected in point solutions and can be accessed by on- premises applications such as diagnosis applications, service management applications, and on premises enterprise applications. • IoT data is collected in the cloud and can be accessed by cloud applications such as analytics applications, enterprise applications, remote diagnosis and management applications, etc. 4/29/2024 10
  • 11. Communication in IoT vs M2M 4/29/2024 11
  • 12. What is Interoperability? – 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 ,with out any restrictions. – Communicate meaningfully – Exchange data or services 4/29/2024 12
  • 13. Why Interoperability is Important in Context of IoT? – To fulfill the IoT objectives Physical objects can interact with any other physical objects and can share their information – Any device 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 4/29/2024 13
  • 14. Why Interoperability is required? – 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 languages used in computing systems and websites such as JavaScript, JAVA, C, C++, Visual Basic, PHP, and Python – Different hardware platforms such as Crossbow, NI, etc. 4/29/2024 14
  • 15. Why Interoperability is required? (Contd.) – 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 • Different databases: DB2, MySQL, Oracle, PostgreSQL, SQLite, SQL Server, and Sybase • Different data representations • Different control models • Syntactic or semantic interpretations 4/29/2024 15
  • 16. Different Types of Interoperability? –User Interoperability : Interoperability problem between a user and a device –Device Interoperability : Interoperability problem between two different devices 4/29/2024 16
  • 17. 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 4/29/2024 17
  • 19. 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 4/29/2024 19
  • 20. 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 4/29/2024 20
  • 21. Device identification and categorization for discovery • There are different device classification solutions – United Nations Standard Products and Services Code (UNSPSC) * an open, global, multi-sector standard for efficient, accurate, flexible classification of products and services. – eCl@ss ** The standard is for classification and clear description of cross-industry products 4/29/2024 21
  • 22. 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. 4/29/2024 22
  • 23. • Some popular approaches are • Service-oriented Computing (SOC)-based architecture • Web services • RESTfulweb services • Open standard protocols such as IEEE 802.15.4, IEEE 802.15.1, and WirelessHART* • Closed protocols such as Z-Wave* • *But these standards are incompatible with each other 4/29/2024 23
  • 24. • Middleware technology Software middleware bridge • Dynamically map physical devices with different domains • Based on the map, the devices can be discovered and controlled, remotely • Cross-context syntactic interoperability Collaborative concept exchange • Using XML syntax 4/29/2024 24
  • 25. 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 4/29/2024 25
  • 26. Semantic Interoperability for Device Interaction • Some popular approaches – Ontology Device ontology – Physical domain ontology – Estimation ontology • Ontology-based solution is limited to the defined domain /context 4/29/2024 26
  • 27. Semantic Interoperability for Device Interaction • 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 4/29/2024 27
  • 28. Device Interoperability • 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 4/29/2024 28
  • 29. • The Architecture of Universal Middleware Bridge (UMB) – UMB consists • UMB Core (UMB-C) • UMB Adaptor (UMB-A) 4/29/2024 29
  • 30. Device Interoperability (Contd.) • 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) . 4/29/2024 30
  • 32. Device Interoperability (Contd.) • UMB Adaptor UMB-A converts physical devices into virtually abstracted one, as described by Universal Device Template(UDT) • UDT consists of a Global Device ID, Global Function ID, Global Action ID, Global Event ID, and Global Parameters • UMB Adaptors translate the local middleware’s message into global metadata’s message 4/29/2024 32
  • 37. Overview • Background – Microcontroller defined/Why Arduino's? – Types of Arduino microcontrollers • What To Get (Hardware and Software) • Arduino C • Electronic Circuits • Projects – Blinking light(s) – Reading inputs (variable resistors) 4/29/2024 37
  • 38. Microcontrollers – One Definition • Programmers work in the virtual world. • Machinery works in the physical world. • How does one connect the virtual world to the physical world? • Enter the microcontroller. • A microcontroller is basically a small-scale computer with generalized (and programmable) inputs and outputs. • The inputs and outputs can be manipulated by and can manipulate the physical world. 4/29/2024 38
  • 39. Arduino – Official Definition • Taken from the official web site (arduino.cc): – Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments. 4/29/2024 39
  • 40. Why Arduino? • For whatever reason, Arduino microcontrollers have become the de facto standard. – Make Magazine features many projects using Arduino microcontrollers. • Strives for the balance between ease of use and usefulness. – Programming languages seen as major obstacle. – Arduino C is a greatly simplified version of C++. • Inexpensive ($35 retail). 4/29/2024 40
  • 41. Arduino Types • Many different versions – Number of input/output channels – Form factor – Processor • Leonardo • Due • Micro • LilyPad • Esplora • Uno 4/29/2024 41
  • 42. Leonardo • Compared to the Uno, a slight upgrade. • Built in USB compatibility • Bugs?  Presents to PC as a mouse or keyboard 4/29/2024 42
  • 43. Due • Much faster processor, many more pins • Operates on 3.3 volts • Similar to the Mega 4/29/2024 43
  • 44. Micro • When size matters: Micro, Nano, Mini • Includes all functionality of the Leonardo • Easily usable on a breadboard 4/29/2024 44
  • 45. LilyPad • LilyPad is popular for clothing-based projects. 4/29/2024 45
  • 46. Esplora • Game controller • Includes joystick, four buttons, linear potentiometer (slider), microphone, light sensor, temperature sensor, three-axis accelerometer. • Not the standard set of IO pins. 4/29/2024 46
  • 47. Arduino Uno Close Up • The pins are in three groups: – Invented in 2010 – 14 digital pins – 6 analog pins – power 4/29/2024 48
  • 48. Where to Start • Get an Arduino (starter kit) • Download the compiler • Connect the controller • Configure the compiler • Connect the circuit • Write the program • Get frustrated/Debug/Get it to work • Get excited and immediately start next project (sleep is for wimps) 4/29/2024 49
  • 49. Arduino Starter Kits • Start with a combo pack (starter kit) – Includes a microcontroller, wire, LED's, sensors, etc. • www.adafruit.com adafruit.com/products/68 ($65) • www.sparkfun.com https://www.sparkfun.com/products/11576 ($99.95) • Radio Shack Make Ultimate Microcontroller Pack w/ Arduino Kit ($119.99) • www.makershed.com http://www.makershed.com/Ultimate_Arduino_Microcontroller_Pack_p/msump 1.htm ($150) 4/29/2024 50
  • 50. What to Get – My Recommendation • Required: – Arduino (such as Uno) – USB A-B (printer) cable – Breadboard – Hookup wire – LED's – Resistors – Sensors – Switches • Good Idea: – Capacitors – Transistors – DC motor/servo – Relay  Advanced:  Soldering iron & solder  Heat shrink tubing  9V battery adapter  Bench power supply 4/29/2024 51
  • 51. Arduino Compiler • Download current compiler from: arduino.cc/en/Main/software • Arrogantly refers to itself as an IDE (Ha!). • Run the software installer. • Written in Java, it is fairly slow. Visit playground.arduino.cc/Main/ DevelopmentTools for alternatives to the base arduino IDE 4/29/2024 52
  • 52. Configuring the Arduino Compiler • Defaults to COM1, will probably need to change the COM port setting. • Appears in Device Manager (Win7) under Ports as a Comm port. 4/29/2024 53
  • 53. Arduino Program Development • Based on C++ without 80% of the instructions. • A handful of new commands. • Programs are called 'sketches'. • Sketches need two functions: – void setup( ) – void loop( ) • setup( ) runs first and once. • loop( ) runs over and over, until power is lost or a new sketch is loaded. 4/29/2024 54
  • 54. Arduino C • Arduino sketches are centered around the pins on an Arduino board. • Arduino sketches always loop. – void loop( ) {} is equivalent to while(1) { } • The pins can be thought of as global variables. 4/29/2024 55
  • 55. Arduino C Specific Functions • pinMode(pin, mode) Designates the specified pin for input or output • digitalWrite(pin, value) Sends a voltage level to the designated pin • digitalRead(pin) Reads the current voltage level from the designated pin • analog versions of above – analogRead's range is 0 to 1023 • serial commands – print, println, write 4/29/2024 56
  • 56. Compiler Features • Numerous sample sketches are included in the compiler • Located under File, Examples • Once a sketch is written, it is uploaded by clicking on File, Upload, or by pressing <Ctrl> U 4/29/2024 57
  • 57. Arduino C is Derived from C++ • avr-libc #include <avr/io.h> #include <util/delay.h> int main(void) { while (1) { PORTB = 0x20; _delay_ms(1000); PORTB = 0x00; _delay_ms(1000); } return 1; } • Arduino C void setup( ) { pinMode(13, OUTPUT); } void loop( ) { digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(1000); }  These programs blink an LED on pin 13 4/29/2024 58
  • 58. Basic Electric Circuit • Every circuit (electric or electronic) must have at least a power source and a load. • The simplest circuit is a light. • Plug in the light, and it lights up. • Unplug it, the light goes out. • Electricity flows from the power source, through the load (the light) and then back to the power source. 4/29/2024 59
  • 59. Basic LED Circuit • Connect the positive (+) lead of a power source to the long leg of an LED. • Connect other leg of the LED to a resistor. – High resistance means a darker light. – Low resistance means brighter light. – No resistance means a burned out LED. • Connect other leg of the resistor to the negative lead of the power source. 4/29/2024 60
  • 60. Let the Good Times Roll! • At this point we have: – Purchased a starter kit, including the Arduino – Connected and configured the Arduino – Connected a simple LED circuit • Let's write some code! 4/29/2024 61
  • 61. Blink Sketch void setup( ) { pinMode(13, OUTPUT); } void loop( ) { digitalWrite(13, HIGH); delay(1000); digitalWrite(13, LOW); delay(1000); } Connected to one end of the circuit Connected to other end of the circuit 4/29/2024 62
  • 62. 4 LED Blink Sketch void setup( ) { pinMode(1, OUTPUT); pinMode(3, OUTPUT); pinMode(5, OUTPUT); pinMode(7, OUTPUT); } void loop( ) { digitalWrite(1, HIGH); delay (200); digitalWrite(1, LOW); digitalWrite(3, HIGH); delay (200); digitalWrite(3, LOW); digitalWrite(5, HIGH); delay (200); digitalWrite(5, LOW); digitalWrite(7, HIGH); delay (200); digitalWrite(7, LOW); } 4/29/2024 63
  • 63. So What? • Great. Blinking lights. Not impressed. • Only covered output thus far. • Can use analog inputs to detect a physical phenomena. 4/29/2024 64
  • 64. Inputs • Digital inputs will come to the Arduino as either on or off (HIGH or LOW, respectively). – HIGH is 5VDC. – LOW is 0VDC. • Analog inputs will come to the Arduino as a range of numbers, based upon the electrical characteristics of the circuit. – 0 to 1023 – .0049 V per digit (4.9 mV) – Read time is 100 microseconds (10,000 a second) 4/29/2024 65
  • 65. Analog Input • A potentiometer (variable resistor) is connected to analog pin 0 to an Arduino. • Values presented to pin 0 will vary depending upon the resistance of the potentiometer. 4/29/2024 66
  • 66. Analog Input-Application • The variable resistor can be replaced with a sensor. • For example, a photo resistor. – Depending upon the light level at the photo resistor: • Turn on a light • Increase or decrease the brightness of an LED (or an LED array) • Most sensors are simply variable resistors, but vary their resistance based on some physical characteristic. 4/29/2024 67
  • 67. “Competitors”to the Arduino • PIC controller – Microcontroller programmed with C or assembler • Alternatives to the Arduino line – Pinguino – PIC controller – MSP430 – Texas Instruments; $4.30 – Others: customs, Teensy, etc. • Netduino • Computers – Raspberry Pi – BeagleBones – TI; has computer and controller 4/29/2024 68
  • 68. Introduction to Arduino Programming 4/29/2024 69
  • 69. Content  Operators in Arduino  Control Statement  Loops  Arrays  String  Math Library  Random Number  Interrupts  Example Program 4/29/2024 70
  • 70. Operators  Arithmetic Operators: =, +, -, *, /, %  Comparison Operator: ==, !=, <, >, <=, >=  Boolean Operator: &&, ||, !  Bitwise Operator: &, |, ^, ~, <<, >>,  Compound Operator: ++, --, +=, -=, *=, /=, %=, |=, &= 4/29/2024 71
  • 71. Control Statement  If statement  if(condition){ Statements if the condition is true ; }  If…Else statement  if(condition ){ Statements if the condition is true; } else{ Statements if the condition is false; } If…….Elseif…..Else  if (condition1){ • Statements if the condition1 is true; • } • else if (condition2){ Statements if the condition1 is false • and condition2 is true; • } • else{ •Statements if both the conditions are false; • } 4/29/2024 72
  • 72. Control Statement (contd..)  Switch Case  Switch(choice) { case opt1: statement_1; break; Case opt2: statement_2; break; case opt3: statement_3;break; . . . case default: statement_default; break; }  Conditional Operator.  Val=(condition)?(Statement1): (Statement2) 4/29/2024 73
  • 73. Loops  For loop  for(initialization; condition; increment) { Statement till the condition is true; }  While loop  while(condition){ Statement till the condition is true; }  Do… While loop  do{ Statement till the condition is true; }while(condition); 4/29/2024 74
  • 74. Loops (contd..)  Nested loop: Calling a loop inside another loop  Infinite loop: Condition of the loop is always true, the loop will never terminate 4/29/2024 75
  • 75. Arrays  Collection of elements having homogenous datatype that are stored in adjacent memory location.  The conventional starting index is 0.  Declaration of array: <Datatype> array_name[size]; Ex: int arre[5]; 4/29/2024 76
  • 76. Arrays (contd..)  Alternative Declaration: int arre[]={0,1,2,3,4}; int arre[5]={0,1,2};  Multi-dimentional array Declaration: <Datatype> array_name[n1] [n2][n3]….; Ex: int arre[row][col][height]; 4/29/2024 77
  • 77. String  Array of characters with NULL as termination is termed as a String.  Declaration using Array:  char str[]=“ABCD”;  char str[4];  str[0]=‘A’;  str[1]=‘B’;  str[2]=‘C’;  str[3]=D;  Declaration using String Object:  String str=“ABC”; 4/29/2024 78
  • 78. String (contd..)  Functions of String Object:  str.ToUpperCase(): change all the characters of str to upper case  str.replace(str1,str2): is str1 is the sub string of str then it will be replaced by str2  str.length(): returns the length of the string without considering null 4/29/2024 79
  • 79. Math Library  To apply the math functions and mathematical constants, “MATH.h” header files is needed to be included.  Functions:  cos(double radian);  sin(double radian);  tan(double radian);  fabs(double val);  fmod(double val1, double val2); 4/29/2024 80
  • 80. Math Library (contd..)  Functions:  exp(double val);  log(double val);  log10(double val);  square(double val);  pow(double base, double power); 4/29/2024 81
  • 81. Random Number  randomSeed(int v): reset the pseudo-random number generator with seed value v  random(maxi)=gives a random number within the range [0,maxi]  r n a i , n m d a o x m i(mini )=gives a random number within the range [mini,maxi] 4/29/2024 82
  • 82. Interrupts  An external signal for which system blocks the current running process to process that signal  Types:  Hardware interrupt  Software interrupt  digitalPinToInterrupt(pin): Change actual digital pin to the specific interrupt number.  attachInterrupt(digitalPinToInterrupt(pin), ISR, mode);  ISR: a interrupt service routine have to be defined 4/29/2024 83
  • 83. Example: TrafficControlSystem Requirement:  ArduinoBoard  3 different color LEDs  330 Ohm resistors  Jumper wires 4/29/2024 84
  • 84. Example: Traffic Control System (contd..) Connection:  Connect the positive terminals of the LEDs to the respective digital output pins in the board, assigned in the code.  Connect the negative terminals of the LEDs to the ground 4/29/2024 85
  • 85. Example: Traffic Control System (contd..)  Sketch //LED pins int r =2; int g = 3; int y =4; void setup() { Serial.begin(9600); pinMode(r, OUTPUT); digitalWrite(r,LOW); pinMode(g, OUTPUT); digitalWrite(g,LOW); pinMode(y , OUTPUT); digitalWrite(y, LOW); } 4/29/2024 86
  • 86. Example: Traffic Control System (contd..) void traffic() { digitalWrite(g, HIGH); Serial.println(“Green LED: ON, GO”); delay(5000); digitalWrite(g, LOW); digitalWrite(y, HIGH); Serial.println(“Green LED: OFF ; Yellow LED: ON, WAIT”); delay(5000); 4/29/2024 87
  • 87. digitalWrite(y,LOW); digitalWrite(r, HIGH); Serial.println(“Yellow LED: OFF ; Red LED: ON, STOP"); // delay(5000); digitalWrite(r, LOW); Serial.println(“All OFF"); } void loop() { traffic (); delay (10000); } 4/29/2024 88
  • 88. Example: Traffic Control System (contd..) Output:  Initially, all the LEDs are turned off  The LEDs are turned on one at a time with a delay of 5 seconds  The message is displayed accordingly  Figure showing all the LEDs turned on 4/29/2024 89
  • 90. / Integration of Sensors and Actuators 4/29/2024 91
  • 91. Sensors  Electronic elements  Converts physical quantity/ measurements into electrical signals  Can be analog or digital 4/29/2024 92
  • 92. Types of Sensors Some commonly used sensors:  Temperature  Humidity  Compass  Light  Sound  Accelerometer 4/29/2024 93
  • 93. SensorInterface with Arduino  Digital Humidity and Temperature Sensor (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 4/29/2024 94
  • 94. DHTSensorLibrary  A u p r d p u o i r n t o sa sspecial library for the DHT11 and DHT22 sensors  Provides function to read the temperature and humidity values from the data pin dht.readHumidity() dht.readTemperatue() 4/29/2024 95
  • 95. 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  Connect pin 4 to the ground (GND) pin of the board 4/29/2024 96
  • 96. Sketch: DHT_SENSOR Install the DHT Sensor Library  Go to Sketch -> Include Library -> Manage Library 4/29/2024 97
  • 97. Sketch: DHT_SENSOR (contd..)  Search for DHT SENSOR  Select the “DHT sensor library” and install it 4/29/2024 98
  • 98. Sketch: DHT_SENSOR (contd..) //Initialize DHT sensor //Stores humidity value //Stores temperature #include <DHT.h>; DHT dht(8, DHT22); float humidity; float temperature; value void setup() { Serial.begin(9600); dht.begin(); } void loop() { //Read data from the sensor and store it to variables humidity and temperature humidity = dht.readHumidity(); temperature= dht.readTemperature(); //Print temperature and humidity values to serial monitor Serial.print("Humidity: "); Serial.print(humidity); Serial.print("%, Temperature: "); Serial.print(temperature); Serial.println(" Celsius"); delay(2000); //Delay of 2 seconds } 4/29/2024 99
  • 100. Sketch: DHT_SENSOR (contd..)  Connect the board to the PC  Set the port and board type  Verify and upload the code 4/29/2024 101
  • 101. Output The readings are printed at a delay of 2 seconds as specified by the delay() function 4/29/2024 102
  • 102. Actuators  Mechanical/Electro-mechanical device  Converts energy into motion  Mainly used to provide controlled motion to other components 4/29/2024 103
  • 103. Basic Working Principle Uses different combination of various mechanical structures like screws, ball bearings, gears to produce motion. 4/29/2024 104
  • 104. Types of Motor Actuators  Servo motor  Stepper motor  Hydraulic motor  Solenoid  Relay  AC motor 4/29/2024 105
  • 105. Servo Motor  High precision motor  Provides rotary motion 0 to 180 degree  3 wires in the Servo motor  Black is Ground  Red is for power supply  Yellow for signal pin 4/29/2024 106
  • 106. Servo Library on Arduino A rudinohas library to operate the servo motor-SERVO  Create an instance of servo to use it in the sketch Servo myservo; 4/29/2024 107
  • 107. 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(servo Pin); • } void loop(){ //Servo moves to 0 degrees ServoDemo.write(0); delay(1000); // Servo moves to 90 degrees ServoDemo.write(90); delay(1000); // Servo moves to 180 degrees ServoDemo.write(180); delay(1000); } 4/29/2024 108
  • 108. Sketch: SERVO_ACTUATOR(contd..)  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 4/29/2024 109
  • 109. 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). 4/29/2024 110
  • 110. Board Setup  Connect the board to the PC  Set the port and board type  Verify and upload the code 4/29/2024 111
  • 111. Output The motor turns 0, 90 and 180 degrees with a delay of 1 second each. 4/29/2024 112
  • 112. Do more with the Servo library • Some other functions available with the Servo library:  Knob()  Sweep()  write()  writeMicroseconds()  read()  attached()  detach() 4/29/2024 113

Editor's Notes

  1. GND to ground and 13 to power 330 ohm ground and LED LED to 330 ohm and power
  2. void setup() { Serial.begin(9600); } void loop() { Serial.println(analogRead(0)); }
  3. void setup() { pinMode(9, OUTPUT); } void loop() { int lightLevel = analogRead(0); lightLevel = map(lightLevel, 0, 900, 0, 255); lightLevel = constrain(lightLevel, 0, 255); analogWrite(9, 255 - lightLevel); }