24
Dr.Y.NARASIMHA MURTHY Ph.D [email protected] Sensors and Interfacing techniques Introduction Sensors are sophisticated devices which will detect and measure any non-electrical physical quantity .A Sensor converts the physical parameter (for example: temperature, blood pressure, humidity, speed, etc.) into a signal which can be measured electrically. Sensor is sometimes called a primary measuring element, which can be found simply as a mercury thermometer to measure the temperature. It may be embedded in the transducer to perform its function. That means the transducer consists of a primary element (sensor) plus a secondary element (signal conditioning circuit) that transforms the passive change or small voltage signal into active signal range that can be easily used in other chains of the control loop. So, we can write that Transducer = Sensor + Signal conditioning circuit The important characteristics of sensors are Accuracy :High accuracy is needed Environmental condition – The performance of the sensor should not depend on environmental conditions like temperature or humidity etc.. Wide Range –.Measurement limit of sensor . The range should be high. Calibration - Essential for most of the measuring devices as the readings changes with time 1

Sensors-Interfacing Techniques

Embed Size (px)

DESCRIPTION

This class notes is intended for Electronics students of SKU and other ECE students of all universities

Citation preview

Page 1: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

Sensors and Interfacing techniques

Introduction

Sensors are sophisticated devices which will detect and measure any non-electrical physical

quantity .A Sensor converts the physical parameter (for example: temperature, blood pressure,

humidity, speed, etc.) into a signal which can be measured electrically.

Sensor is sometimes called a primary measuring element, which can be found simply as a

mercury thermometer to measure the temperature. It may be embedded in the transducer to

perform its function. That means the transducer consists of a primary element (sensor) plus a

secondary element (signal conditioning circuit) that transforms the passive change or small

voltage signal into active signal range that can be easily used in other chains of the control loop.

So, we can write that

Transducer = Sensor + Signal conditioning circuit

The important characteristics of sensors are

Accuracy :High accuracy is needed Environmental condition – The performance of the sensor should not depend on

environmental conditions like temperature or humidity etc.. Wide Range –.Measurement limit of sensor . The range should be high. Calibration - Essential for most of the measuring devices as the readings changes with

time Resolution – Sensor must be able to detect even small changes in the input signal. Cost- Sensor should not be very expensive. Repeatability – The sensor must be able to reproduce the same output at similar

conditions. Linearity : The output of the sensor must be linear .

There are various types of sensors available , which measures various physical parameters.

Sensor type Physical Parameter

Temperature Temperature

Light Light / dark

Pressure Pressure or barometric pressure or blood pressure

Moisture amount of moisture present in air

1

Page 2: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

Water-level How full / empty a container is

Movement Movement nearby

Proximity How close or far something is

Types of Sensors : Based on the principle of working the sensors are divided into

Resistor type Capacitor Type & Inductor type etc..

Resistor type Sensors: A sensor whose resistance changes with the input signal .i.e based on the

vatiation of the resistance of the sensor element , the physical parameter is detected.

For example , Themistor , Platinum resistance thermometer or Thermocouple etc.. are used to measure the temperature with respect to the variation in the resistance of the material. In the case of a thermistor the temperature is given by

R t = R0.e β (1/T - 1/T0

) Here ,β is the constant of the thermistor. Rt is the

resistance of the thermistor at a temperature t. The variation of resistance of a thermistor with

temperature is given by the following graph.

A strain gauge is a thin metal foil that changes resistance with applied strain. Strain gauges are

the preferred choice in stress analysis due to their small size and relatively low cost. Strain

gauges can measure strain levels from a few micro-strain (μe) to over 100,000 micro-strain.

2

Page 3: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

The changes of resistance associated with strain gauges are small and present measurement

situation. A Wheatstone bridge arrangement is commonly used to measure the small changes

in resistance associated with strain gauges.

Capacitive type Sensors: These sensors work on the principle of variation of capacitance with

the external input signal.

The basic operation of capacitive type sensors can be seen from the familiar equation for aparallel-plate capacitor.

C = Kε0 A /d

Here K is the dielectric constant of the material, ε0 is the permittivity of the free space and d is

the distance between the parallel plates and A is the area of cross section.

The capacitive type sensors are used to detect the physical parameters like Humidity or pressure

or proximity etc..

Inductive type Sensors: These sensors are based on the principle that the inductance of a coil

varies with the change input signal.

For example, if a permeable core is inserted into an inductor the net inductance is increases.

The best example is the LVDT (Linear Variable Differential Transducer) which is used to

measure displacements accurately. LVDTs can measure displacements from a few microns to

several feet in a wide variety of environments.

Inductive proximity sensors use an electromagnetic field to detect the presence of metal objects.

Inductive proximity sensors are available in a variety of sizes and configurations to meet varying

applications. The sensor incorporates an electromagnetic coil which is used to detect the

presence of a conductive metal object. The sensor will ignore the presence of an object if it is not

metal.

Limitations of Sensors : The sensors have certain limitations based on their working and construction.

Some sensors require complex signal conditioning circuitry. The output of the certain ssensors is not linear and hence additional circuitry is needed. The response time of sensors is some times very high

3

Page 4: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

The size of some sensors is large and occupies more space. Many times a sensor may respond to more than to one parameter. For example, gas

sensors respond to more than one gas at a time. Reliability of a sensor is also a serious problem in some cases.

Need and Advantages of IC sensors: With the developments in semiconductor technology and

with the advent of high speed processors ,the need of IC sensors is rapidly increasing. The

Integrated sensors provide significant advantages in terms of overall size and the ability to use

small signals from the transduction element.

(i)They do not require complicated signal conditioning circuitry.

(ii).The response time of IC sensors is low.

(iii).The IC sensors are also more stable and accurate.

(iv).The response of IC sensors is more linear than normal sensors.

(v).The IC sensors support many latest communication protocols(I2C , SPI ,Single wire pulse

width modulation etc..), so that they can be interfaced easily with microprocessors and

microcontrollers.

(vi).Provide better noise immunity.

(vii)The smart sensors available today will also provide an alert when the sensed value exceeds

certain critical value.

(viii).IC Sensors are relatively simple and inexpensive.

Interfacing of temperature Sensor LM 35:The LM35 series sensors are precision integrated-circuit temperature sensors, whose output

voltage is linearly proportional to the Centigrade temperature. It gives 10mV of output voltage

for every 10C. The LM35 does not require any external calibration or trimming to provide typical

accuracies of ±¼°C at room temperature and ±¾°C over a full -55 to +150°C temperature range.

The LM35's low output impedance, linear output, and precise inherent calibration make

interfacing to readout or control circuitry especially easy. It can be used with single power

supplies, or with dual supplies. As it draws only 60 µA from its supply, it has very low self-

heating, less than 0.1°C in still air. The LM35 is rated to operate over a -55° to +150°C

temperature range. The LM35 IC sensor is available at a Low cost .

LM35 is a three terminal IC with ,Vcc ,Ground & Vout .

4

Page 5: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

The LM 35 IC gives a 10mV analog output voltage for every degree Celsius change in

temperature. The Output of the temperature sensor is analog in nature so we need an analog to

digital converter for converting the analog input to its equivalent binary output.

Since the output of LM35 is analog voltage, it should be converted into digital before it is

applied to a microcontroller port pin. So,with proper circuitry an ADC chip is used as shown

below.

As shown in the circuit ADC0809 is used to convert the analog voltage into its equivalent digital

voltage.For this necessary signal conditioning circuit is developed using an operational

amplifier.The ADC0809 is an 8-input channel system. A clock signal of 100KHz is applied.The

5

Page 6: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

voltage drop across the LM Zener is buffered by an op-amp LM741to produce a V cc and Vref

of around 5V to 12Vfor the A/D converter .With this reference voltage the A/D converter will

have 256 steps of 20mV each. Since the temperature sensor signal is amplified by 2 ,each degree

Celsius of temperature change will produce an output change of 20mV.or one step on the A/D

converter. This gives us a resolution of 10C ,which is about the typical accuracy of the

sensor.The advantage of using Vref as Vcc for the device is that this voltage will not have the

switching noise that the digital Vcc lines have. The control inputs and data outputs of the ADC

are connected to the Ports of the Microcontroller as shown in the circuit.

A relay is used to control the temperature. When the temperature of the bath is reached a set

temperature, the microcontroller sends a High bit to the relay so that the Relay will switch off the

power supply to the heater and automatically the temperature starts decreasing. The vice- versa

takes place when the temperature falls below the set value.

A 2x16 LCD module is interfaced to the Microcontroller to display the temperature .Suitable

program is developed to control and measure the temperature. The temperature at which the

water bath is to be maintained is set as (Ts).The measured temperature is compared with this Ts

and if measured temperature is higher than the set temperature, a signal is sent to the relay to

switch-off the power. Otherwise the power is switched on. This temperature is displayed on

the LCD module.

Assembly Language Program :

Address(Hex) Label Mnemonics Operands Comments

9000 START SETB P3.4 Send ALE & SOC high

NOP No operation

NOP No operation

CLR P3.4 ALE &SOC low

LOOP1 JNB P3.5 , LOOP1 Is conversion over ?

MOV A,P1 Read digital data

CLR C Clear carry bit

SUBB A,#SET POINT Compare the measured with

Set temp.

6

Page 7: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

JNC OFF

ON SETB P3.0 Switch on heater

CALL CONV Convert the hex value into

Decimal value

CALL DISPLAY Display subroutine to display

temp .on LCD

OFF CLRB P3.0 Switch off heater

SJMP START Start sensing the temperature

DISPLAY LCALL 675F

MOV R7, #00

MOV A, #Set point

MOV R6,60H Display set temp.

RET Return to main program

Interfacing of Humidity Sensor : A humidity sensor measures the relative humidity and expressed as a percent (RH %). It is

the ratio of actual moisture in the air to the highest amount of moisture in air can hold at that

temperature. The most common type of humidity sensor used is the “capacitive sensor.” This

sensor is based on electrical capacitance . The sensor is composed of two metal plates with a

non-conductive polymer film between them. The film collects moisture from the air, and the

moisture causes minute changes in the voltage between the two plates. The changes in voltage

are used to know the amount of moisture in the air. Humidity sensors are of three types.

Resistive, Capacitive, and Thermal Conductivity sensing. Resistive sensors are useful in

remote locations. Capacitive sensors are useful for wide RH range and condensation tolerance.

Thermal conductivity sensors are beneficial in corrosive environments that have high

temperatures.

The SY-HS-220 series Humidity sensor is a simple to use sensor based on capacitive technology.

This module converts relative humidity to output voltage. Its operating voltage is 5V DC. Its

operating temperature is 0 - 60˚ C and its operating humidity is 30- 90% RH. Its standard out put

at 25˚C and 60%RH is 1980mV DC.

7

Page 8: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

The circuit details of the humidity sensor are given in Fig.below.This is a three pin IC sensor .

Among the three pins one is (B) connected to ground, the other (R) is to +5 volts and the third

one (W) gives the analog output voltage based on the humidity levels.

The interfacing of Humidity sensor with 8051 microcontroller using ADC0809 is shown below.

Interfacing of Pressure Sensor :

8

Page 9: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

Pressure Sensors convert absolute atmospheric pressure into a linear, proportional voltage, which

may be used in any meteorological application. Pressure sensors can be classified in terms of

pressure ranges they measure, temperature ranges of operation, and most importantly the type of

pressure they measure.In terms of pressure type, pressure sensors can be divided into five

categories.

Absolute pressure sensorThis sensor measures the pressure relative to perfect vacuum pressure (0 PSI or no

pressure). Atmospheric pressure, is 101.325 kPa (14.7 PSI) at sea level with reference to vacuum.

Gauge pressure sensorThis sensor is used in different applications because it can be calibrated to measure the

pressure relative to a given atmospheric pressure at a given location. A tire pressure gauge is an

example of gauge pressure indication. When the tire pressure gauge reads 0 PSI, there is really

14.7 PSI (atmospheric pressure) in the tire.

Vacuum pressure sensorThis sensor is used to measure pressure less than the atmospheric pressure at a given

location. This has the potential to cause some confusion as industry may refer to a vacuum

sensor as one which is referenced to either atmospheric pressure (i.e. measure Negative gauge

pressure) or relative to absolute vacuum.

Differential pressure sensorThis sensor measures the difference between two or more pressures introduced as inputs

to the sensing unit, for example, measuring the pressure drop across an oil filter. Differential pressure is also used to measure flow or level in pressurized vessels.

Sealed pressure sensorThis sensor is the same as the gauge pressure sensor except that it is previously calibrated

by manufacturers to measure pressure relative to sea level pressure.

The NPC-1220 is a solid state IC Pressure Sensor used to measure pressure.series of solid state

pressure sensors are designed to provide a cost effective solution for applications that require

calibrated performance over a wide temperature range. Packaged in a dual-in-line configuration,

the NPC-1220 series is intended for printed circuit board mounting. The NPC-1220 offers the

added advantage of superior temperature performance over the temperature compensated range

of 0°C to +60°C.

9

Page 10: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

NPC-1220 sensor is available as an 8-pin DIP chip and the circuit connections of this pressure

sensor are given below.

To interface the pressure sensor with a microcontroller ,a signal conditioning circuit is

necessary. The signal conditioning circuit is shown below. The signal conditioning of the

pressure sensor consists of LM324 operational amplifiers, which are high gain, internally

frequency compensated amplifiers designed specifically to operate from a single power supply

over a wide voltage range. The analog output voltage of the sensor is given to ADC. The

pressure sensor generates 0 to 50 mV of output voltage for a 0- to 15-psi pressure range.

10

Page 11: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

The interfacing circuit of the Pressure sensor NPC1220 to the Microcontroller using ADC0809 is

shown below.

Interfacing of Proximity Sensor :A proximity sensor is used to detect an object when the object approaches within the detection

range of the sensor. Proximity sensors are mainly used for detecting the approach of metal

11

Page 12: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

objects. There are various types of proximity sensors that are used for detecting the presence or

absence of an object. The design of a proximity sensor can be based on principles like variable

reluctance, eddy current loss, saturated core, and Hall effect etc..

Common types of non-contact proximity sensors include inductive proximity sensors,

capacitive proximity sensors, ultrasonic proximity sensors, and photoelectric sensors. Hall-effect

sensors detect a change in a polarity of a magnetic field. Variable reluctance sensors typically

include a U-type core and coils wound around the core legs. Inductive proximity sensors have a

lossy resonant circuit (oscillator) at the input side whose loss resistance can be changed by the

proximity of an electrically conductive medium.

The VCNL4010 is a fully integrated proximity and ambient light sensor. Fully integrated means

that the infrared emitteris included in the package. It has 16 bit resolution and it includes a

signal processing IC and features standard I2Ccommunication interface. It features an interrupt

function. This IC sensor has a built-in infrared emitter and photo-pin-diode for proximity

function. Its 16 bit effective resolution for proximity detection range ensures excellent cross talk

immunity .The programmable LED drive current is from 10 mA to 200 mA in steps of 10 mA .It

has excellent ambient light suppression by modulating the infrared signal .The maximum

Proximity distance of this sensor is up to 200 mm. It has 100 Hz and 120 Hz flicker noise

rejection. This sensor has excellent temperature compensation, robust refresh rate setting without

any external RC low-pass filter. Connected with an infrared LED (IR-LED), the built-in

proximity sensor can reveal the closeness of approaching/departing objects. This device is

intended primarily for use in applications in which measurement of ambient light and proximity

sensing is a necessary, such as laptop computers, PDA, camcorders, mobile phone, smart phones

etc... The sensor contains an eight 8-bit registers accessed via the I2C bus. All operations can be

controlled by the command register. The sample command structure makes the user easy to

program the operation setting and latch the light data from the sensor. The block diagram of the

sensor is shown below in figure1.The interfacing of the proximity sensor and signal conditioning

is shown in figure2. below.

12

Page 13: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

13

Page 14: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

The interfacing is done using two wired I2C technique. the SCL and SDA signals are connected

to the port1.0 and port 1.1 pins of the microcontroller. After detecting the object the sensor sends

an interrupt signal to the microcontroller. Since the Sensor is a digital IC ,its output is in digital

form .So, no ADC is required and the output voltage can be directly given to the microcontroller.

Interfacing of Flow Sensor:

A flow sensor is a device for sensing the rate or quantity of fluid flow whether it be a gas, steam ,

liquid or solid .Flow sensor configurations are available for use in liquids or gases with flow

rates from ultra low flow sensing to fast transient flow sensors . The flow rate is determined

directly by measuring the liquid's velocity or the change in kinetic energy. Velocity depends on

the pressure differential that is forcing the liquid through a pipe . Because the pipe's cross-

sectional area is known and remains constant ,the average velocity is an indication of the flow

rate. Flow sensors are sometimes related to sensors called velocimeters that measure speed of

fluids flowing through them, these use units like ft/sec . A very basic relationship for

determining the fluid's flow rate in such cases is Q= VXA where Q is the liquid flow through

the pipe ; V = average velocity of the flow; A = cross-sectional area of the pipe.

There are three basic types of flow sensors and flow meters. Mass flow sensors measure flow

rate in terms of the mass of the fluid substance , Volumetric flow sensors measure flow rate in

terms of how much of the material is flowing, Velocity flow sensors measure flow rate as in

terms of how fast the material is moving.

An effective way to measure the flow rate through a pipe is to place some type of restriction

within the pipe and to measure the pressure difference between the low velocity, high-pressure

upstream section, and the high-velocity, low-pressure downstream section. One common method

is the use of an orifice plate as shown below.

The volumetric flow rate (Q) is given by 14

Page 15: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

Where

A1 = Area of pipe upstream from restrictionA2 = Flow area of pipe at restrictionp1 = pressure upstream from restrictionp2 = pressure at restrictionρ = density of fluidC = correction factor for energy losses

The differential pressure sensors

The SDPx108 series sensors are a high-performance sensors , specially designed for air flow

measurements.The SDPx108 sensor provides an analog output signal with a range of 0-4 V and

is fully calibrated and temperature compensated. In addition, it has a high resolution.The

SDPx108 sensor series achieves outstanding sensitivity and accuracy even at extremely low

differential pressures and exhibits very high stability and has zero point drift. Furthermore, the

SDPx108 series offers square-root output characteristics for a wider dynamic measurement

range. The faster response time - compared to the SDP1000 series - makes the differential

pressure sensor a perfect alternative for respiratory devices and time-critical process automation

applications. The simple differential pressure sensor used to measure flow rate is shown below.

It is a 3-pin CMOS IC, whose output is at the pin 3. It has internal temperature compensation, on

chip ADC and on chip DAC .

15

Page 16: Sensors-Interfacing Techniques

Dr.Y.NARASIMHA MURTHY Ph.D [email protected]

Interfacing Circuit: The output of the sensor is applied to the ADC0809 and this digital output

is given to the ports of the Microcontroller .

The analog output of the sensor is applied to channel 0 (IN0) of the ADC and the output of the

ADC is given to the Port1 of the microcontroller as shown in the diagram. a 2X16 LCD module

is interfaced to the microcontroller to display the flow rate.

16