FIOT_Unit_2 (1)softwaredefinedradio.pptx

ssuser0b643d 14 views 113 slides Apr 29, 2024
Slide 1
Slide 1 of 113
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88
Slide 89
89
Slide 90
90
Slide 91
91
Slide 92
92
Slide 93
93
Slide 94
94
Slide 95
95
Slide 96
96
Slide 97
97
Slide 98
98
Slide 99
99
Slide 100
100
Slide 101
101
Slide 102
102
Slide 103
103
Slide 104
104
Slide 105
105
Slide 106
106
Slide 107
107
Slide 108
108
Slide 109
109
Slide 110
110
Slide 111
111
Slide 112
112
Slide 113
113

About This Presentation

SDN


Slide Content

Fundamentals of IoT Unit-II 3/26/2024 1

Syllabus 3/26/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. 3/26/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. 3/26/2024 4

M2M Network 3/26/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. 3/26/2024 6

M2M gateway 3/26/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. 3/26/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). 3/26/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. 3/26/2024 10

Communication in IoT vs M2M 3/26/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 3/26/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 3/26/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. 3/26/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 3/26/2024 15

Different Types of Interoperability? User Interoperability : Interoperability problem between a user and a device Device Interoperability : Interoperability problem between two different devices 3/26/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 3/26/2024 17

3/26/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 3/26/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 3/26/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 3/26/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. 3/26/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 3/26/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 3/26/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 3/26/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 3/26/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 3/26/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 3/26/2024 28

The Architecture of Universal Middleware Bridge (UMB) UMB consists UMB Core (UMB-C) UMB Adaptor (UMB-A) 3/26/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) . 3/26/2024 30

3/26/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 3/26/2024 32

3/26/2024 33

3/26/2024 34

3/26/2024 35

Introduction to Arduino Programming 3/26/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) 3/26/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. 3/26/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. 3/26/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). 3/26/2024 40

Arduino Types Many different versions Number of input/output channels Form factor Processor Leonardo Due Micro LilyPad Esplora Uno 3/26/2024 41

Leonardo Compared to the Uno, a slight upgrade. Built in USB compatibility Bugs? Presents to PC as a mouse or keyboard 3/26/2024 42

Due Much faster processor, many more pins Operates on 3.3 volts Similar to the Mega 3/26/2024 43

Micro When size matters: Micro, Nano, Mini Includes all functionality of the Leonardo Easily usable on a breadboard 3/26/2024 44

LilyPad LilyPad is popular for clothing-based projects. 3/26/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. 3/26/2024 46

Mega Compared to the Uno, the Mega: Many more communication pins More memory Some interface hardware doesn't work 3/26/2024 47

Arduino Uno Close Up The pins are in three groups: Invented in 2010 14 digital pins 6 analog pins power 3/26/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) 3/26/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/msump1.htm ($150) 3/26/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 3/26/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 3/26/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. 3/26/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. 3/26/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. 3/26/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 3/26/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 3/26/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 3/26/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. 3/26/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. 3/26/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! 3/26/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 3/26/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); } 3/26/2024 63

So What? Great. Blinking lights. Not impressed. Only covered output thus far. Can use analog inputs to detect a physical phenomena. 3/26/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) 3/26/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. 3/26/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. 3/26/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 3/26/2024 68

Introduction to Arduino Programming 3/26/2024 69

C o n t e nt Operators in Arduino Control Statement Loops Arrays String Math Library Random Number Interrupts Example Program 3/26/2024 70

Operators Arithmetic Operators: =, +, -, *, /, % Comparison Operator: ==, !=, <, >, <=, >= Boolean Operator: &&, ||, ! Bitwise Operator: &, |, ^, ~, <<, >>, Compound Operator: ++, --, +=, -=, *=, /=, %=, |=, &= 3/26/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; } 3/26/2024 72

Control Statement (contd..) Switch Case Switch(choice) { case opt1: statement_1; break; C ase opt2: statement_2; break; case opt3: statement_3;break; . . . case default: statement_default; break; } Conditional Operator. Val=(condition)?(Statement1): (Statement2) 3/26/2024 73

L o o p s 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); 3/26/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 3/26/2024 75

A r r a y s 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]; 3/26/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]; 3/26/2024 77

S t r i n g 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”; 3/26/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 3/26/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); 3/26/2024 80

Math Library (contd..) Functions: exp(double val); log(double val); log10(double val); square(double val); pow(double base, double power); 3/26/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] rnai,nmdaoxmi (mi ni )=gives a random number within the range [mini,maxi] 3/26/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 3/26/2024 83

Example: Traffic Control System Requirement: Arduino Board 3 different color LEDs 330 Ohm resistors Jumper wires 3/26/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 3/26/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); } 3/26/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); 3/26/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); } 3/26/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 3/26/2024 89

O u t p ut 3/26/2024 90

/ I n t e g r a t i o n o f S e n s o r s a n d A c t u a t o r s 3/26/2024 91

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

Types of Sensors Some commonly used sensors: Temperature Humidity Compass Light Sound Accelerometer 3/26/2024 93

Sensor Interface 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 3/26/2024 94

DHT Sensor Library Auprdpuoirntos as special library for the DHT11 and DHT22 sensors Provides function to read the temperature and humidity values from the data pin dht.readHumidity() dht.readTemperatu e () 3/26/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 3/26/2024 96

Sketch: DHT_SENSOR Install the DHT Sensor Library Go to Sketch -> Include Library -> Manage Library 3/26/2024 97

Sketch: DHT_SENSOR (contd..) Search for DHT SENSOR Select the “DHT sensor library” and install it 3/26/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() { Ser i a l. b e g i n (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 } 3/26/2024 99

Sketch: DHT_SENSOR (contd..) 3/26/2024 100

Sketch: DHT_SENSOR (contd..) Connect the board to the PC Set the port and board type Verify and upload the code 3/26/2024 101

Output The readings are printed at a delay of 2 seconds as specified by the delay() function 3/26/2024 102

Actuators Mechanical/Electro-mechanical device Converts energy into motion Mainly used to provide controlled motion to other components 3/26/2024 103

Basic Working Principle Uses different combination of various mechanical structures like screws, ball bearings, gears to produce motion. 3/26/2024 104

Types of Motor Actuators Servo motor Stepper motor Hydraulic motor Solenoid Relay AC motor 3/26/2024 105

Servo Motor High precision motor Provides rotary motion to 180 degree 3 wires in the Servo motor Black is Ground Red is for power supply Yellow for signal pin 3/26/2024 106

Servo Library on Arduino Ar udino has library to operate the servo motor -SERVO Create an instance of servo to use it in the sketch Servo myservo; 3/26/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(servoPin); } void loop(){ //Servo moves to degrees Se r v oD em o . wri t e ( ); delay(1000); // Servo moves to 90 degrees Se r v oD em o . wri t e ( 90 ); delay(1000); // Servo moves to 180 degrees ServoDemo.write(180); delay(1000); } 3/26/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 3/26/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). 3/26/2024 110

Board Setup Connect the board to the PC Set the port and board type Verify and upload the code 3/26/2024 111

Output The motor turns 0, 90 and 180 degrees with a delay of 1 second each. 3/26/2024 112

Do more with the Servo library Some other functions available with the Servo library: Knob() Sweep() write() writeMicroseconds() read() attached() detach() 3/26/2024 113
Tags