0% found this document useful (0 votes)
124 views26 pages

Understanding Optical Sensors

The document discusses optical sensors, describing what they are, the different types including photoconductive devices, photovoltaic cells, and photodiodes. It then discusses optical pyrometers, explaining their construction, operating principle, working, advantages, and applications in measuring high temperatures.

Uploaded by

harshuvalvi0101
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views26 pages

Understanding Optical Sensors

The document discusses optical sensors, describing what they are, the different types including photoconductive devices, photovoltaic cells, and photodiodes. It then discusses optical pyrometers, explaining their construction, operating principle, working, advantages, and applications in measuring high temperatures.

Uploaded by

harshuvalvi0101
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Optical Sensor

An optical sensor converts light rays into an electronic signal. The purpose of
an optical sensor is to measure a physical quantity of light and, depending on
the type of sensor, then translates it into a form that is readable by an
integrated measuring device. Optical Sensors are used for contact-less
detection, counting or positioning of parts. Optical sensors can be either
internal or external. External sensors gather and transmit a required quantity
of light, while internal sensors are most often used to measure the bends and
other small changes in direction.
The measurands possible by different optical sensors are Temperature,
Velocity Liquid level, Pressure, Displacement (position), Vibrations, Chemical
species, Force radiation, pH- value, Strain, Acoustic field and Electric field
Types of Optical Sensors

There are different kinds of optical sensors, the most common types which we
have been using in our real world applications as given below.

 Photoconductive devices used to measure the resistance by


converting a change of incident light into a change of resistance.
 The photovoltaic cell (solar cell) converts an amount of incident light
into an output voltage.
 The Photodiodes convert an amount of incident light into an output
current.
Phototransistors are a type of bipolar transistor where the base-collector
junction is exposed to light. This results in the same behavior of a photodiode,
but with an internal gain.

The operating principle is the transmitting and receiving of light in an optical


sensor, the object to be detected reflects or interrupts a light beam sent out by
an emitting diode. Depending on the type of device, the interruption or
reflection of the light beam is evaluated. This makes it possible to detect
objects independently of the material they are constructed from (wood, metal,
plastic or other). Special devices even allow for a detection of transparent
objects or those with different colors or variations in contrast. Different types
of optical sensors as explained below.
Through-Beam Sensors
The system consists of two separate components the transmitter and the
receiver are placed opposite to each other. The transmitter projects a light
beam onto the receiver. An interruption of the light beam is interpreted as a
switch signal by the receiver. It is irrelevant where the interruption occurs.

Advantage: Large operating distances can be achieved and the recognition is


independent of the object’s surface structure, color or reflectivity.
To guarantee a high operational dependability it must be assured that the
object is sufficiently large to interrupt the light beam completely.

Retro-Reflective Sensors
Transmitter and receiver are both in the same house, through a reflector the
emitted light beam is directed back to the receiver. An interruption of the light
beam initiates a switching operation. Where the interruption occurs is of no
importance.
Advantage: Retro-reflective sensors enable large operating distances with
switching points, which are exactly reproducible requiring little mounting effort.
All objects interrupting the light beam are accurately detected independently
of their surface structure or color
Diffuse Reflection Sensors
Both transmitter and receiver are in one housing. The transmitted light is
reflected by the object to be detected.

Advantage: The diffused light intensity at the receiver serves as the switching
condition. Regardless of the sensitivity setting the rear part always reflects
better than the front part. This leads to the consequence to erroneous
switching operations.
OPTICAL PYROMETER
Definition: A temperature measuring device that is used to measure the
temperature of molten metal’s, overheated material, furnaces otherwise
liquids. It is one kind of measuring device of temperature with a non-contact.
The working principle of this optical pyrometer is to match the object’s
brightness of the filament within the device. By using contact type instruments,
measuring the temperature of the highly heated body is not possible. So this
non-contact type device is used to measure the temperature.

Optical Pyrometer Construction


The shape of the pyrometer is cylindrical and inside parts of
the optical pyrometer mainly include eyepiece, power source, absorption
screen, and red filter.
optical-
pyrometer-construction

 An eyepiece and the lens of an object are arranged at both sides of


the device.
 A battery, millivoltmeter & rheostat are connected to a temperature
bulb.
 An absorption screen is arranged in the middle of the reference
temperature lamp and the objective lens to increase the temperature
range and his range can be measured with the help of the device.
 The red filter is placed in between the lamp and eyepiece so that the
lamp allows simply a narrow band with 0.65mui wavelength.
Operating Principle
In an optical pyrometer, the temperature measurement principle is used by
comparing the brightness. A color disparity with the increase in temperature
can be taken as an index of the temperature. This type of pyrometer contrasts
the intensity of the generated image through a source of the temperature of
the lamp.

The current within the lamp is regulated until the lamp’s brightness is
equivalent to the image brightness generated through the source of
temperature. When the light intensity of any wavelength depends on the
temperature of the radiating object, then the flow of current through the lamp
becomes a measure of the temperature source when adjusted.
Optical Pyrometer Working
The optical pyrometer diagram is shown below. It includes the lens to focus on
the generated energy from the heated object and aims at the filament of the
lamp. The filament in the lamp mainly depends on the flow of current through
it. Therefore the changeable current can be supplied throughout the lamp.
The magnitude of the flow of current can be changed until the filament’s
intensity is similar to the intensity of the object. As the intensity of both the
filament and object are the same, then the filament outline can vanish
completely.

The filament in the bulb seems intense as its temperature is higher compare
with the temperature of the source. Similarly, the filament seems dim if their
temperature is lower than that necessary for equivalent brightness

Optical Pyrometer Advantages


The advantages of this pyrometer include the following.

 It is used for high temperatures.


 It is used to check the distant objects as well as moving the object’s
temperature.
 Accuracy
 It can be measured without connecting with the target.
 Less weight
 It is flexible and portable.
Optical Pyrometer Disadvantages
The disadvantages of this pyrometer include the following.

 Due to the radiation of thermal background, dust, and smoke, the


accuracy of this device can be affected.
 These do not apply to the temperature measuring of burning gases
because they do not emit visible energy.
 It is expensive.
 Manual type pyrometers are not suitable for evaluating the object’s
temperature under 8000C because, at less temperature, the
generated energy will be too low.
Applications
The applications of optical pyrometer include the following.
 It is used to measure the temperature of highly heated materials
 It is useful to measure furnace temperatures.
 It is used in critical process measurements of semiconductor,
medical, induction heat treating, crystal growth, furnace control, glass
manufacture, medical, etc
QUESTIONS.
 1). What is a pyrometer?
 A remote-sensing thermometer that is used to gauge the temperature of
a surface is known as a pyrometer.
 2). What is the function of an optical pyrometer?
 It is used to gauge non-contact high-temperature measurements in
several industrial applications.
 3). What is the working principle of pyrometer?
 The working principle of the pyrometer is to measure the temperature of
an object through detecting the energy or heat generated from the
target object without contact.
 4). What is the optical pyrometer range?
 The operating range of a typical pyrometer ranges from 700°C –
4,000°C
 5). What is the function of a red filter?
 A red filter is used between the eyepiece as well as the reference bulb
to help in narrowing the wavelengths band.

Magnetic Field Sensor


Magnetic sensors are the sensors that convert the change/ magnitude of a magnetic field into an electrical
signal. The Earth’s magnetic field or the magnetic field referred to as magnetism, is a well-known but
invisible phenomenon. Magnetic sensors convert invisible magnetic fields into electrical signals and help
to have visible effects. They were designed decades ago as a sensor using the electromagnetic induction
effect and has expanded into applications in the magneto-resistance effect, galvano-magnetic effect, the
Josephson effect, and other physical phenomena. This article gives a brief description of working, types,
and interfacing of a magnetic sensor.
Magnetic Sensor Definition

Magnetic sensors are the solid state devices used in detecting and sensing the distance, speed,
rotation, angle, and position by converting magnetic information into electrical signals. The
converted signals are processed by electrical circuits. These sensors became popular and used in
several applications because of their easy operation, and tolerance to high vibrations, water, and
dust.

Magnetic Sensor

These are used to detect the strength of the magnetic field and geo-magnetism generated due to
the current or magnet. The output of the magnetic sensors is used to monitor the direction,
location, revolution, angle, distance, speed, position, and the presence of electric current. The
magnetic sensors can detect the linear and rotatory motion of small iron objects without any
external power supply with high resolution. They can measure up to 6,00,000 rpm speed.

These are high-frequency sensors and the frequency usage can be limited by the impedance and
the external load. Magnetic field type sensors use an internal magnet or permanent magnet to
detect electromagnetic fields directly. The built-in magnetic sensor detects iron and generates an
analog or digital output signal. Reed switches, Hall switches, and other external magnetic sensors
detect the magnetic field of a magnet or electric coil. Also available in analog and digital
versions.

Magnetic Sensor Working Principle

The magnetic sensor working principle is based on the type of sensor element used. Any type of
magnetic sensor works with the magnetic field of the Earth. A simple magnetic sensor can detect
the moving ferrous. When an iron object is moved close to the coil Or wire wound on a
permanent magnet, then the magnetic flux through the coil changes and generates the voltage at
the terminals of the coil.
Working Principle Magnetic Sensor

Consider the coiled magnetic sensor, where the coil is used as a simple sensor element to
understand the working of a magnetic sensor. However, the coil is used to provide limited
functionality. So, it is combined with other magnetic materials coils, to construct a highly
sensitive magnetic sensor. The coils used in magnetic sensors in a wide range of applications
include fluxgate sensors, search coils, resolvers, rotation, and angle sensors.

The coil itself can’t be used to measure magnetic fields directly, but it can detect changes or
vibrations in the magnetic field. When the magnet is brought closer to the coil, the coil’s
magnetic flux density will increase. This results in creating the opposite forces in the form of an
induced current and electromotive force (EMF). When the movement of the coil stops, the
change in the magnetic flux density also stops, and the induced EMF and current stop.

Observe the induced EMF and the induced current, to determine the ratio of the change in
density and direction of the magnetic flux.
Types of Magnetic Sensors

The magnetic sensors are divided into various types based on the technology or elements used
such as fluxgates, coils, hall elements, light pumping, magnetoresistive, nuclear precession,
SQUID, magnetic tunnel junctions, giant magnetic impedance, piezoelectric component, optical
fibers, small electro-mechanical elements, etc. The different types of magnetic sensors are given
below.

Magnetoresistive type Magnetic Sensors

These sensors are used to measure electrical resistance as a function of the applied magnetic
field. It works on the principle of AMR (Anisotropic magneto-resistance) or MR (Magneto-
resistance) or GMR (giant magneto-resistive) or TMR (tunnel magneto-resistive) effect
developed by William Thomson in 1856, Albert Feet & Peter Grunberg in 1988 and Terunobu
Miyazaki professor in 1995.

Hall Effect Magnetic Sensors

These are used to convert the stored energy in a field of the magnet into an electrical signal with
the application of a voltage between the ends of a current-carrying wire whose sides are 90
degrees to the magnetic field. It works on the principle of the Hall effect developed by Edwin H
in 1879.

Fluxgate or Coiled type Magnetic Sensor

These sensors are used to measure the magnetic field difference at the vertical rod ends and then
display this data on a grid.

Magnetic Induction type Sensor

This sensor contains a coil surrounding a ferromagnetic core, the permeability of which varies
with the earth’s magnetic field of the Earth.

Overhauser Magnetic Sensors

These sensors are also called nuclear precession type sensors that combine a liquid electron-rich
with hydrogen and expose the mixture to an RF signal.

Precession Proton Magnetic Sensors

These sensors utilize liquids such as methanol, and kerosene with hydrogen atoms having high
density.
SQUID Magnetic Sensors

In SQUID Magnetic Sensors, the term “SQUID” stands for Superconducting Quantum
Interference Devices which are used to measure magnetic fields in a very low femto Tesla range.
These are sensitive type sensors and are used in medical, and neuroscientific, applications with
several magnetic field devices.

Optically Pumped Magnetic Sensor

An optically pumped magnetic sensor polarizes an alkaline gas with light with a particular
wavelength.

Magnetic Sensor Interfacing with Microcontroller using Arduino UNO

From the above information about magnetic sensors, now let’s know how to interface a magnetic
sensor with a microcontroller (ATMEGA328P) using Arduino UNO. Here the Hall effect
magnetic sensor in the form of A1104 IC is taken.

Pin Diagram Of Magnetic Sensor:

The hall effect magnetic sensor is the most widely used magnetic sensor in various applications
such as door open and close detection, docking detection, proximity sensing, pulse counting,
valve positioning, automotive systems, etc. The pin diagram of the hall effect magnetic sensor
module is shown below.

Magnetic Sensor Module Pin Configuration


Pin 1:VCC (+): This pin refers to the supply pin, which is used to supply the power to the
module.

Pin 2: GND (-): This pin refers to the common ground connection.

Pin 3: AO: (Analog Out): This pin refers to the analog output, which is connected to the analog
pin of the microcontroller directly.

Pin 4: DO: (Digital Out): This pin refers to the digital output, which is connected to the digital
pin of the microcontroller directly.

Now let’s know briefly about A1004 Hall effect magnetic sensor IC.

Magnetic Sensor Interfacing

Hall sensor ICs are magnetically activated non-contact trigger switches used in various
applications such as computers, security systems, automobiles, control systems, and many more.
The Hall effect IC A1104 is from Allegro MicroSystems, available in 3-pin SOT23 and SIP
packages. It is based on BiCMOS technology, which combines the advantages of the
technologies of bipolar and CMOS.
The main components of the A1104 Hall Effect magnetic sensor IC are a voltage regulator, a
Hall effect sensor, a low power signal amplifier, a Schmitt trigger, and an output NMOS
transistor. It is used to detect the moment, change, and position in the strength of the magnetic
field of either an electromagnetic or permanent magnet or ferromagnetic materials.

The Hall effect chip A1104 has 3 pins: VCC, GND, and OUT.

 VCC: Provides a positive power supply to the chip from 3.8V to 24V.
 GND: Ground connection
 OUT: IC output pin.

The circuit diagram of interfacing the Hall effect magnetic sensor with the microcontroller using
Arduino UNO is shown below. The components required are,

 Hall-effect magnetic sensor IC A1104.


 Arduino UNO board.
 Resistors of 10kiloOhms and 1kiloOhm.
 LED.
 Breadboard.
 Connecting wires.

Connections are made as per the above circuit diagram. The VCC and GND pins of A1104 are
connected to +5V and GND pins of Arduino UNO. The OUT pin or Hall pin of A1104 is pulled
to HIGH with a resistor of 10 Kilo Ohms and connected to digital pin 2 of Arduino. To represent
the output LED is connected to digital pin 10 of Arduino through a resistor of 1kiloOhms.

When a magnetic field is applied near to the Hall Effect A1104 IC, the output pin (OUT) of the
Hall effect magnetic sensor IC goes LOW. This change is recognized by the Arduino and
activates the corresponding LED.

Upload the Arduino code and observe the results on the monitor.

Arduino Code:

const int ledPin = 10;

const int hallPin = 2;

volatile bool ledState = LOW;

void setup()

pinMode(ledPin,OUTPUT);

pinMode(hallPin,INPUT);
attachInterrupt(digitalPinToInterrupt(hallPin), hall_ISR, CHANGE

FLOW SENSOR
A flow sensor definition is a sensor that is used to measure a fluid like liquid or gas.
These sensors mainly use both electrical and mechanical subsystems to gauge changes within the
physical attributes of fluid & measure its flow. So measuring these mainly depends on the
physical attributes of fluid. A flow sensor is an electronic device that measures the changes in
liquids flow rate & gasses in tubes & pipes.

The flow sensor working principle is based on Bernoulli’s principle. This principle states that
the drop of pressure across the meter is simply proportional to the square of the rate of flow. The
most common way to determine the measurement of a flow is by using the pressure drop across
the cross-section of the pipe.

Flow Sensor Types

Flow sensors are categorized into three types like the following.

 Positive displacement flow sensors.


 Mass flow sensors.
 Velocity flow sensors.

Positive Displacement Sensor

These types of flow sensors are very unique as compared to other types because they measure the
fluid’s volume directly when passing through the device. Other types of flow sensors do not
measure the rate of flow directly instead of measuring pressure, it is used to derive the flow rate.

Positive Displacement Flow Sensor


In this kind of sensor, the volume of known fluid is trapped & moved throughout the rotary parts.
It turns the components & once it completes a complete revolution, then it is guessed as the
volume of known fluid supplied throughout the sensor. Counting the revolutions which occur for
each unit time setups the fluid volume supplied for each unit time. As the flow of fluid moves the
components directly, then rotating velocity is proportional directly to the rate of flow.

These flow sensors can work over a broad range of fluid viscosities; they have less maintenance
& provide an electronic & mechanical interface. These sensors are used in the measurement of
gasoline, oils, hydraulic liquid, and water and gas meters installed at home.

Mass Flow Sensor

A mass flow sensor measures the flow rate of fluid or the amount of fluid or gas flowing
throughout a pipe by simply determining the mass for each unit of time. These sensors are
extensively used in automobiles, wherever they are utilized to measure the air inflowing the air
intake system of an inside combustion engine. They work by simply measuring the energy
transfer from a heated surface to a flowing liquid. These sensors are also available in two types
thermal & Coriolis flowmeter.

Mass Flow Sensor

The advantages of this sensor are; liquid flow can be measured directly with high accuracy,
applicable for an extensive range of fluids like highly viscous fluids, and flow measurement can
be done bidirectionally.

Velocity Flow Sensor

Velocity flow sensors are used for detecting the liquid flow speed by simply determining the
fluid’s velocity flowing throughout the sensor. These kinds of sensors are available in different
types like mechanical, electromagnetic & ultrasonic which are discussed below.
Velocity Flow Sensor
Mechanical Velocity Flow Sensor

In a mechanical velocity flow sensor, a rotary mechanical device like a paddle wheel is arranged
on a bearing that extends from the flow sensor & directly sits within the flow path. When the
fluid moves, the paddle wheel rotates & its rotation is simply detected by a sensor like an
infrared sensor, magnetic coil, or Hall effect. The flow sensor electronics converts the
revolutions into an o/p signal like a rectangular wave signal that can be simply programmed to
signify a specified volume output for each unit time.

The advantages of these flow sensors are compact, expensive with a simple working principle &
also use very small energy to function. These sensors work with a broad range of fluids. The
main drawbacks are; this sensor uses moving parts that may build up contagion from liquids that
are not hygienic so that its operation can be obstructed & needs maintenance.

Electromagnetic Flow Sensor

Sometimes, these flow sensors are also known as magnetic flow/ EMF flow sensors which
operate on Faraday’s law of induction principle. These sensors mainly include a coil that induces
a magnetic field within the liquid being measured and after that, it uses a set of electrodes to
determine the induced voltage that results from the conductive liquid flow throughout the
magnetic field.
Electromagnetic Type

The induced voltage is proportional to the fluid’s velocity within the pipe. The measurement of
velocity is changed into a volumetric flow rate if we know the velocity & dimensions of the
cross-section of the pipe.

These sensors mainly need that the liquid being measured to have the least conductivity and have
the benefit of not inducing a pressure drop within the pipe. Whenever they are appropriate for
fluids that contain some amount of contamination, then they do not work with non-conductive
fluids such as steam, gas, or oil. These types of flow sensors are not suitable to use within
vacuum conditions, the fluids which have abrasive characteristics & fluids that may contain
ferromagnetic particles.

Ultrasonic Flow Sensor

These sensors use two different approaches to work. In the primary approach, an
ultrasonic transducer pair produces a signal that is simply directed into the fluid flow from two
locations. Every signal produced by a transmitter can be simply reflected back to the other
transducer’s receiver with a set of mirrors. The direction of the transducers & mirrors is; one
signal is transmitted through its path by the flow of fluid whereas the other is transmitted against
the flow of fluid.
Ultrasonic Type

The receiver electronics simply measure each signal’s transit time & measures the time variation
between the two. Once the fluid is not in movement, then transit times are similar for every
signal. When the fluid is in motion, then the signal moves with the fluid flow which will have
less transit time, so the variation between the two transit times of the signal reflects the fluid’s
velocity. Sometimes, these kinds of sensors are called transit time ultrasonic flow sensors.

In a second approach, ultrasonic force is simply transmitted into the liquid & is reproduced back
to a receiver. In the zero-flow state, the ultrasonic wave frequency is not changed. Once the fluid
is in motion, then there is a change in frequency that simply occurs as an outcome of the Doppler
Effect. This effect is linear with respect to the velocity of the fluid. So, detecting & reporting the
shift within ultrasonic frequency simply allows for the calculation of the flow rate of the fluid.
These sensors are applicable for both conductive & non-conductive liquids and they can handle
high pressures & temperatures.

Flow Sensor Vs Pressure Sensor

The differences between the flow sensor and the pressure sensor include the following.

Flow Sensor Pressure Sensor

The flow sensor is used to detect the flow rate of The pressure sensor is used to detect the pressure

fluids. of fluids and gases.

These sensors are available in three types These sensors are available in seven types strain

Positive displacement, mass flow & velocity gauge, piezoelectric, capacitive, manometer,

flow. vacuum, bourdon, and aneroid.


A pressure sensor is alternatively known as
This sensor is most commonly known as a flow
pressure transmitters, transducers, senders,
meter.
indicators, manometers & piezometers

This sensor is used in many medical,

These are normally used in medical devices, automotive, consumer, building devices, and

chemical factories, HVAC systems, etc. industries that depend on stable & precise

pressure measurements to function consistently.

Flow Sensor Interfacing with Microcontroller/Flow Sensor with Arduino

The flow sensor interfacing with the microcontroller is discussed below. Here, the flow sensor
used is YF-S201 with any type of microcontrollers like Arduino, Pic microcontroller, STM32
Blue Pill, ESP32, 8051 microcontrollers, ESP8266, or Raspberry Pi for measuring water flow
rate.

Monitoring water flow is very significant in different applications such as a watering system for
plants within your home garden and food processing & complex pharmaceutical industries. So
water flow sensors help in measuring the liquid flow rate where the flow rate is the volume of
water supplies throughout a sensor for each unit of time.

There are different types of water flow sensors available and these sensors are nearly similar
except for the variation in the range of flow rate, length, operating range of voltage, material, and
size but their interfacing and working principle process will be the same.

YF-S201 water flow sensor is mainly designed for measuring the water flow rate & amount of
the required fluid throughout the pipes. This sensor is available at a low cost and includes a
copper body as well as a water rotor. Additionally, it also includes an internal Hall effect sensor
circuit that functions on the electromagnetism principle & provides signals at the o/p pin. This
sensor is compatible with MCU with 30 liters for each minute maximum flow rate.

YF-S201 Flow Sensor Pin Configuration

The Pin configuration of the YF-S201 flow sensor is shown below. This sensor includes three
pins and each pin and its functionality is discussed below.
YF-S201 Flow Sensor Pinout

 Pin1 (RED): This is a positive (+) supply wire.


 Pin2 (BLACK): This is a negative (-) supply wire.
 Pin3 (YELLOW): This is an o/p voltage wire.

Features & Specifications

The features and specifications of the YF-S201 flow sensor include the following.

 The operating voltage of this sensor ranges from 5 to 24 V.


 Normal voltage ranges from 5V to 18 V.
 The maximum current is 15 mA at 5V.
 The capacity of the load is ≤10 mA Volts at 5V.
 The capacity of flow rate is 1 to 30 Liters per min.
 Electric strength is 1250 V/min.
 Range of water pressure is ≤ 1.75 MPa
 The operating temperature is ≤ 800C.
 The operating liquid temperature is ≤ 1200C.
 The range of humidity is 35% to 90% RH.
 Insulation resistance is ≥ 100 Mohms.

Generally, a water flow sensor includes a turbine wheel or water rotor and a hall effect sensor.
The water enters through one of the ends & leaves from another end of the sensor. Once water is
supplied through this sensor, then it hits the wheel of the turbine & rotates the turbine wheel. The
turbine’s speed has a direct relation to the rate of the water flow throughout the water flow
sensor. On every complete revolution of the wheel of the turbine, a hall-effect sensor generates a
pulse that emerges on the signal o/p pin. So, the number of appeared pulses on the signal o/p pin
is directly proportional to the turbine’s rotating speed.
YF-S201 is made with a plastic body that includes a rotor, valve & a Hall effect sensor. These
sensors work on the principle of the Hall effect & generate the flow rate & volume in the pulses
form on the signal pin.

The below section shows how to interface the YF-S201 Water Flow Sensor with an Arduino
Uno . It can be interface with the other microcontroller as well the same way but pins only need
to be changed.

Interfacing of the YF-S201 Water Flow Sensor with an Arduino Uno microcontroller
Connection Diagram

In this example, we will use digital I/O pin-2 of Arduino as an external interrupt capture pin to
count the number of pulses.

Connect the YF-S201 water sensor’s power supply pins to the GND & Arduino’s 5V pins.

The yellow color wire (o/p voltage wire) to the Arduino’s ‘D2’ digital pin to detect the electric
pulses.

Flow Sensor Interfacing with Arduino


Code

This Arduino interfacing with the water flow sensor simply measures the flow rate of water in
units of a liter for each hour & displays the measured value on the Arduino IDE serial monitor.

/*YF- S201 water Flow sensor code for Arduino */


const int Output_Pin = 2;
volatile int Pulse_Count;
unsigned int Liter_per_hour;
unsigned long Current_Time, Loop_Time;
void setup()
{
pinMode(Output_Pin, INPUT);
[Link](9600);
attachInterrupt(0, Detect_Rising_Edge, RISING);

Current_Time = millis();
Loop_Time = Current_Time;
}
void loop ()
{
Current_Time = millis();
if(Current_Time >= (Loop_Time + 1000))
{
Loop_Time = Current_Time;
Liter_per_hour = (Pulse_Count * 60 / 7.5);
Pulse_Count = 0;
[Link](Liter_per_hour, DEC);
[Link](” Liter/hour”);
}
}
void Detect_Rising_Edge ()
{
Pulse_Count++;
}

To test the above interfacing, copy the above Arduino code to Arduino IDE & upload it to your
Arduino board. Later, open the serial monitor & set the baud rate to 9600. So, we can notice the
measured values over the serial monitor:

The o/p of this project is to show the amount of water supplied throughout the sensor within
liters for each hour. To get this, there is a calculation. Since the sensor’s output is a pulse, so by
calculating the pulse frequency, we can simply measure the amount of water supplied throughout
the sensor. The frequency of pulse within Hz is 7.5 * Water Flow Rate in Litres for each minute.
Thus, the water quantity in Litres for each Hour is Pulse Frequency x 60 / 7.5.
Advantages

The advantages of flow sensors include the following.

 Response time is very fast.


 Small mass flow rates.
 Detection of the direction of flow.
 Power consumption is low.
 Thermal mass is small.
 Its design is robust.
 The performance ratio of price is best.
 Less maintenance although still simple to maintain.
 No extra pressure drop.

Disadvantages

The disadvantages of flow sensors include the following.

 It is used for only liquids/gases.


 Not suitable for highly contaminated liquids.
 Gas bubbles can cause errors.
 These sensors are vibration sensitive when not properly installed.
 Installation cost & its maintenance is high.
 Prone to corrosion through water-based fluids
 Expensive due to its complex [Link] very clean fluid.
 Low-density liquids cannot measure.

Applications

The applications of flow sensors include the following.

 The flow sensor is used to measure the amount of liquid flowing throughout it. So this can be
utilized in many industrial & commercial applications.
 This sensor is mainly used for indicating the amount of fluid or gas moving throughout a pipe or
medium by measuring mass, linear, volumetric, and non-linear flow rates.
 Generally, these types of sensors are commonly used in medical devices, HVAC systems, septic
systems & chemical factories. These sensors are capable of detecting blockages, leaks, pipe
bursts & changes within a concentration of liquid because of pollution or contamination.
 These sensors are used in automobiles to gauge the air intake to the engine & regulate the
delivery to fuel injectors in order to attain the mixture of desired fuel to the engine.
 These sensors are used in medical ventilators to establish the correct rate of delivery of air
otherwise oxygen to patients for support through respiration.

What is a Displacement Sensor?


What is a displacement sensor? A displacement sensor is a device used for measuring positional
movement or detecting the movement of a given object, these movements can be in either a
linear or rotary fashion.

Displacement sensors, also known as position sensors, are a very common type of sensor. They
are used throughout many industries and can be found all around us.

Displacement sensors are available in different types, different shapes and different sizes to suit
different applications.

What is a Displacement Sensor Used For?


Displacement sensors are widely used. Some of the most common industries for displacement
sensors are; Motorsport, automotive, industrial applications, agriculture, aerospace, robotics and
many more.

Some example applications using position sensors are;

Automotive and Motorsport – in this industry, displacement sensors can be used for steering
systems on agricultural machinery, electric cart throttle control, the suspension on bikes and
many other applications.

Factory Automation – displacement sensors can be used for conveyor speed measurement,
labelling machines and control, printing processes and packaging.

Medical Applications – displacement sensors are used on medical pieces of machinery such as
MRI or oncology machines.

Security Applications - displacement sensors can be used in security applications, for example,
monitoring the angle of a CCTV camera.

Barriers and bridges – displacement sensors are used to position various types of barriers; these
could be for pedestrians or vehicles. Moving bridges and ramps also use displacement sensors to
control the positions they are fixated in.

Other applications – displacement sensors can also be used for; elevator position, special
effects in film and TV, for use on Segways and other transportation devices, various renewable
energy applications, baking machines, paper mills and many others.

Types of Displacement Sensor


Displacement sensors are available in different types. The main two types of displacement sensor
are linear and rotary. Within these categories there are other types of displacement sensor, this is
down to the technology used within the sensor. There are many different types of technology
used in displacement sensors, some of these are contacting and others are non-contacting.

Linear Displacement Sensors

Linear displacement sensors measure movements which occur along a single axis, this can be left
to right or up and down. They use a range of technologies and have different outputs depending
on the application requirements.

Rotary Displacement Sensors

Rotary displacement sensors are used for measuring turning movements. They transform rotary
movements into output signals. Rotary displacement sensors can be used for either clockwise or
anti-clockwise movements and can be single turn for motion ranges under 360° or multiturn for
larger movements than this.

Contacting Displacement Sensors

Contacting displacement sensors use a technology where the sensor encounters the given object
and the components inside also come into physical contact with each other to measure
displacement.

Potentiometer – also known as “pots” are a contacting technology using a slider and a resistive
track to monitor displacement. Potentiometers can be either linear and rotary and we have a
range of each on our website.

Cable extension transducers – cable extension transducers are a type of linear potentiometer,
but they use a flexible cable and a spool to measure long range linear position.

Non-Contacting Displacement Sensors

Non-contacting displacement sensors have no touching parts. This eliminates the friction as well
as the wear and tear giving the sensor longer – and sometimes infinite life.

We have a variety of non-contacting technologies in our displacement sensor portfolio. Some of


these are;

Hall effect – Hall effect tends to be used for rotary sensors but can also be used in linear sensors,
we have our own range of Hall effect rotary sensors which are available as standard or micro
size.

Inductive sensors – this technology uses alternating currents and is used to measure linear
displacement.

Encoders – shafted or hollow shaft encoders are used for monitoring and controlling rotary
position, they can be absolute or incremental.
Positek PIPS – this technology comes from Positek, one of our sister companies; it is a non-
contacting technology for either linear or rotary displacement.

LVDT and RVDT – Linear or Rotary variable differential transformers which use an iron core
and copper coils to measure displacement.

You might also like