IoT and Its Applications - Unit 3
IoT and Its Applications - Unit 3
1. Sensors
A) Temperature Sensor (e.g., TMP36, DS18B20):
Purpose: Measures the ambient temperature.
Working Principle: These sensors can either be analog or digital. Analog sensors like TMP36 provide an
analog voltage output proportional to the temperature, while digital sensors like DS18B20 communicate
over a digital protocol and give temperature readings directly in Celsius.
1. Sensors
B) Humidity Sensor (e.g., DHT11, DHT22):
Purpose: Measures the relative humidity in the air.
Working Principle: Humidity sensors like DHT11 and DHT22 use a capacitive humidity sensor to
determine the moisture in the air. The sensor provides digital output directly in percentage format.
Application: Commonly used in weather stations, greenhouses, and indoor air quality monitoring.
Unit 3
Interfacing Sensors and Actuators
1. Sensors
C) Water Level Sensor (e.g., YL-83):
Purpose: Detects the presence of water and measures the water level.
Working Principle: The YL-83 uses conductive strips that act as probes. When water makes contact with
the probes, it changes the sensor's output. The more water there is, the higher the analog output voltage,
allowing the sensor to measure different water levels.
Application: Commonly used in water tank level monitoring, flood detection systems, and automatic
irrigation systems.
Unit 3
Interfacing Sensors and Actuators
1. Sensors
D) MQ2 Gas Sensor:
Purpose: Detects gases like smoke, LPG, carbon monoxide (CO), and methane.
Working Principle: The MQ2 sensor uses a heated tin dioxide (SnO₂) sensor to detect gas
concentrations. When gas is present, the sensor’s resistance changes, providing an analog output
proportional to the concentration of gas.
Application: Frequently used in gas leak detection systems, smoke alarms, and air quality monitoring.
Unit 3
Interfacing Sensors and Actuators
1. Sensors
E) PIR Sensor (Passive Infrared Sensor):
Purpose: Detects motion by sensing changes in infrared radiation.
Working Principle: PIR sensors detect infrared radiation from objects like humans and animals. When a
warm body enters the sensor’s field of view, it detects the change in infrared radiation and sends a digital
signal.
1. Sensors
F) Ultrasonic Sensor (e.g., HC-SR04):
Purpose: Measures distance to an object using ultrasonic sound waves.
Working Principle: The HC-SR04 ultrasonic sensor emits an ultrasonic sound wave that bounces off an
object and returns to the sensor. The time taken for the echo to return is used to calculate the distance to
the object.
Application: Widely used in obstacle detection, distance measurement, robotic navigation, and parking
assistance systems.
Unit 3
Interfacing Sensors and Actuators
1. Sensors - Comparison
Sensor Type Purpose Working Principle Typical Applications
Temperature Sensor Analog voltage (TMP36, LM35)
Analog/ Measures ambient Thermostats, weather stations,
(e.g., TMP36, LM35 or digital signal (DS18B20)
Digital temperature environment control
DS18B20) proportional to temperature
Humidity Sensor Measures relative Capacitive sensing with digital Indoor air quality monitoring,
Digital
(e.g., DHT22) humidity output greenhouses, weather stations
Conductive strips detect water
Water Level Sensor Detects water Water tank monitoring, flood
Analog contact, generating an analog
(e.g., YL-83) presence and level detection
signal
Detects gases like Changes in resistance of tin
Gas leak detectors, smoke
MQ2 Gas Sensor Analog smoke, LPG, CO, dioxide based on gas
alarms, air quality monitoring
methane concentration
Senses infrared radiation Motion-activated lights,
PIR Sensor Digital Detects motion
changes from moving objects security systems
Emits ultrasonic sound waves
Ultrasonic Sensor Measures distance to Obstacle detection, distance
Digital and measures time taken for
(e.g., HC-SR04) objects measurement, robotics
echo to return
Unit 3
Interfacing Sensors and Actuators
2. Temperature Sensors
A). DHT11 / DHT22
Type: Digital
Measurement: Temperature and Humidity
Temperature Range: DHT11: 0°C to 50°C DHT22: -40°C to +80°C
Accuracy: DHT11: ±2°C DHT22: ±0.5°C
Output: Digital signal (one-wire protocol)
Advantages: Simple to use Humidity measurement included
Drawbacks: Slower response time, DHT11 has a smaller range and lower accuracy compared to DHT22.
Use Case: Ideal for home automation, weather stations, and indoor temperature monitoring.
Unit 3
Interfacing Sensors and Actuators
2. Temperature Sensors
DHT 11 DHT 22
Unit 3
Interfacing Sensors and Actuators
2. Temperature Sensors
A). DHT11 – Working Principle
• The DHT11 sensor uses a capacitive humidity sensor and a thermistor to measure humidity and
temperature, respectively.
• The capacitive humidity sensor works by measuring changes in capacitance as the relative humidity
changes. A dielectric material absorbs moisture from the air, causing a change in capacitance, which is
then converted into a humidity reading.
• The thermistor measures temperature based on the change in resistance with temperature variations.
• The sensor has a small internal microcontroller that processes the data and outputs it as a digital signal
using a single-wire protocol (one-wire communication).
Unit 3
Interfacing Sensors and Actuators
2. Temperature Sensors
A). DHT22 – Working Principle
• The DHT22 works similarly to the DHT11 but with higher precision and a broader range.
• Like the DHT11, it uses a capacitive humidity sensor and a thermistor to measure humidity and
temperature.
• The main difference is in the precision and range. The DHT22 can measure humidity from 0% to 100%
with higher accuracy (±2%) and temperature from -40°C to +80°C with higher precision (±0.5°C).
• The DHT22 also processes the data internally and outputs it in a digital format using the same single-
wire protocol.
Unit 3
Interfacing Sensors and Actuators
2. Temperature Sensors
B). LM35
Type: Analog
Measurement: Temperature only
Temperature Range: -55°C to +150°C
Accuracy: ±0.5°C at room temperature
Output: Analog voltage proportional to temperature (10mV per °C)
Advantages: No calibration required, accurate and cost-effective
Drawbacks: Requires analog input and additional calculations.
Use Case: Ideal for simple temperature measurement in HVAC systems or industrial applications.
Unit 3
Interfacing Sensors and Actuators
2. Temperature Sensors
B). LM35
Unit 3
Interfacing Sensors and Actuators
2. Temperature Sensors
C). TMP36
Type: Analog
Measurement: Temperature only
Temperature Range: -40°C to +125°CAccuracy: ±2°C
Output: Analog voltage (linear, 10mV/°C)
Advantages: Easy to use with Arduino’s analog inputs, No external components needed
Drawbacks: Lower accuracy compared to digital sensors.
Use Case: Great for general-purpose temperature monitoring in embedded projects and IoT applications.
Unit 3
Interfacing Sensors and Actuators
2. Temperature Sensors
C). TMP36 – Working Principle
• The TMP36 is an analog temperature sensor that outputs a voltage linearly proportional to the
temperature in Celsius.
• The sensor produces a 0.5V output at 0°C, and for every 1°C increase, the voltage rises by 10 mV. For
example, at 25°C, the output voltage would be 0.75V (0.5V + 250 mV).The TMP36 uses an internal
bandgap voltage reference and other circuitry to ensure accurate and linear temperature-to-voltage
conversion over a wide temperature range.
• The linear relationship between voltage and temperature simplifies calculations, as the output voltage
can be directly converted to the corresponding temperature without complex equations.
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
A) YL-83 Water Level Sensor
Type: Analog
Measurement: Water presence and level
Water Detection Range: Depends on the height and placement of the sensor
Accuracy: General-purpose, not highly precise
Output: Analog signal proportional to water level
Advantages: Simple to use, Cost-effective for basic water detection
Drawbacks: Limited accuracy, Requires analog input pin
Use Case: Ideal for water tank level monitoring, flood detection, and basic water presence sensing.
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
A) YL-83 Water Level Sensor
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors - A) YL-83 Water Level Sensor – Working Principle
• The YL-83 water level sensor works by detecting water contact using multiple conductive strips
(probes) on its sensor board.
• When water touches these conductive strips, the sensor measures the conductivity or resistance
between the strips. As the water level increases, more of the strips come into contact with water,
changing the resistance.
• This change in resistance is converted into an analog voltage output, where higher water levels produce
a higher voltage.
• The output is an analog signal that can be read by an Arduino or other microcontroller through an
analog input pin. The value from the sensor corresponds to the water level, and by calibrating the
sensor, you can map the voltage to actual water levels.
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
B) FC-28 Soil Moisture Sensor
Type: Analog (can also be digital with some models)
Measurement: Moisture level in soil (can also detect water presence)
Water Detection Range: Measures water content or moisture in soil
Accuracy: Moderate, varies with calibration
Output: Analog voltage proportional to moisture content (digital option also available)
Advantages: Low-cost solution, Useful for monitoring moisture levels in soil
Drawbacks: Prone to corrosion over time, Not highly accurate for precise water level detection
Use Case: Primarily used in automatic irrigation systems, plant soil moisture monitoring, and can be
adapted for water presence detection.
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
B) FC-28 Soil Moisture Sensor
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
B) FC-28 Soil Moisture Sensor – Working Principle
• The FC-28 soil moisture sensor measures the amount of moisture in the soil or water content by using
two probes that are inserted into the soil or liquid.
• The sensor operates by detecting changes in the conductivity between the two probes. When soil or
water is present, it changes the resistance between the probes, which affects the sensor's output.
• The sensor has a capacitive sensing element that provides a more reliable measurement compared to
resistive sensors. This capacitance-based measurement is less affected by corrosion and provides a
stable output.
• The output of the FC-28 is an analog voltage that varies with the moisture level. Higher moisture levels
decrease resistance, resulting in a higher voltage output.
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
C) Ultrasonic Sensor (JSN-SR04T)
Type: Digital
Measurement: Water level (distance to water surface)
Water Detection Range: Up to 4-5 meters, depending on sensor type
Accuracy: High precision for level measurement
Output: Digital pulse (time-based)
Advantages: Non-contact measurement, High accuracy for water level detection
Drawbacks Requires calibration and proper setup
Use Case: Ideal for water tank monitoring, reservoirs, and flood level detection without physical contact
with the liquid.
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
C) Ultrasonic Sensor (JSN-SR04T)
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
C) Ultrasonic Sensor (JSN-SR04T) – Working Principle
• The JSN-SR04T is an ultrasonic sensor designed for measuring distance to an object, which can be
adapted to measure water levels.The sensor emits ultrasonic sound waves from its transmitter.
• These sound waves travel through the air and reflect off the water surface or an object.
• The sensor has a built-in receiver that detects the reflected sound waves (echo).
• By measuring the time it takes for the sound waves to travel to the water surface and back, the sensor
calculates the distance to the surface.
• The distance is proportional to the time taken for the echo to return. This measurement is converted
into a digital signal and can be read by a microcontroller like Arduino.
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
D) Grove Water Level Sensor:
Type: Analog
Measurement: Water level detection
Water Detection Range: 10% to 100% water level (depending on the sensor's placement and length of
probes)
Accuracy: Moderate (provides an estimate of the water level based on the height of water contact)
Output: Analog signal proportional to the water level
Advantages: Easy to use and integrate with Arduino, Simple design for measuring water levels in tanks or
reservoirs, Cost-effective and efficient for basic water level monitoring
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
D) Grove Water Level Sensor:
Drawbacks: Susceptible to corrosion if used in harsh or long-term wet environmentsLimited precision for
highly accurate level measurements
Use Case: Ideal for water tank level monitoring, rainwater collection systems, and basic liquid level
detection in various applications where precision is not a primary concern.
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
D) Grove Water Sensor
Unit 3
Interfacing Sensors and Actuators
3. Water Sensors
D) Grove Water Level Sensor – Working Principle
• The Grove Water Level Sensor is designed to detect the level of water in a tank or other container.
• It operates by using conductive strips or probes that are mounted on the sensor's surface. These probes
are exposed to water and are spaced at specific intervals.
• As the water level rises, it comes into contact with more of the conductive strips.
• The contact between the water and the probes creates a change in electrical resistance or capacitance.
• This change is translated into an analog voltage output.
• The sensor generates a voltage that varies with the water level, where higher water levels result in a
higher output voltage.
Unit 3
Interfacing Sensors and Actuators
• When gases are present, the gas molecules interact with the surface of the sensor, causing a chemical
reaction that reduces the resistance of the sensor.
• As the gas concentration increases, the resistance decreases, producing a corresponding increase in the
output voltage.
• The sensor provides an analog output proportional to the gas concentration and can trigger a digital
output when the gas concentration exceeds a predefined threshold, adjustable via an onboard
potentiometer.
• The sensor must be preheated for a certain period to stabilize and provide accurate readings.
Unit 3
Interfacing Sensors and Actuators
4.1 Other Gas Sensors
Sensor Type Measurement Detection Range Accuracy Use Case
Moderate,
Gas concentration dependent on Gas leak detection,
MQ-2 Analog / Digital (LPG, methane, smoke, 200 to 10,000 ppm calibration and gas smoke alarms, air
propane, hydrogen) type quality monitoring
Moderate,
dependent on Breathalyzers, alcohol
Alcohol (Ethanol) vapor
MQ-3 Analog / Digital 0.05 to 10 mg/L calibration and detection in vehicles,
concentration
alcohol safety equipment
concentration
Moderate, Carbon monoxide
MQ-7 Analog / Digital Carbon monoxide (CO) 20 to 2000 ppm dependent on detectors, fire alarms,
calibration safety systems
Unit 3
Interfacing Sensors and Actuators
4.1 Other Gas Sensors
Sensor Type Measurement Detection Range Accuracy Use Case
CO and combustible 10 to 1000 ppm (CO), Moderate,
MQ-9 Analog / Digital gases (methane, 100 to 10,000 ppm dependent on Gas leak detectors,
propane, LPG) (combustible gases) calibration safety alarms
Air quality
Air quality (CO2, Moderate, monitoring,
MQ-135 Analog / Digital ammonia, alcohol, 10 to 1000 ppm for dependent on environmental
benzene, smoke) various gases calibration sensors, pollution
detection
Gas leak detection,
Moderate, safety alarms in
MQ-6 Analog / Digital LPG 200 to 10,000 ppm dependent on kitchens and
calibration industries
Unit 3
Interfacing Sensors and Actuators
5. PIR (Passive InfraRed) Sensors
Type: Digital
Measurement: Motion detection based on infrared radiation
Detection Range: Typically up to 7 meters (varies with sensor model)
Accuracy: High for detecting motion within its field of view
Output: Digital signal (high/low)
Advantages: Sensitive to changes in infrared radiation, making it effective for motion detection, Low power
consumption and simple to integrate into various projects, Cost-effective and widely available
Drawbacks: Limited to detecting motion; cannot identify the type of object or its exact distance,
Performance can be affected by environmental factors like temperature and lighting conditions
Use Case: Ideal for security systems, automatic lighting systems, and motion-activated devices
Unit 3
Interfacing Sensors and Actuators
5. PIR (Passive InfraRed) Sensors
Unit 3
Interfacing Sensors and Actuators
5. PIR (Passive InfraRed) Sensors
Working Principle:
• The PIR sensor detects infrared radiation emitted by objects based on their temperature, such as humans
or animals.
• The sensor consists of a pyroelectric element that generates a voltage when exposed to infrared
radiation.
• When a warm object (like a human) moves across the sensor's field of view, the amount of infrared
radiation detected changes.
• This change triggers the sensor to produce a digital output signal indicating motion detection.
• The sensor is designed to detect motion based on changes in infrared levels, not continuous infrared
levels.
Unit 3
Interfacing Sensors and Actuators
5. PIR (Passive InfraRed) Sensors
• Note: PIR sensors are passive, meaning they detect infrared radiation emitted by objects without actively
emitting any radiation themselves.
• Trigger modes: We have two trigger modes in the PIR sensor one is non-repeat mode and repeat mode
trigger. These two modes can be obtained by changing the jumper position given in the corner of the
module.
• Non-repeat Mode: When we use PIR in this mode, the output will go HIGH for the stipulated time and
then turn LOW. For example, If Output turns HIGH for 10 seconds, it will turn LOW after this time
period.
• Repeat Trigger Mode: In this mode when motion is detected the output will remain HIGH till it is
observing motion, whether the motion is by single person or multiple person.
Unit 3
Interfacing Sensors and Actuators
5. PIR (Passive InfraRed) Sensors
• Block Time: Block time is a period when the PIR sensor does not detect any motion. It is nearby
for 3 seconds. After this block time, the PIR is ready to work again.
• Delay Time Adjustment : There is a potentiometer to adjust the output to remain HIGH after
detecting the motion. We can adjust the time period from 5 seconds to 5 minutes.
• Sensitivity Adjustment: A potentiometer is given to adjust the sensitivity. We can vary it from 3
meters to 7 meters perpendicular to the sensor. The sensitivity reduces as we move either side of
the sensor. The angle of the detection area of PIR is around 110 degrees conic section.
Unit 3
Interfacing Sensors and Actuators
5. Ultrasonic Sensor (e.g., HC-SR04)
Type: Digital
Measurement: Distance to an object using ultrasonic sound waves
Detection Range: Typically 2 cm to 4 meters
Accuracy: High precision for distance measurement within its range
Output: Digital pulse (time-based)
Advantages: Non-contact measurement, making it ideal for detecting objects at a distance, High accuracy
and versatility for various applications, Widely used and cost-effective
Drawbacks: Performance can be affected by environmental factors such as temperature, humidity, and the
surface of the object being detected, Requires a clear line of sight to the object and may have limitations in
detecting objects with irregular shapes
Unit 3
Interfacing Sensors and Actuators
6. Comparison - Sensors
Sensor Type Measurement Detection Range Accuracy Use Case
6. Comparison - Sensors
Sensor Type Measurement Detection Range Accuracy Use Case
Gas concentration Moderate,
Gas leak detection,
Analog / (LPG, methane, 200 to 10,000 dependent on
MQ2 Gas Sensor smoke alarms, air
Digital smoke, propane, ppm calibration and
quality monitoring
hydrogen) gas type
Security systems,
Motion detection
Typically High for motion automatic lighting,
PIR Sensor Digital based on infrared
up to 7 meters detection motion-activated
radiation
devices
8. Actuators
• Actuators are devices that convert energy (usually electrical) into mechanical motion. They are
essential components in automation systems, robotics, industrial machinery, and consumer
electronics, enabling systems to move or control physical objects.
• Example: Automatic door opening, central door locking and window open / close in car.
Types of Actuators:
Electrical Actuators: Use electrical energy to produce motion.
Examples: Motors (DC/AC motors, stepper motors), Solenoids.
Unit 3
Interfacing Sensors and Actuators
8. Actuators
Working Principle:
• The basic function of an actuator is to take a control signal (e.g., from a microcontroller or sensor)
and produce physical movement, which can be linear or rotational depending on the type of
actuator.
• Electrical to mechanical: An electric signal causes the actuator to move a mechanical part (like
turning a shaft or pushing a piston).
• Energy conversion: Depending on the actuator type, energy is transformed (e.g., electrical to
magnetic in a motor, or fluid pressure to force in a hydraulic actuator)..
Unit 3
Interfacing Sensors and Actuators
8. Actuators
Common Applications:
• Robotics: To move arms, legs, or wheels.
• Automobiles: Power windows, door locks, throttle controls.
• Home Appliances: Opening/closing of valves in washing machines, microwave turntables.
• Industrial Automation: Conveyors, mechanical arms in manufacturing.
Unit 3
Interfacing Sensors and Actuators
8. Actuators
Key Characteristics:
• Speed: How quickly the actuator moves.
• Force: The amount of mechanical power the actuator can generate.
• Precision: How accurately the actuator can position an object.
• Control Method: Some actuators are controlled by digital signals, others by analog signals.
Unit 3
Interfacing Sensors and Actuators
9. Servo Motor
• Servos are motors that allow you to precisely
control physical movement because they generally
move to a position rather than continuously
rotating.
• They are simple to connect and control because
the motor driver is built right into them.
• Servos contain a small DC motor connected to the
output shaft through gears.
• The output shaft drives a servo horn and is also
linked to a potentiometer (pot).
Unit 3
Interfacing Sensors and Actuators
9. Servo Motor
• The potentiometer provides position feedback to
the error amplifier in the control unit, which
compares the current position of the motor to the
target position.
• In response to the error, the control unit adjusts the
motor’s current position so that it matches the
desired position.
• In control engineering, this mechanism is known as a servomechanism, or servo for short. It is a
closed-loop control system that uses negative feedback to adjust the motor’s speed and direction
to achieve the desired result.
Unit 3
Interfacing Sensors and Actuators
9. Servo Motor
• Pulses ranging from 1ms to 2ms will rotate the servo to a position proportional to the pulse width.
The animation below will help you understand the relationship between pulses and position.
Feedback:
• The feedback sensor constantly monitors the position of the motor shaft and adjusts it to match the
input signal. If the position differs from the commanded position, the motor corrects it by rotating
in the appropriate direction.
Unit 3
Interfacing Sensors and Actuators
• By increasing the number of magnetic poles on the rotor, we can increase the number of possible
stopping positions, thus increase the resolution or the precision of the motor.