02 Sensors and Actuators Understand .pdf

engsharaf2025 9 views 70 slides Mar 05, 2025
Slide 1
Slide 1 of 70
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

About This Presentation

Sensors and Actuator
Understand networking theories and concepts, such as OSI model, TCP/IP protocols, and subnetting
Build logical and abstract thinking


Slide Content

Internet of Things
Sensors & Actuators
Abdallah El Ghamry

IoT Applications

Things

Internet of Things

Internet of Things
▪TheInternetofThings(IoT)representsthenetworkofphysicalobjects
“Things”thatareintegratedwithsensors,softwareandothertechnologies
forthepurposeofexchangingdatawithotherdevicesontheInternet.

Sensors
▪Asensorisadevicethatdetectssometypeofinputfromthephysical
environment.
▪Theinputcanbelight,heat,motion,pressureoranynumberofother
environmentalphenomena.

Sensors
Temperature
and Humidity
PIR Motion
Detection
Microphone
Sound Detection
Gas/Smoke
Sensor
Photoresistor
CdS Sensor
Ultrasonic
Sensor
IR Obstacle
Avoidance
Heart Rate
Sensor (ECG)

Actuators
▪Sensorsturnaphysicalinputintoanelectricaloutput,while
actuatorsdotheopposite.
▪Actuatorstakeelectricalsignalsfromcontrolmodulesandturnthem
intophysicaloutputs.
LEDs Buzzer DC Fan Servo Motor

Actuators: Servo Motor
▪Aservomotorisanelectricaldevicewhichcanpushorrotatean
objectwithgreatprecision.

Actuators: Servo Motor
▪TheHBE-ROBONOVAAI3isanintelligentrobotwithanMR-C3024
controllerboardcapableofcontrolling32servomotorssimultaneously.

Processing
Arduino Raspberry Pi

Arduino
▪Arduinoisopen-sourcehardwarethatcanbeusedtodevelop
embeddedsystemswithopen-sourcesoftware.
▪Arduinohasgainedmassivepopularityamongstudentsformakinga
workingmodel.
▪ThereasonsbehindthepopularityofArduinoareitslowcost,
availabilityofsoftware,andeasy-to-interfacepossibility.
▪TheArduinoenvironmenthasbeendesignedtobeeasytousefor
beginnerswhohavenosoftwareorelectronicsexperience.

Arduino
▪Arduinoisusedinmanyeducationalprogramsaroundtheworld,
particularlybydesignerswhowanttoeasilycreateprototypesbutdo
notneedadeepunderstandingofthetechnicaldetails.
▪Becauseitisdesignedtobeusedbynontechnicalpeople,the
softwareincludesplentyofexamplecodetodemonstratehowtouse
theArduinoboard.
▪Peoplealreadyworkingwithmicrocontrollersarealsoattractedto
Arduinobecauseofitsfacilityforquickimplementationofideas.

Arduino Uno Board

Arduino Mega Board

Connecting Arduino to Power

Connecting Arduino to Power

Power Supply Pins
▪TheArduinoUnoprovidesbotha5V,anda3.3Vpowersupply.

Arduino IDE
▪TheArduinoIDEenablesyoutowriteandeditcodeandconvertthiscode
intoinstructionsthatArduinohardwareunderstands.

Downloading Arduino IDE
▪Gotohttps://www.arduino.cc/en/softwarewebsite.

Downloading Arduino IDE
▪Clickthe“JustDownload”option.

Installing Arduino IDE

Installing Arduino IDE

Installing Arduino IDE

Installing Arduino IDE

Arduino Sketches
▪A sketchis the name that Arduino uses for a program.
voidsetup(){
// put your setup code here, to run once:
}
voidloop(){
// put your main code here, to run repeatedly:
}

Arduino Sketches
▪TherearetwospecialfunctionsthatareapartofeveryArduino
sketch:setup()andloop().
▪Thesetup()iscalledonce,whenthesketchstarts.
▪It’sagoodplacetodosetuptaskslikesettingpinmodes.
▪Theloop()functioniscalledoverandoverandisheartofmost
sketches.
▪Youneedtoincludebothfunctionsinyoursketch,evenifyoudon’t
needthemforanything.

Turning on an LED

Turning on an LED

Turning on an LED: Steps
1.Connectbreadboardpower(+)andground(-)railstoArduino5V
andground(GND),respectively.

Turning on an LED: Steps
2.PlugtheLEDintotwodifferentbreadboardrows.

Turning on an LED: Steps
3.Thecathode(shorterleg)connectstoonelegofaresistorof330Ω,
andtheotherresistorlegtotheground.

Turning on an LED: Steps
4.WireuptheLEDanode(longerleg)tothepower.

Your First Arduino Project: Blinking an LED
▪TurnanLEDonandoffeverysecond.

Your First Arduino Project: Circuit
▪TurnanLEDonandoffeverysecond.

Your First Arduino Project: Steps
1.Connectbreadboardpower(+)andground(-)railstoArduino5V
andground(GND),respectively.

Your First Arduino Project: Steps
2.PlugtheLEDintotwodifferentbreadboardrows.

Your First Arduino Project: Steps
3.Thecathode(shorterleg)connectstoonelegofaresistorof330Ω,
andtheotherresistorlegtotheground.

Your First Arduino Project: Steps
4.WireuptheLEDanode(longerleg)toArduinopin13.

Your First Arduino Project: Schematic

Your First Arduino Project: Blink
YoumayalsoloaditfromFile→Examples→01.Basics→Blink

Your First Arduino Project: Code
// Turns an LED on for one second, then off for one second, repeatedly .
// The setup function runs once when you press reset or power the board
voidsetup(){
// Initialize digital pin LED_BUILTIN (13) as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// The loop function runs over and over again forever
voidloop(){
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED on
delay(1000); // Wait for a second
digitalWrite(LED_BUILTIN, LOW); // Turn the LED off
delay(1000); // Wait for a second
}

Your First Arduino Project: Arduino AVR Boards
GotoTools→Board,andselectyourboard.

Your First Arduino Project: Port
GotoTools→Port,andselecttheportoftheArduinoboard.

Your First Arduino Project: Verify a Sketch
ClicktheVerifybuttontotrycompilingthesketchandcheckforerrors.

Your First Arduino Project: Upload a Sketch
ClicktheUploadbuttontoprogramtheboardwiththesketch.

Your First Arduino Project: Discussion
▪ThefirstthingyoudoistoinitializeLED_BUILTINpinasanoutputpin
withtheline:
pinMode(LED_BUILTIN, OUTPUT);
▪Inthemainloop,youturntheLEDonwiththeline:
digitalWrite(LED_BUILTIN, HIGH);
▪Thenyouturnitoffwiththeline:
digitalWrite(LED_BUILTIN, LOW);

Your First Arduino Project: Discussion
▪Thedelay()causestheArduinotowaitforthespecifiednumberof
millisecondsbeforecontinuingontothenextline.
▪Thereare1000millisecondsinasecond,sothefollowinglinecreatesa
delayofonesecond.
delay(1000);
▪Constantsareusedtomaketheprogramseasiertoread.
▪TheconstantLED_BUILTINisthenumberofthepintowhichtheon-
boardLEDisconnected.
▪MostboardshavethisLEDconnectedtodigitalpin13.

Your First Arduino Project: Alternative Code
// Turns an LED on for one second, then off for one second, repeatedly .
// The setup function runs once when you press reset or power the board
voidsetup(){
// Initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// The loop function runs over and over again forever
voidloop(){
digitalWrite(13, HIGH); // Turn the LED on
delay(1000); // Wait for a second
digitalWrite(13, LOW); // Turn the LED off
delay(1000); // Wait for a second
}

Photoresistor (Light Sensor)
▪Thephotoresistorisalightsensitive,variableresistor.

Photoresistor (Light Sensor)
▪Photoresistorsareperfectformakinglightcontrolledswitches.

Photoresistor: Circuit

Photoresistor: Circuit

Photoresistor: Components
▪Youneed
•Arduino
•LED
•Photoresistor
•330ΩResistor
•10KΩResistor
•Jumpers
•Breadboard

Photoresistor: Steps
1.Connectbreadboardpower(+)andground(-)railstoArduino5V
andground(GND),respectively.

Photoresistor: Steps
2.Dragaphotoresistortoyourbreadboard,soitslegsplugintotwo
differentrows.

Photoresistor: Steps
3.Createawireconnectingonephotoresistorlegtopower.

Photoresistor: Steps
4.Draga10KΩresistortoconnecttheotherphotoresistorlegtothe
ground.

Photoresistor: Steps
5.Connectthephotoresistorlegthatisconnectedwiththegroundto
theArduinoA0pin.

Photoresistor: Steps
6.PlugtheLEDintotwodifferentbreadboardrows.

Photoresistor: Steps
7.Thecathode(shorterleg)connectstoonelegofaresistorof330Ω,
andtheotherresistorlegtotheground.

Photoresistor: Steps
8.WireuptheLEDanode(longerleg)toArduinopin13.

Photoresistor: Code
intphotoresistor = 0; // A variable holds the value of photoresistor
intthreshold = 750; //
voidsetup()
{
Serial.begin(9600); // Start a serial connection with the computer
pinMode(13, OUTPUT); // Set pin 13 as an output pin
}
voidloop()
{
photoresistor = analogRead(A0); // Read the brightness of the LED
Serial.println(photoresistor); // Print the value of photoresistor
// If the photoresistor value < threshold turn the light on, otherwise turn it off
if(photoresistor < threshold)
digitalWrite(13, HIGH); // Turn on the LED
else
digitalWrite(13, LOW); // Turn off the LED
delay(100); // Short delay
}

ADC vs. DAC

Read Analog Voltage
▪Themicrocontrolleroftheboardhasacircuitinsidecalledan
analog-to-digitalconverter(ADC)thatreadsthischangingvoltage
andconvertsittoanumberbetween0and1023.
▪TheADCinArduinois10-bit.
0000000000 0V
1111111111 5V

Read Analog Voltage
▪TheanalogRead()returnsanumberbetween0and1023thatis
proportionaltotheamountofvoltagebeingappliedtothepin.
▪Toscalethenumbersbetween0and5,divide5by1023andmultiplythat
bysensorValue:
voltage=sensorValue*(5.0/1023.0);

Closed-Loop vs. Open-Loop Control Systems
▪Anopen-loopcontrolsystemdoesnotmonitortheoutputtodetermine
whatadjustmentstomaketotheinput.
▪Forexample,whenusingaclothesdryer,youmightsetthetimeronthe
dryertorunthedryingcycleforonehour.
▪Attheendofthehour,thedryerwillstop.
▪Thelevelofdrynessoftheclotheswillvarydependingupontheirlevelof
wetnessatthebeginningofthecycle.
Controller ProcessInput Output

Closed-Loop vs. Open-Loop Control Systems
▪Inaclosed-loopcontrolsystem,theoutputismeasuredtodetermine
whetheritisthedesiredoutputandadjusttheinputasappropriate.
▪Forexample,iftheclothesdryerisequippedwithmoisturesensors,the
inputmaybealevelofdrynessthatadjuststhecyclebyextendingthe
dryingtimeuntilthesensorsindicatetheclothesaredried.
Controller Process
Sensor
Input Output
Error

Appendix 1: SparkFun Inventor's Kit (SIK)
▪Gotohttps://www.sparkfun.com/sikcodeanddownloadtheexamples.

Appendix 2: Arduino Reference
▪Gotohttps://www.arduino.cc/reference/en/tolearnArduinobasics.
Tags