Unit II - Lecture - THINGS IN IOT
Unit II - Lecture - THINGS IN IOT
1
2
Reference Books Suggested….
3
Unit II :- Things in IOT (6 Hrs)
4
Unit # II : THINGS IN IOT (06 Hours)
Select suitable sensors and actuators for real time
CO # 2 L3 : Apply
scenarios.
8
Sensor
● Sensor is a device that Sense a Physical Phenomenon (temperature,
displacement, force etc) & produces a proportional output signal
(electrical, mechanical, magnetic etc).
9
Sensors Types:
10
11
Types of Sensor & Function
Name Definition
Light Sensor Type of sensor used to Detect the light
Temperature Sensor Used to measure the temperature of room or atmosphere
Motion Sensor It is used to detect the movement of any live thing
Proximity Sensor Detect the presence of nearby objects without any physical contact
IR Sensor (Infrared
Sensor) It can measure the heat of an object as well as detects the motion
Pressure Sensor It is a device for pressure measurement of gases or liquids
Accelerometer Sensor It is a type of sensor used to measure the acceleration exerted upon the sensor
Ultrasonic Sensor ultrasonic sensors measure distance by using ultrasonic waves
Color Sensor Detects the color of the material usually detects color in RBG scale.
Humidity Sensor Measures and reports both moisture and air temperature
Tilt Sensor Measure the tilting position with reference to gravity
Current Sensor It is used to measure the current 12
Types of Sensor & Function… Continue….
Name Definition
Bio-Medical Sensor Detect specific biological, chemical, or physical processes
GAS Sensor Detects the presence of gases in an area
Speed Sensor Measure the speed of wheels
Use load cells to weigh objects and prevent machinery from
Force Sensor overloading
Hall effect Sensor Used to measure the magnitude of a magnetic field
Compass Sensor A device whose function is to give the right directions
Used to control the exact dosing of gases or liquids in many technical
Flow Sensor systems
Determining the level or amount of fluids, liquids or other substances
Level Sensor that flow in an open or closed system
13
Light Sensors
• Light sensors are a type of photodetector (also called photosensors) that detect light.
Different types of light sensors can be used to measure illuminance, respond to changes
in the amount of light received, or convert light to electricity.
• Light sensors that transform the light or infrared radiation into the other electrical
parameters like Voltage/Resistance or are known as the light sensors. These sensors
are also named as the photoconductors. A normally used photoconductor is the light-
dependent resistor (LDR)(Photo resister).
• Three types: LDR , Photodiode & Phototransistor.
14
Light Dependent Resistance(LDR) :Photo resistor
• LDR are also known as the photoresistors, these light sensors are used in the
different engineering projects to control the light strength for different components.
• It is constructed from the Cds (cadmium) this substance is very sensitive to light and
according to the intensity of the light, it varies the value resistance
• its resistance varies according to light in the shadowy resistance is higher while
in light resistance is less.
The normally used type of the LDR cell is OPR12 it is manufactured by the cadmium sulphide.
15
LDR Working Principle
• These devices depend on the light, when light intensity increases that fall on on the
LDR then the resistance decreases, and resistance increases when light intensity Low
(dark condition) 16
• If we connect LED at output then LED will be on/off is achieved using this principle .
17
Photodiode and Phototransistor
Both are semiconductor-based components used for sensing light intensity and
converting it into electrical signal but they are quite different.
18
SL PHOTO-DIODE PHOTO-TRANSISTOR
NO.
1. Photodiode basically is a PN Phototransistor basically an NPN
Junction Diode which can create transistor which allows the
an electric current, when the flowing of current when light
light is falling on this. falls upon its base.
2. The output response of the The output response of the
photodiode is faster than the phototransistor is lesser than a
phototransistor. photodiode.
3. The sensitivity of the photodiode The sensitivity of the
is lesser than phototransistor. phototransistor is more than the
photodiode.
4. The main applications of The main applications of
photodiodes are in solar cell, Phototransistors are IR receiver
light sensor, Smoke Detectors, circuit, LASER detector, Counter,
Pulse Oximeters Relays
Optocoupler or Opto-isolator Punch Card Readers, Level Indication
Medical Devices etc. Position Sensing,Logic Circuits
etc.
19
Optoisolator / OptoCoupler circuit
• Providing electrical and physical isolation of two sections
of a circuit and hence the safety.
20
10/15/2024
Comparison between Photodiode & Phototransistor
Definition
Photodiode is a semiconductor component that converts light energy into electrical energy.
Phototransistor is a semiconductor component that amplifies the current generated from
light energy.
Function
Photodiode is used for converting light or solar energy into electrical energy.
Phototransistor is used for sensing light.
Biasing
Photodiode can be connected in forward as well as reverse bias.
Phototransistor is only connected in forward bias.
Output
The output of photodiode is current as well as voltage
The output of phototransistor is only current.
Cost
Photodiode is cheap. Phototransistor is expensive.
Applications
Photodiode is mainly used for the conversion of solar energy into electrical energy but it is
also used for sensing light in applications such as optical fiber communication, object
counter, etc. 21
Phototransistors are mainly used for detecting light & they find applications in printers, CD-
Voltage Sensor
What is a Voltage Sensor?
A voltage sensor is a sensor used to calculate and monitor the amount of voltage in an object.
Voltage sensors can determine the AC voltage or DC voltage level. The input of this sensor is
the voltage, whereas the output is the switches, analog voltage signal, a current signal, or an
audible signal.
Two main types of voltage sensors are available:
1. capacitive type voltage sensor and
2. resistive type voltage sensor.
22
Voltage Sensors
23
Advantages of Voltage Sensors Over Conventional Measuring
Techniques
The advantage of voltage sensors include:
• Small in weight and size
• Personnel safety is high
• The degree of accuracy is very high
• Non-saturable
• Wide dynamic range
• Eco-friendly
• Can combine the voltage and current measurement into a single physical
device with small and compact dimensions
25
Humidity is the amount of water vapor in the air.
DHT 11 sensor interfacing
26
Motion detector Sensors : Active & Passive IR sensors
27
Motion detector Sensor
• Motion is a change in the position of object or person with respect to time and its
initial reference location. The motion can be specified in terms of displacement,
velocity, direction, acceleration and time. The device which senses motion is known
as motion sensor. Following are the types of motion sensor.
28
Active Motion Sensor | Microwave Motion Sensor
30
Ultrasonic sensor
WHAT IS ULTRASONIC SENSOR ?
An Ultrasonic sensor is a device that can measure the distance to an object by using
sound waves. It measures distance by sending out a sound wave at a specific frequency
and listening for that sound wave to bounce back. By recording the elapsed time between
the sound wave being generated and the sound wave bouncing back, it is possible to
calculate the distance between the sonar sensor and the object.
31
Timing Diagram of Ultrasonic sensor
• The first signal is
'Trig', which is a pulse
with 10 us of duration
that triggers 8 pulses
of ultrasound emission
via the speaker, as
shown in the image
(Pulse sonico).
Ultrasonic is the application of ultrasound & Ultrasound is an oscillating sound pressure wave with a frequency
greater than the upper limit of the human hearing range . Ultrasound is thus not separated from 'normal' (audible)
sound based on differences in physical properties, only the fact that humans cannot hear it.
Principle of operation : through the speaker, trains of ultrasound pulses are sent at a
frequency of 40 Khz. This signal bounces off the object, and returns to the sensor, being
detected by the microphone (Figure 1). Once the delay is measured between the signal
emitted and received, based on the constant speed of propagation of sound (340 meters
per second) and using an arithmetic formula (Figure 5) the distance to the object can be
calculated.
Note: Who can emit infrared radiation? All objects whose temperature more than zero (0°C) degree centigrade, which 36
emits HEAT energy in the form of IR radiation. We can not see this radiation because it radiates at infrared wavelength. Also,
Pin
Pin Description
Name
We have to connect this pin to the power supply Vcc. Input voltage range from 4.5V to
1 VCC
12V.
This is the output pin of the PIR sensor. This pin gives Digital pulse high output (3.5V)
2 OUT when the motion is detected and Digital pulse low output (0) when no motion is
detected.
37
3 GND We have to connect this pin to the power supply Ground.
Arduino Code
int buzz = 9; //Defining pins
int pir = 2;
void setup()
{
Serial.begin(9600);
}
void loop()
{
//Read data from the sensor
int status = digitalRead(pir);
if(status == HIGH)
{
Serial.println("Motion Detected");
tone(buzz,1000,700);
delay(2000);
}
else
{
Serial.println("No one is there");
delay(1000);
}} 38
8/14/2024
• It generates energy when exposed to heat. Human or animal body radiates
energy in the form of infrared radiation. Hence when human/animal come in the
range of PIR motion sensor, it receives thermal energy and hence motion is
detected by the sensor.
• Detects increase in received thermal energy to determine the motion of the
object/person
• Senses based on heat and light
40
Applications of Types of Motion Sensors
41
Wireless Sensors :
WHAT IS A WIRELESS SENSOR?
• A wireless sensor is a device that can gather sensory information and detect changes
in local environments.
• Wireless sensors are designed to measure specific parameters about their physical
surroundings and produce outputs, often electrical signals, for further processing. These
parameters include many different types of stimuli, including air temperature, lighting
levels, movements, and liquid leakages.
42
SOME OF THE TRADITIONAL WIRELESS SENSOR PROTOCOLS?
There are many wireless protocols that enable connectivity between sensors. Wi-Fi
,Bluetooth ,Zigbee etc
43
Wireless Sensors :
46
Level Sensor
• Level sensors are used to measure the position of the surface within some form
of container of both liquids and solid materials in the form of powders.
Point level measurement: indicates Level when a product is present at a certain point.
The sensors for point level indication are:
– Capacitance
– Optical
– Conductivity
– Vibrating (Tuning fork)
– Float Switch
Continuous level measuring indicates the continuous level of a product as it rises and
falls.
following are the sensors for this :
– Ultrasonic 47
Examples: Sensors connected to tank
48
Level
•Sensors
Level sensors are used to measure the position of the surface within some form
of container of both liquids and solid materials in the form of powders.
49
Ultrasonic Sensor for Level
Management.
• Measuring water level is same as measuring distance of solid surfaces, the ultrasonic transducer
outputs a train of ultrasonic bursts at 40 KHz which will hit the water surface and reflect back to the
sensor. The time taken between sent and received ultrasonic waves are calculated by a microcontroller
such as Arduino. The measured distance is converted in to percentage.
• The tank has two heights the actual water holding capacity and the total height of the tank. In any
overhead tank there will be overflow and inlet tube, the point just below the overflow tube is the end of
water holding capacity. You need to measure these two heights and enter it in the given program code 50
USB sensors
• This type of sensor incorporates a common standard interface like USB which you can
connect directly to your IoT devices or a single-board computer to add sensing
capabilities.
With a USB extended type sensor, you can plug into a USB port of a single-board
computer to receive power and create a data acquisition program to load the sensor
data.
Moreover, this type of sensor allows connection to the internet via a single-board
computer which you can
2JCIE-BU Environment easily build
Sensor(USB IoT devices.
Type)
• Embedded type sensor is installed inside a single board computer or a power drive case.
A sensor module is placed on the printed circuit board so at the very least, all you need
is a power supply circuit.
This type of sensor is integrated into robots and single-board computers to monitor the
operating condition.
52
Embedded sensors in
Mobile
53
Introduction to Actuators
• An actuator is a part of a device or machine that helps it to achieve physical movements by converting
energy, often electrical, air, or hydraulic, into mechanical force., for example by opening a valve.
• Sensors in the device sense the environment, then control signals are generated for the
actuators.
• The controller directs the actuator based on the sensor data to do the work/perform actions.
• Examples of Actuators used in IOT: LED, Buzzer, Controlling- AC Power devices, Servo motor, Speed
DC Motor.
54
55
56
Types of Actuators :
1. Hydraulic Actuators –
A hydraulic actuator uses hydraulic power to perform a mechanical Action
Ex- construction equipment uses hydraulic actuators because hydraulic actuators can
generate a large amount of force.
2. Pneumatic Actuators –
A pneumatic actuator uses energy formed by vacuum or compressed air at high pressure to
convert into either linear or rotary motion. Example- Used in robotics, use sensors that work
like human fingers by using compressed air.
3. Electrical Actuators –
An electric actuator uses electrical energy, is usually actuated by a motor that converts
electrical energy into mechanical torque. An example of an electric actuator is a solenoid
based electric bell, DC MOTOR etc
4.Thermal/Magnetic Actuators –
57
These are actuated by thermal or mechanical energy.
Actuators used in IOT
1. LED : Light emitting Diode
A Light Emitting Diode (LED) is a semiconductor device, which can emit light
when an electric current passes through it.
58
Interfacing LED with Ardiuno UNO
59
RGB LED
An RGB LED is basically an LED package that can produce almost any color. It can be used
in different applications such as outdoor decoration lighting, stage lighting designs, home
decoration lighting, LED matrix display, and more.
60
2. Buzzer
• A buzzer or beeper is an audio signaling device, which may be mechanical,
electromechanical, or piezoelectric (piezo for short).
1. The active buzzer has an internal oscillation source that makes the buzzer sound whenever
power is applied. Only one type of sound .Active buzzers are widely used in computers, printers,
copiers, alarms, electronic toys, car electronics, telephones, timers and other electronic product
sounding devices.
2. A passive buzzer has no internal source of oscillation and needs to be driven by a square
wave and a different frequency. It acts like an electromagnetic speaker, and the changing
input signal (Changing frequency) produces sound, rather than a tone automatically.
61
Passive Buzzer
Active Buzzer
Types of buzzers
Buzzers come in a variety of construction, size, and specifications. Different types and
sizes of buzzers are used for different applications. Based on construction, there are the
following kinds of buzzers:
1. Piezoelectric buzzers
2. Magnetic buzzers
3. Electromagnetic buzzers
4. Mechanical buzzers 62
5. Electromechanical buzzers
Interfacing Buzzer with Ardiuno
#define BUZZER_PIN 8
void setup()
{
pinMode(BUZZER_PIN, OUTPUT);
}
void loop()
{
digitalWrite(BUZZER_PIN, LOW);
delay(1000);
digitalWrite(BUZZER_PIN, HIGH);
delay(1000);
}
63
Button controlled Buzzer.
64
8/14/2024
Controlling- AC Power devices
• You can control a lot of things with an Arduino. Displays, LEDs, and other devices can
easily be hooked up to the I/O pins and controlled with a simple sketch.
• But the output ports on an Arduino, or any microcontroller, are only designed to
control logic-level devices (Logic 1 and Logic 0 ). Interfacing to anything that requires
more than a logic-level signal is going to require external components.
• Controlling AC devices requires different techniques:Safety First
• Alternating Current, or AC differs from Direct Current (DC) in that it constantly changes
polarity, oscillating like a sine wave between positive and negative at a predetermined
frequency.
Here are a few guidelines for working with AC:
1. NEVER experiment directly with high-voltage AC.
2. NEVER connect high-voltage AC to a solderless breadboard.
3. NEVER connect high-voltage directly to an I/O pin (or any pin) on a microcontroller.
4. ALWAYS work on AC circuits with the power off. Confirm that the power is truly off with
a multimeter.
5. ALWAYS test your wiring with a multimeter before applying power.
6. Do not leave high-voltage work unattended and powered on. Always remove power
from the circuit if you are not present, to avoid the risk of injuring others.
7. Do not attempt to work with high-voltage AC if you are inexperienced. 65
Controlling AC Devices : to control AC devices we can use
SCR,TRIAC and DIAC
67
2. Triode AC Switch (TRIAC)
68
3. Optocoupler
• For this magnetic field the metal switch liver which is attach to the
common pin is attracted towards the NO pin and connection made
between NO and common pin.
• When power is supplied to its coil, it gets energized and its normally open condition is
changed to normally closed and normally closed condition is changed to normally open.
• If we want to control the device via relay through a software then we have to attach this
device to its normally open terminal.
• When the relay gets energized, that device will be turned on for the appropriate
operation.
Fig 1: When Switch is OPEN Normally Closed(NC) contact and Lamp A is ON
• NPN transistor BC547 is being used to control the relay. The transistor is driven
into saturation (turned ON) when a LOGIC 1 is written on the PORT PIN thus turning
ON the relay. The relay is turned OFF by writing LOGIC 0 on the port pin.
• A diode (1N4007/1N4148) is connected across the relay coil; this is done so as to
protect the transistor from damage due to the BACK EMF generated in the relay's
inductive coil when the transistor is turned OFF. When the transistor is switched OFF
the energy stored in the inductor is dissipated through the diode & the internal
resistance of the relay coil. Normally 1N4148 can be used as it is fast switching
diode with a maximum forward current of 300ma. This diode is also called as free-
wheeling diode.
•
5V Relay / 12V relay in IOT
76
Opto-coupler & Relay Connection
77
Optoisolator Relay Device :
78
Pulse Width Modulation (PWM)
Pulse Width Modulation (PWM) is a one modulation technique by which the width of a
pulse is varied while keeping the frequency of the wave constant.
PWM.gif
we have period T= Ton + Toff
Through the PWM technique, we can control the power delivered to the load by using the
ON-OFF signal. The PWM signals can be used to control the speed of DC motors and to
change the intensity of the LED. Moreover, it can also be used to generate sine signals.
Controlling Brightness of LED Using PWM
NOTE:
PWM supported pins in Arduino
Uno are 3, 5, 6, 9, 10, and 11 (~
tilde sign before pin).
• When duty cycle is increased the power dropped across the load increases and
when duty cycle is reduced, power across the load decreases.
8/14/2024 10-81
Motors :
• A motor is an electric machine which can convert electrical energy into mechanical
energy. The electrical motor works on the principle of Faraday's law of electromagnetic
induction.
1. DC Motor
2. AC Motor
3. Universal Motor
82
Difference between DC Motor ,Servo Motor and
Steeper Motor
1. DC motors are fast and continuous rotation motors mainly
used for anything that needs to rotate at a high rotation per
minute (RPM). For instance; car wheels, fans etc.
83
DC Motor
A DC motor is an electro-mechanical device that converts direct current into mechanical energy by means
of rotation of a shaft.
DC motors are widely used in industrial automation, toys and robotics applications.
The speed of the DC motor can be controlled either by controlling current to the armature or by
using a variable power supply.
2) using pulse width modulation is the effective way to implement motor speed control.
Driver Circuit for DC Motor
• We can’t drive a dc motor directly through a microcontroller pin. It usually operates in
3.3v-5v and lower currents but DC motor normally works in 6-12v, 300mA and it has
other drawbacks like the back EMF produced by the DC motor may harm the
controller ports and damage them.
• The solution to the above problems is using motor driving circuit usually known as
H-Bridges. They are basically built using FETs and many dedicated ICs are also
available like L293D etc.
• These are dual H-bridge motor drivers, i.e., by using one IC we can control two DC
motors in both clockwise and counterclockwise directions.
• The L293D can provide bidirectional drive currents of up to 600mA at voltages from
4.5 V to 36 V.
As you can see, one terminal of the motor is connected at ground, so it will work when it gets a HIGH signal to
the other end.
But before this, we need to make sure some connections like,
• Connect VSS / VCC 1 (pin 16) and VS / VCC 2 (pin 8) to HIGH (+5V)
• Enable pin EN1 (pin 1) to +5V.
(We connected both Enable EN1, EN2 you can connect the one you need,
• EN1 for IN1, IN2 &
• EN2 for IN3, IN4 where EN is enable & IN is input)
• Ground Pin 4, 5, 12, 13 (although here only two shown, but in real-time there are 4 pins)
10-87
8/14/2024
CASE 2: MOTOR BOTH TERMINAL CONNECTION WITH IC
00 = Motor OFF
11 = Motor OFF
01= Motor Rotate clockwise
10=Motor Rotate Anticlockwise
88
8/14/2024
Interface of Arduino and DC Motor using Driver IC L293D
89
8/14/2024
Speed control of DC Motor
Servo Motor
• A servo motor is an electrical device used to rotate objects at certain specified angles. It’s
just a basic motor that runs through the mechanism of the servo.
• They are used in numerous applications such as toy cars, robotics, machines etc.
• Servo motors are measured in kg / cm (kilogram per centimeter). Servo motors are rated 3kg
/ cm or 6kg / cm etc. This kg / cm tell you how much weight your servo engine can lift at a
given distance. Generally servo motor 9G SG90 is used in projects.
• You can connect small servo motors directly to an Arduino to control the shaft position very
precisely.
91
Connecting Servo motor to Ardiuno
92
Controlling Servo motor
93
Brushless DC Motors :Steeper Motor
• Stepper motors are controlled by a driver, which sends the pulses into
the motor causing it to turn.
• The Rotation Angle of the Stepper Motor is Proportional to the Input Pulse.
• the position of motor shaft is controlled by controlling the number of
pulses.(step angles).
Stepping Modes
Driving Unipolar Stepper Motor
There are three stepping modes of a stepper motor. The stepping mode refers to
the pattern of sequence in which stator coils are energized.
● 1. Wave drive (One phase ON at a time)
● 2. Full drive (Two phase ON at a time)
● 3. Half drive (One and two phase ON at a time alternately)
Wave Drive
Wave Drive
● In this mode only one electromagnet is energized at a time. Generated torque will be less when compared to full
drive in which two electromagnets are energized at a time but power consumption is reduced. It has same number
of steps as in the full drive. This drive is preferred when power consumption is more important than torque. It is
rarely used.
1 1 0 0 0 08h
2 0 1 0 0 04h
3 0 0 1 0 02h
4 0 0 0 1 01h
FULL Drive
● In this mode two electromagnets are energized at a time, so the torque
generated will be larger when compared to Wave Drive. This drive is
commonly used than others. Power consumption will be higher than other
modes.
Full Drive Stepping Sequence
1 1 1 0 0 0Dh
2 0 1 1 0 06h
3 0 0 1 1 03h
4 1 0 0 1 09h
Half Drive
● In this mode alternatively one and two electromagnets are energized, so it is
a combination of Wave and Full drives. This mode is commonly used to
increase the angular resolution of the motor but the torque will be less,
about 70% at its half step position. We can see that the angular resolution
doubles when using Half Drive.
Half Drive Stepping Sequence
Hex
Step A B C D
code
1 1 0 0 0 08h
2 1 1 0 0 0Ch
3 0 1 0 0 04h
4 0 1 1 0 06h
5 0 0 1 0 02h
6 0 0 1 1 03h
7 0 0 0 1 01h
8 1 0 0 1 09h
Advantages of stepper motor.
1. Flexibility.
2. Greater Torque than Servo motor.
3. Cheaper than Servo Motors
4. Stepper Motors are Considered to be Safer.
5. Stepper Motor Offer a Longer Life.
6. Excellent Repeatability.
7. Stepper Motors are Overload Safe
8. Good Choice for Applications Requiring Low Speed with High Precision.
Sensor Vs Actuators
● The main difference between sensor and actuator is that a sensor is used to monitor
the changes in the environment while an actuator is used to control the environmental
or physical changes.
Summary :Sensor Types and Actuators types