22
HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA DATA ACQUISITION SYSTEM Interim project report Submitted by: Arindam Seth, Kausik Kumar Dandapath, Joyrup Das, Swarnendu Samanta, Vikash Kumar & Lokesh Kumar Mishra (AEIE) 24/11/2010 Under the guidance of: Ms. Sreeparna Dasgupta

DATA ACQUISITION SYSTEM123

  • Upload
    asifuit

  • View
    338

  • Download
    0

Embed Size (px)

Citation preview

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

Interim project report

Submitted by: Arindam Seth, Kausik Kumar Dandapath, Joyrup Das, Swarnendu Samanta, Vikash Kumar & Lokesh Kumar Mishra (AEIE)

24/11/2010

Under the guidance of: Ms. Sreeparna Dasgupta

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

2

2

INDEX Page No.

1.) Introduction 3

2.) Block diagram 4

3.) Components 5

4.) Fire detector circuit 6

5.) RTD 7

6.) 8051 Interfacing 13

7.) Bibliography 22

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

3

3

INTRODUCTION

Data Acquisition System or DAS is one of the most important devices used in an industry. It serves as an automated recorder of data from vital processes going on in the industry. It is generally made of two major components namely, a microcontroller and an ADC. A computer is used for recording of data. The data thus recorded is used to perform important decisions regarding controlling and monitoring of process. A DAS generally has many channels (8 or more) for simultaneous data recording from multiple sources. The microcontroller in DAS is programmed to sequentially scan each channel, convert the data and then send it to the recording device (the computer). The computer has a program to simultaneously display the trend, graph and other manipulations with the data that are possible simultaneously in eight tiled windows. Controlling actions can be implemented in the computer program that is used to display the trend of the data. The data can be compared and decisions can be implemented using either the microcontroller or the computer.

We are going to design a 8 channel DAS, through which we will sense two physical variables. The first variable is the temperature which will be sensed by a RTD. In temperature sensing, RTD sense the variation in temperature by change in its resistance, and this change in resistance is detected by a bridge circuit. And after proper signal conditioning the output is fed to the DAS. The second variable is the fire which will be sensed by an IR sensor. The motive of fire sensing is to make the industrial environment safe from fire hazard. In the fire sensing, IR sensor composed of infrared receiver, which receives IR radiation and get forward biased and starts conducting. The current through the IR receiver is fed to the electronic circuit and through electronics circuit to DAS.

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

4

4

Fire se

nso

r Sig

na

l con

ditio

nin

g circu

it

RT

D

Sign

al co

nd

ition

ing

circuit

AD

C0

80

8

80

51

micro

con

trolle

r

Co

mp

ute

r

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

5

5

COMPONENTS

1. 8051 microcontroller 2. ADC 0808 3. MAX 232 IC 4. DB-9 connector 5. Crystal oscillator (11.592MHz) 6. 555 timer IC 7. RTD (Pt 100, 1kΩ at 0⁰C) 8. OP-AMP (IC 741) 9. IR Receiver 10. Capacitor (1µF) 11. Transistor (2N2222) two pieces

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

6

6

FIRE DETECTOR CIRCUIT FOR ONE OF THE CHANNELS OF DAS

A flame which is barely visible emits significant infrared content. Thus, the sensor of this circuit is an infrared sensitive diode (D1) which is excited by IR rays. As more infrared rays shine on D1, more conductive it becomes.

When there is aflame or fire nearby, D1 will conduct, feeding current to the base of Q1. At a certain threshold, this current will be large enough to turn on Q1, which will pull down the base of Q2. This will turn off Q2; causing Vout to be pulled high, Vout may be used to excite a light-emitting diode or an alarm circuit.

In the absence of a nearby source of IR source (from the flame of fire), D1 will be off (generally conducts negligibly) and so will Q1. This will allow the base of Q2 to remain high, causing Q2 to remain on to pull Vout to low.

The circuit will require optimization of the sensor position & experimentations with the resistance values (R1&R2) to achieve the proper sensitivity. An IR filter might also be required by the IR receiver if it being affected by too much ambient light.

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

7

7

RTD AND SIGNAL CONDITIONING FOR ANOTHER CHANNELS There is a multitude of process parameters nowadays that need to be measured in the industrial environment (temperature, pressure, humidity, force etc.). Out of these, undoubtedly the most common one is temperature, as it influences most manufacturing parameters. It is no wonder then that many solutions have been developed over time to measure it. There are a few general categories any industrial temperature sensor will fall into: thermocouples, RTDs (Resistance Temperature Detectors), thermistors and integrated silicon sensors. There is no “best sensor” rather they all have pros and cons which need to be individually evaluated for each application. The RTDs are the most expensive, but they also provide best accuracy and best resolution for the measurement. This, however, only if appropriate analogue circuitry will be used (which of course will add cost to the already high price of the sensor itself). The appropriate analogue circuitry constitutes the subject of this article.

RTDs are regarded as the best quality temperature sensors (when it is worth paying for them). They provide accurate and stable measurements over time, and, most important, they provide a linear resistance-temperature characteristic. Below, you may see the resistance-temperature characteristic of the most common RTD, the PT100, which gives 100Ohms at a temperature of 0 Celsius degrees.

RTDs also represent a continuously expanding technology, better materials being researched and used, further improving the characteristics of the sensors. The purpose of the analog circuitry buffering the sensor is to transform the resistance variation of the sensor in a variation of voltage which can easily be converted in digital values by an ADC. Although there are several methods to do this, the most common one is to build an ana The variation of the voltage will linearly depend on the variation of the sensor resistance, and thus on the temperature. logue precision constant current source that will force a known and constant current through the RTD.

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

8

8

741 OP-AMP(LOW VOLTAGE DC VOLTMETER)

We replace the load resistor Rl by an ammeter (D’Arsonval meter movement)with a full scale deflection of 1mA. This figure show an external offset voltage compensation network, which use because it makes the nulling of the op-amp relatively easy. When the offset null circuit of the IC 741(10 kΩ

potentiometer)is used. The op-amp sometimes can’t be nulled because the o/p is very sensitive to even slight variations in wiper position.

R1=10+100=1kΩ

if,Vin =1v,then

Io=Vin/R1=1v/1k Ω=1mA.

Note,

1)The input voltage range for the 741Ic op-amp +14V. with ±15 Supply voltage.

2)Max i/p volt has to be <= +14V.

3)The meter resistance Rm does not affect Io only Vin & R1determine the Io value.

4)I/P signal should be less than 4khz for the proper operation of the voltmeter.

A

+VV3

-15V

+V

V215V

Iout

+VV15V

+

U2OPAMP5

R210k

R110k

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

9

9

Great care should be taken care for the excitation current to be as low as possible. At the end of the day, the RTD is a normal passive device, which dissipates power as heat, so a higher current through the sensor will determine higher self-heating and thus will introduce errors in the measurement results. A good practice is to keep the excitation current below 1mA, but the drawback of such a small current is that it translates the temperature variation to a quite narrow voltage interval. If this is the case, a higher resolution ADC will be required in order to obtain a satisfactory resolution of the final result (of the measured temperature). For, instance, the resistance variation of PT100 between 0 and 100 Celsius is 38.5Ohm, and a 1mA constant current source would translate this in a 38.5mA voltage interval (between 100mV and 138.5mV) – hardly a wide interval for the plain 10-bit ADC usually provided on chip by the microcontrollers.

If using the proper devices tough, excellent accuracy and resolution can be obtain from an RTD. The table above only shows the resistance-temperature variation between 0 and 200 Celsius. The RTD is quite linear in that interval, but even if wider ranges are required, simple first order up to third order mathematic formulas may be used to estimate the temperature based on the measured resistance. Even if this introduces some strain on the software algorithms, it must be weighed if this is acceptable against a maximum +/-4.3 Celsius at the highest end of the measurement range (800 Celsius). The graph below indicates the measurement error (with appropriate analogue circuitry) against the measured temperature (note than in the most common measurement interval, between 0 and 100 Celsius, the

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

10

10

measurement error is minimum):

For this kind of performance to be achieved, it is best for the RTD to be excited with a constant and stable current. There are several ways to build a constant current source, of which one is shown in the schematic below:

The way it works is rather simple: because the way an opamp generally functions, U1A will always have the same voltage at its two inputs. The voltage at its negative input is determined by the R1/R2 voltage divider to be at about 4.5V, thus, the same voltage will be found at its positive input. This will determine a 0.5V voltage drop on the R3 resistor, which generates about 1mA of current through it. The same

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

11

11

current will be the collector current for Q1, irrespective of the value of the RTD sensor. Q1 is used to buffer the sensor itself with a high impedance of the current source (for an ideal voltage source, the output impedance is minimum, but for an ideal current source, the output impedance is maximum). Care should be taken in the way the components for this current source are selected. The opamp should be low offset and all the resistors should be 0.1% tolerance. Any deviation in the values of these components will adversely and considerably affect the generated current, thus the voltage drop on the RTD to be measured.

Another major error source that might influence the measurement is the wire resistance between the sensor itself and the measurement circuit. The situations you may be confronted with in industry might be various. The sensor might be located in the most various environments, from freezers to steam pools for wood treatment. Many of these environments are simply to rough for electronic devices to operate in, therefore the device containing the measurement circuit has to be located in a different position, usually in a building which is tens or even hundreds of meters away from the location of the sensor. Thus, the copper wires connection the sensor to the electronics become very long, and their resistance becomes significant against the small resistance values of the sensor itself.

In order to compensate not only the absolute resistance of the wire, but also the variation of this resistance across the temperature, there are methods to use 3-wire or 4-wire sensors. The 4-wire configuration means that each terminal of the sensor is connected to the electronic circuit with two parallel wires. The 3-wire configuration means that one terminal of the sensor is connected to the electronic circuit with two parallel wires, while the other terminal is connected with a single wire. Either of these configurations allows for the wire lengths to be compensated, taking the assumption that all the wires between the sensor and the circuit have the same length and the same resistance.

The example below depicts the 3-wire configuration. The RTD sensor is on the left, and the measurement circuit is on the right. The resistances modeling the three wires are Rw1=Rw2=Rw3. We will consider the voltage drop on these wires to be Vw1, Vw2 and Vw3. Due to the fact that the 1mA current from the constant current supply is flowing through both Rw1 and Rw3, it will give an equal voltage drop over these two wires: Vw1=Vw3.

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

12

12

The current flowing through Rw2 is really negligible, due to the fact that it is equal to the input current of

the opamp, which is in the range of nanoampers, given an appropriate device is chosen.

Writing the equation for the output voltage of the amplifier, we will get:

But R6=R5 so we get:

Combining these with the equation above and taking into account that Vw1=Vw3 we obtain:

So the voltage at the output of the amplifier will be equal to the voltage drop on the sensor itself, no

matter what the resistance of the wires is (as long as the wires are the same length and the same

resistance).

In order to ensure a clear signal reaches the ADC, the employment of a low-pass filter is sometimes a good addition to the circuit, between the wire resistance compensation circuit and the ADC itself. The filter can range from the simple RC or LC low-pass filter to more complicated topologies like the Sallen-Key filter specially designed for high gain and which includes an additional operational amplifier (again, think of the trade-offs, since it is more expensive).

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

13

13

Thus, a generic block diagram of the entire analogue circuitry required to accurately measure an RTD can be the one below:

As mentioned before, due to the small variation of the voltage signal at the output of the analogue circuitry, a higher resolution ADC is usually required (at least 12 bit).

Choosing an ADC is a significant task in itself, and there are other tutorials and articles out there to help you on this (for instance: ADCS7476 12-Bit A/D Converter or 16 Top Kickass 16 bit ADConverter).

The microcontroller is really not that important for the application. The criteria based on which it should be selected should be driven mostly by any potential algorithms in which the digital value of the temperature would be involved in, or by other requirements of the application (driving a display etc).

8051 MICROCONTROLLER The Intel MCS-51 is Harvard architecture, single chip microcontroller (µC) series which was developed by Intel in 1980 for use in embedded systems. Intel's original versions were popular in the 1980s and early 1990s, but has today largely been superseded by a vast range of faster and/or functionally enhanced 8051-compatible devices manufactured by more than 20 independent manufacturers including Atmel, Infineon Technologies (formerly Siemens AG), Maxim Integrated Products (via its Dallas Semiconductor subsidiary), NXP (formerly Philips Semiconductor), Nuvoton (formerly Winbond), ST Microelectronics, Silicon Laboratories (formerly Cygnal), Texas Instruments and Cypress Semiconductor.

Intel's original MCS-51 family was developed using NMOS technology, but later versions, identified by a letter C in their name (e.g., 80C51) used CMOS technology and were less power-hungry than their NMOS predecessors. This made them more suitable for battery-powered

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

14

14

devices

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

15

15

BLOCK DIAGRAM OF 8051 MICROCONTROLLER

0808/0809 ANALOG TO DIGITAL CONVERTER The ADC0808, ADC0809 data acquisition component is a monolithic CMOS device with an 8-bit analog-to-digital converter, 8-channel multiplexer and microprocessor compatible control logic. The 8-bit A/D converter uses successive approximation as the conversion technique. The converter features a high impedance chopper stabilized comparator, a 256R voltage divider with analog switch tree and a successive approximation register. The 8-channel multiplexer can directly access any of 8-single-ended analog signals.

The device eliminates the need for external zero and full-scale adjustments. Easy interfacing to microprocessors is provided by the latched and decoded multiplexer address inputs and latched TTL TRI-STATE outputs.

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

16

16

The design of the ADC0808, ADC0809 has been optimized by incorporating the most desirable aspects of several A/D conversion techniques. The ADC0808, ADC0809 offers high speed, high accuracy, minimal temperature dependence, excellent long-term accuracy and repeatability, and consumes minimal power. These features make this device ideally suited to applications from process and machine control to consumer and automotive applications. For 16-channel multiplexer with common output (sample/hold port) see ADC0816 data sheet. (See AN-247 for more information.)

Key Specification

Resolution 8 Bits

Total Unadjusted Error ±½ LSB and ±1 LSB

Single Supply 5 VDC

Low Power 15 mW

Conversion Time 100 µs

In lot of embedded systems microcontrollers needs to take analog input. Most of the sensors & is no need of external ADC. For microcontrollers that don’t have internal ADC external ADC is used.

One of the most commonly used ADC is ADC0808. ADC 0808 is a Successive approximation type with 8 channels i.e. it can directly access 8 single ended analog signals.

I/O Pin: Transducers such as temperature, humidity, pressure, are analog. For interfacing these sensors to microcontrollers we require to convert the analog output of these sensors to digital so that the controller can read it. Some microcontrollers have built in Analog to Digital Convertor (ADC) so there

ADDRESS LINE A, B, C: The device contains 8-channels. A particular channel is selected by using the address decoder line. The TABLE 1 shows the input states for address lines to select any channel.

Address Latch Enable ALE :

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

17

17

The address is latched on the Low – High transition of ALE.

START: The ADC’s Successive Approximation Register (SAR) is reset on the positive edge i.e. Low- High of the Start Conversion pulse. Whereas the conversion is begun on the falling edge i.e. High – Low of the pulse.

Output Enable: Whenever data has to be read from the ADC, Output Enable pin has to be pulled high thus enabling the TRI-STATE outputs, allowing data to be read from the data pins D0-D7.

End of Conversion (EOC): This Pin becomes High when the conversion has ended, so the controller comes to know that the data can now be read from the data pins.

Clock: External clock pulses are to be given to the ADC; this can be given either from LM 555 in Astable mode or the controller can also be used to give the pulses.

ALGORITHM:

1. Start. 2. Select the channel. 3. A Low – High transition on ALE to latch in the address. 4. A Low – High transition on Start to reset the ADC’s SAR. Step size= (2.56 - 0)/256= 10 mv. So now whatever reading that you get from the ADC will be equal to the actual temperature. 5. A High – Low transition on ALE. 6. A High – Low transition on start to start the conversion. 7. Wait for End of cycle (EOC) pin to become high. 8. Make Output Enable pin High. 9. Take Data from the ADC’s output 10. Make Output Enable pin Low. 11. Stop The total numbers of lines required are:

data lines: 8 ALE: 1 START: 1 EOC:1 Output Enable:1

I.e. total 12 lines. You can directly connect the OE pin to Vcc. Moreover instead of

polling for EOC just put some delay so instead of 12 lines you will require 10 lines.

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

18

18

You can also provide the clock through the controller thus eliminating the need of external circuit for clock.

Calculating Step Size: ADC 0808 is an 8 bit ADC i.e. it divides the voltage applied at Vref+ & V ref- into 28 i.e. 256 steps.

Step Size = (Vref+ - V ref-)/256

Suppose Vref+ is connected to Vcc i.e. 5V & Vref- is connected to the Gnd then the step size will be

Step size= (5 - 0)/256= 19.53 mv.

Calculating Dout: The data we get at the D0 - D7 depends upon the step size & the Input voltage i.e. Vin.

Dout = Vin /step Size.

you want to interface sensors like LM35 which has output 10mv/°C then I would suggest that you set the Vref+ to 2.56v so that the step size will be

Step size= (2.56 - 0)/256= 10 mv.

So now whatever reading that you get from the ADC will be equal to the actual temperature.

MAX 232 : Since the RS232 is nt a complatible with today’s microprocessor & microcontroller, we need a line diver(voltage converter) to convert the RS232’s signals to TTL voltage levels that will be acceptable to the 8051’s TxD and RxD pins.The MAX232 converts from RS232 voltage levelstotonTTLvoltageand vice versa.one advantage of the MAX232 chip is theat it uses a +5v power source which,is the same as the source voltagefor the 8051.

The MAX232 has two sets of line drivers for transfering and receiving data, as showm in fig.The line drivers used for TxD are called T1 & T2,while the that is R1 & R2.In many applications only one of each is used.T1 & R1 are used together for TxD & RxD of the 801, and the second set is left unused.Notice in MAX232 that the T1 line driver has a destination of T1 in & T1 out on pin numbers 11 & 14, respectively.The T1 IN pin is the TTL side and is connected to TxD of the microcontroller, while T1 OUT is the RS232 side that is connected to the RxD pin of the RS232 DB connector .The R1 line driver has a designation of R1 IN & R1 OUT on pin number 13 & 12 ,respectively. The R1 IN is the RS232 side that is connected to the TxD pin of the RS232 DB connector , R1 OUT (pin 12) is the TTL side that is connected to the RxD pin of microcontroller.

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

19

19

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

20

20

INTERFACING CIRCUIT OF ADC 0808 WITH MICROCONTROLLER

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

21

21

HERITAGE INSTITUTE OF TECHNOLOGY, KOLKATA

DATA ACQUISITION SYSTEM

22

22

Bibliography

1.) Microprocessor & Microcontroller by Deshpandey

2.) Industrial Instrumentation & Control by S.K Singh

3.) www.ecelab.com

4.) www.wikipedia.com