You are on page 1of 37


Nowadays the research in the field of micro system is progressively directed towards smart electronics and interfacing, which provides the ability of performing complex operations. In this project microcontroller-based data acquisition is designed for fast and accurate data measurements. Data acquisition systems (DAS) interface between the real world of physical parameters, which are analog, and the artificial world of digital computation and control. With current emphasis on digital systems, the interfacing function has become an important one; digital systems are used widely because complex circuits are low cost, accurate, and relatively simple to implement. In addition, there is rapid growth in the use of microcomputers to perform difficult digital control and measurement functions.


Data acquisition is the process of sampling signals that measure real world physical conditions and converting the resulting samples into digital numeric values that can be manipulated by a computer The physical quantities are obtained from transducers in the current form which is then converted to electrical signal through instrumentation amplifier and then sent to low pass filter to remove the noise and then it is sent to multiplexer and output of multiplexer is then sent to analog to digital converter which is then interfaced with microcontroller AT89c52 through RS-232C it is interfaced with personal computer through software tools.


The main objective of this project is to acquire the physical quantity signals (like pressure, temperature, humidity, flow) and convert these signals to proportional voltage or current, which can be processed using microcontroller and display these data in computer.


The purpose of data acquisition is to measure an electrical or physical phenomenon such as voltage, current, temperature, pressure, or sound. PC-based data acquisition uses a combination of modular hardware, application software, and a computer to take measurements. While each data acquisition system is defined by its application requirements, every system shares a common goal of acquiring, analyzing, and presenting information. Data acquisition systems incorporate signals, sensors, actuators, signal conditioning, data acquisition devices, and application software. Data acquisition is the process of sampling signals that measure real world physical conditions and convert the resulting samples into digital values that can be manipulated by a computer. Data acquisition begins with the physical phenomenon to be measured examples of this include temperature, light intensity, gas pressure, fluid flow, and force. Regardless of the type of physical property to be measured, the physical state that is to be measured must first be transformed into a unified form that can be sampled by a data acquisition system. The task of performing such transformations falls on devices called sensors. Data acquisition systems (abbreviated with the acronym DAS or DAQ) typically convert analog waveforms into digital values for processing. The components of data acquisition systems include:

Sensors that convert physical parameters to electrical signals. Signal conditioning circuitry to convert sensor signals into a form that can be converted to digital values.

Analog-to-digital converters, which convert conditioned sensor signals to digital values.

Data acquisition applications are controlled by software programs developed using various general purpose programming languages such as BASIC, C, Fortran, Java, Lisp, Pascal Specialized software tools used for building large scale data acquisition systems include EPICS. Graphical programming environments include ladder logic, Visual C++, Visual

Basic, MATLAB and Lab VIEW.

The ability of a data acquisition system to measure differing properties depends on having sensors that are suited to detect the various properties to be measured. There are specific sensors for many different applications. DAQ systems also employ various signal conditioning techniques to adequately modify various different electrical signals into voltage that can then be digitized using an Analog-to-digital converter(ADC).


IEEE Paper on Wireless Structural Sensors using Reliable Communication Protocols for Data Acquisition and Interrogation Yang Wang To better address the above challenges, a novel design of a wireless structural monitoring system is proposed in this paper. The wireless structural monitoring system contains multiple wireless sensing units, which can simultaneously collect and analyze data from multiple heterogeneous analog sensors. High-precision analog-to-digital conversion of multi-channel sensor signals is implemented in the wireless sensing unit. For wireless communication, each unit employs a specially selected wireless modem that consumes relatively low power and supports longdistance peer-to-peer communication. A microcontroller, coupled with a considerable amount of external memory, is used to manage the collection of sensor data, local data storage, and wireless data streaming. Its computational power and the associated external memory are sufficient to support local data analysis. A specially designed data acquisition protocol is embedded in the microcontroller, enabling reliable real-time and near-synchronized data acquisition from multiple sensing units associated with multiple sensors. Shake-table tests have been conducted to validate the performance of this newly designed wireless structural monitoring.



CHAPTER 2: Interfacing of ADC0804 with microcontroller AT89c52

ADC0804 is connected as shown in the circuit diagram. Here the input is taken from a preset, which gives different analog signals to the ADC. The output pins of the ADC are connected to LEDs. The control pins of the ADC are connected to the microcontroller AT89C51. ADC0804 is a single channel analog to digital convertor i.e., it can take only one analog signal. An ADC has n bit resolution (binary form) where n can be 8,10,12,16 or even 24 bits. ADC 0804 has 8 bit resolution. The higher resolution ADC gives smaller step size. Step size is smallest change that can be measured by an ADC. For an ADC with resolution of 8 bits, the step size is 19.53mV (5V/255). The time taken by the ADC to convert analog data into digital form is dependent on the frequency of clock source. ADC0804 can be given clock from external source. It also has an internal clock. However the conversion time cannot be more than110us. To use the internal clock a capacitor and resistor is connected to pin 19 and 4 as shown in the circuit diagram. The frequency is given by the relation f= 1/ (1.1RC). The circuit uses a resistance of 10k and a capacitor of 150pF to generate clock for ADC0804. Vin, which is the input pin, is connected to a preset to provide analog input.


A transducers is an electrical device that converts energy from one form to another. The conversion can be to/from electrical, electro-mechanical, electromagnetic, photonic,

photovoltaic, or any other form of energy. While the term transducer commonly implies use as a sensor/detector, any device which converts energy can be considered as a transducer. Here we are using the transducers in which one form of energy is electrical. A sensor is a device that detects or measures a physical quantity. The simplest type of sensor is a switch that opens and closes an electrical circuit. Switches are widely used to detect the presence of a physical object. The difference between sensors and transducers are often very slight. A sensor performs a transducing action and the transducer must necessarily sense some physical quantity. The difference lies in the efficiency of energy conversion. A transducer is intended to convert energy and its efficiency is important, though in some cases it may not be high. Linearity of response, defines by plotting the output against the input is likely to be important for a sensor but of much less significance for transducers. Efficiency of conversion is important for a transducer but not for a sensor. Figure 1 shows the sensing process in terms of energy conversion. The form of the output signal will often be a voltage analogous to the input signal, though sometimes it may be a wave form whose frequency is proportional to the input or a pulse train containing the information in some other form.

Sensors can be classed as active or passive. An active or self-generating sensor is one that can generate a signal without the need for any external power supply. Example include photovoltaic cells, thermocouples and piezoelectric device. The more common passive sensors need an external source of energy. These operate by modulating the voltage or current of a supply. Another class of passive sensors, sometimes called modifiers, use the same type of energy at the output as at the input. Typical of these types is a diaphragm used to convert the pressure or velocity oscillations of sound waves into movements of a solid sheet.

Transducers are sensors and actuators in order that a computer system can interact with the physical environment. In 1982, Ko and Fung introduced the term intelligent transducer. An intelligent or smart transducer is the integration of an analog or digital sensor or actuator element, a processing unit, and a communication interface. In case of a sensor, the smart transducer transforms the raw sensor signal to a standardized digital representation, checks and calibrates the signal, and transmits this digital signal to its users via a standardized communication protocol. In case of an actuator, the smart transducer accepts standardized commands and transforms these into control signals for the actuator interface is referred to as smart Transducer. Thus definition of smart sensors can be formulated as: a smart sensor is one chip, without external components, including the sensing, interfacing signal processing and intelligence (self-testing, self-identification or self-adaptation) functions.

Transducers are synonymous with sensors in data acquisition systems. Different types of sensors which can be provided for our 4-channel data acquisition system are temperature, pressure, humidity, flow sensors.


A device in an automatic temperature-control system that converts the temperature into some other quantity such as mechanical movement, pressure, or electric voltage or current. An analog temperature sensor is a chip that tells what the ambient temperature is. These sensors use a solid-state technique to determine the temperature. That is to say, they don't use mercury, bimetallic strips , nor do they use thermistors. Instead, they use the fact as temperature increases, the voltage across a diode increases at a known rate. Technically, this is

actually the voltage drop between the base and emitter - the Vbe - of a transistor. By precisely amplifying the voltage change, it is easy to generate an analog signal that is directly proportional to temperature. There have been some improvements on the technique but, essentially that is how temperature is measured. Because these sensors have no moving parts, they are precise, never wear out, don't need calibration, work under many environmental conditions, and are consistent between sensors and readings. Moreover they are very inexpensive and quite easy to use.


Pressure transducers are used for measuring the pressure of a fluid or air in a device or system. A pressure transducer provides to downstream display, control, or regulating devices an electrical output signal in the form of an output signal voltage or output signal current that is a measure of the pressure measured. Pressure transducers may typically provide two types of outputs which include a cable connection for transmitting a signal representative of the sensed pressure to a remote monitoring or control device and a human-readable display for providing a local reading of the sensed pressure. Pressure transducers that use piezoresistors are formed with a silicon substrate and an epitaxial layer, which is grown on the substrate. A portion of the substrate is removed, leaving a thin, flexible diaphragm portion. The piezoresistors are located in the diaphragm portion to form a pressure transducer. Capacitive pressure sensors typically include a stationary electrode having a rigid, planar conductive surface forming one plate of a substantially parallel plate capacitor and a deformable conductive member. A generally known pressure transducer assembly for measuring fluid pressure includes at least one fluid measuring line going between the process circuit and the valve of the pressure transducer. Tire pressure transducers are mounted on a wheel inside a tire and detect air pressure within the tire. An air pressure transducer includes a radio frequency transponder that responds to received radio frequency signals. A differential pressure transducer is used for measurement of differential pressure. Differential pressure transducers are widely used for example in the chemical industry, food industry, aviation industry, in water treatment plants, etc. for purposes of among others flow measurement in flowing media, the control of filters, speed measurement in aircraft or water craft. Measuring diaphragms with differential pressure transducers are frequently used to ascertain fluid flow-through.


Humidity is the amount of water vapor in the air, expressed as a percentage of the maximum amount that the air could hold at the given temperature.

A humidity sensor, also called a hygrometer, measures and regularly reports the relative humidity in the air. They may be used in homes for people with illnesses affected by humidity; as part of home heating, ventilating, and air conditioning (HVAC) systems; and in humidors or wine cellars. Humidity sensors can also be used in cars, office and industrial HVAC systems, and in meteorology stations to report and predict weather. A humidity sensor senses relative humidity. This means that it measures both air temperature and moisture. Relative humidity, expressed as a percent, is the ratio of actual moisture in the air to the highest amount of moisture air at that temperature can hold. The warmer the air is, the more moisture it can hold, so relative humidity changes with fluctuations in temperature. The most common type of humidity sensor uses what is called capacitive measurement. This system relies on electrical capacitance, or the ability of two nearby electrical conductors to create an electrical field between them. The sensor itself is composed of two metal plates with a nonconductive 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 converted into digital readings showing the amount of moisture in the air. A person with a respiratory illness or certain allergies might use a home humidity sensor because low humidity can exacerbate breathing problems and cause joint pain, while high humidity encourages bacteria, mold, and fungus growth. Home humidors and wine cellars often have a humidity sensor that helps to maintain a consistent relative humidity optimal to safe long-term storage. Humidity sensors can also be used in homes or museums where valuable antiques or artwork are kept, because these items can be damaged or degraded from constant exposure to too much moisture. Commercial and office buildings often have humidity sensors in their HVAC systems, which help to insure safe air quality. Many automobiles use a humidity sensor as part their defrosting and defogging systems to automatically adjust the temperature and source of air used forheating and air conditioning. Humidity sensors also have industrial applications for production of

materials that are sensitive to moisture. Humidity sensors give regular, ongoing readings of relative humidity, so they are used for data collection in oceanography and weather stations where humidity must be measured over time to analyze patterns and predict weather.


Functional principle The function of the in-line flow sensors is based on the thermo-dynamic principle. Heat is generated in a measuring tube and absorbed by the flowing medium. The transported heat loss is thus a measure of the flow speed. Thus TURCK's wear-free flow sensors reliably monitor the flow of gaseous and liquid media. A low pressure drop and fast response to flow rate variations are the outstanding features of these devices. 0.5 40 m/s 1030s 1020s 20 K/min -20 80C 0 60C 21 26 VDC I0 50 mA 4 20 mA yes yes

Air operating range Stand-by time Setting time Temperature gradient Medium temperature Ambient temperature Operating voltage No-load current Output function Analog output, Short-circuit protection Reverse polarity protection

current output Load

4 20 mA 500


An instrumentation (or instrumentational) amplifier is a type of differential amplifier that has been outfitted with input buffers, which eliminate the need for input impedance matching and thus make the amplifier particularly suitable for use in measurement and test equipment. Additional characteristics include very low DC offset, low drift, low noise, very high open-loop gain, very high common-mode rejection ratio, and very high input impedances. Instrumentation amplifiers are used where great accuracy and stability of the circuit both short- and long-term are required.

The differential input single-ended output instrumentation amplifier is one of the most versatile signal processing amplifiers available. It is used for precision amplification of differential dc or ac signals while rejecting large values of common mode noise. By using integrated circuits, a high level of performance is obtained at minimum cost.

Amplifier Characteristics Input Impedance -- The effective resistance and capacitance seen at the input to the amplifier. The impedance can vary differ when the board is powered on, powered off, and when isolated input limits are overloaded. In general, the higher the input impedance of the DAQ product, the less the product will disturb the signal being measured. Input Bias Current -- The current, specified in nA, produced by the analog input circuitry that flows through external components connected to the analog input channels. This current flowing through the resistance of the connected circuitry will add an unwanted voltage to the one that you are trying to measure. The lower the input bias current, the lower the additional unwanted voltage, and therefore the better the measurement. Input Offset Current -- The difference in the input bias currents of the two inputs of the instrumentation amplifier, usually specified in pA. If the source resistances connected to each of

the input terminals are nearly the same and the input offset current is low, the resulting offset voltages tend to cancel. Thus, lower input offset currents improve measurements of balanced sources. CMRR (Common-Mode Rejection Ratio) -- CMRR describes the ability of a differential amplifier to reject interfering signals common to both inputs and amplify only the difference between the inputs. A differential-input instrumentation amplifier has both normal-mode (differential) gain and common-mode gain. The normal-mode gain is the amplification of the difference between the positive and negative inputs and ideally has such values as 1, 10, or 100. The common-mode gain refers to signals appearing at the output of the amplifier resulting from the same (that is, common) signals appearing at both of the inputs. Because the amplifier is expected to ignore common-mode signals.

Pin configuration diagram of AD620

The AD620 is a low cost, high accuracy instrumentation amplifier that requires only one external resistor to set gains of 1 to 10,000. Furthermore, the AD620 features 8-lead SOIC and DIP packaging that is smaller than discrete designs and offers lower power (only 1.3 mA max supply

current), making it a good fit for battery powered, portable (or remote) applications. The AD620, with its high accuracy of 40 ppm maximum nonlinearity, low offset voltage of 50 mV max and offset drift of 0.6 mV/C max, is ideal for use in precision data acquisition systems, such as weigh scales and transducer interfaces. Furthermore, the low noise, low input bias current, and low power of the AD620 make it well suited for medical applications such as ECG and noninvasive blood pressure monitors. The low input bias current of 1.0 nA max is made possible with the use of Super beta processing in the input stage. The AD620 works well as a preamplifier due to its low input voltage noise of 9 nV/Hz at 1 kHz, 0.28 mV p-p in the 0.1 Hz to 10 Hz band, 0.1 pA/Hz input current noise. Also, the AD620 is well suited for multiplexed applications with its settling time of 15 ms to 0.01% and its cost is low enough to enable designs with one in-amp per channel. Features:

Gain Set with One External Resistor (Gain Range 1 to 10,000) Wide Power Supply Range (2.3 V to 18 V) Higher Performance than Three Op Amp IA Designs Available in 8-Lead DIP and SOIC Packaging Low Power, 1.3 mA max Supply

9 nV/Hz, @ 1 kHz, Input Voltage Noise 0.28 V p-p Noise (0.1 Hz to 10 Hz)

50 V max, Input Offset Voltage 0.6 V/C max, Input Offset Drift 1.0 nA max, Input Bias Current 100 dB min Common-Mode Rejection Ratio (G = 10) LENT AC SPECIFICATIONS

120 kHz Bandwidth (G = 100) 15 s Settling Time to 0.01%. APPLICATIONS o Weigh scales o ECG and medical instrumentation o Transducer interface o Data acquisition systems o Industrial process controls o Battery-powered and portable equipment


o A multiplexer or mux is a device that selects one of several analog or digital input signals and forwards the selected input into a single line. A multiplexer of 2n inputs has n select lines, which are used to select which input line to send to the output. o An electronic multiplexer makes it possible for several signals to share one device or resource, for example one A/D converter or one communication line, instead of having one device per input signal. o On the other end, a demultiplexer (or demux) is a device taking a single input signal and selecting one of many data-output-lines, which is connected to the single input. A multiplexer is often used with a complementary demultiplexer on the receiving end. o An electronic multiplexer can be considered as a multiple-input, single-output switch, and a demultiplexer as a single-input, multiple-output switch. The schematic symbol for a multiplexer is an isosceles trapezoid with the longer parallel side containing the input pins and the short parallel side containing the output pin. The schematic on the right shows a 2-to-1 multiplexer on the left and an equivalent switch on the right. The sel wire connects the desired input to the output.


o DG409 Differential 4-Channel monolithic CMOS analog multiplexers are drop-in replacements for the popular DG508A and DG509A series devices. It include an array of eight analog switches, a TTL/CMOS compatible digital decode circuit for channel

selection, a voltage reference for logic thresholds and an ENABLE input for device selection when several multiplexers are present. o The DG409 feature lower signal ON resistance (<100) and faster switch transition time (tTRANS < 250ns) compared to the DG509A. Charge injection has been reduced, simplifying sample and hold applications. The improvements in the DG408 series are made possible by using a high-voltage silicon-gate process. An epitaxial layer prevents the latch-up associated with older CMOS technologies. Power supplies may be singleended from +5V to +34V, or split from 5V to 20V. The analog switches are bilateral, equally matched for AC or bidirectional signals. The ON resistance variation with analog signals is quite low over a 5V analog input range.

Pin Descriptions - (DG409) PIN SYMBOL DESCRIPTION

1 2 3 4 5 6 7 8 9


Logic Decode Input (Bit 0, LSB) Enable Input Negative Power Supply Terminal Source (Input) for Channel 1a Source (Input) for Channel 2a Source (Input) for Channel 3a Source (Input) for Channel 4a Drain a (Output a) Drain b (Output b)

10 11 12 13 14 15 16


Source (Input) for Channel 4b Source (Input) for Channel 3b Source (Input) for Channel 2b Source (Input) for Channel 1b Positive Power Supply Terminal Ground Terminal (Logic Common) Logic Decode Input (Bit 1, MSB)

Features ON Resistance (Max, 25C). . . . . . . . . . . . . . . . . . . 100 Low Power Consumption (PD) . . . . . . . . . . . . . . .<11mW Fast Switching Action - tTRANS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . <250ns - tON/OFF(EN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . <150ns Low Charge Injection Upgrade from DG508A/DG509A TTL, CMOS Compatible Single or Split Supply Operation Pb-Free Plus Anneal Available (RoHS Compliant)

Applications Data Acquisition Systems Audio Switching Systems Automatic Testers Hi-Rel Systems

Sample and Hold Circuits Communication Systems Analog Selector Switch


An analog-to-digital converter (abbreviated ADC, A/D or A to D) is a device which converts a continuous quantity to a discrete time digital representation. An ADC may also provide an isolated measurement. The reverse operation is performed by a digital-to-analog

converter (DAC). Typically, an ADC is an electronic device that converts an input analog voltage or current to a digital number proportional to the magnitude of the voltage or current. However, some nonelectronic or only partially electronic devices, such as rotary encoders, can also be considered ADCs. The digital output may use different coding schemes. Typically the digital output will be a two's complement binary number that is proportional to the input, but there are other possibilities. An encoder, for example, might output a Gray code. Because the Analog-to-Digital Converter (A/D Converter or ADC) has both analog and digital functions, it is a mixed-signal device. Many of us consider the ADC to be a mysterious device. It can, however, be considered very simply to be the instrument that it is: a device that provides an output that digitally represents the input voltage or current level. Notice I said voltage or current. Most ADCs convert an input voltage to a digital word, but the true definition of an ADC does include the possibility of an input current. An ADC has an analog reference voltage or current against which the analog input is compared. The digital output word tells us what fraction of the reference voltage or current is the input voltage or current. So, basically, the ADC is a divider. An ADC has n-bit resolution where n can be 8,10,12,16 or even 24 bits. The higher resolution ADC provides a smaller step size, where step size is the smallest change that can be discerned by an ADC. This is shown in table 8-1. In addition to resolution, conversion time is another major factor in judging an ADC. Conversion time is defined as the time it takes the ADC to convert the

analog input to a digital(binary) number. The ADC chip are either parallel or serial. In parallel ADC , 8 or more pins dedicated to bringing out the binary data, but in serial ADC only 1 pin for data out.

n-bit 8 10 12 16

Number of steps 256 1024 4096 65536

Step size(mV) 5/256=19.53 5/1024=4.88 5/4096=1.2 5/65536=0.076

Table 8-1: resolution vs. step size for ADC

3.4.1 ADC0804
The ADC0804 IC is an 8-bit parallel ADC in family of the ADC0800 series from National Semiconductors. It is available from many other manufacturers. It works with +5 volts and has a resolution of 8 bits. In the ADC0804, the conversion time varies depending on the clocking signals applied to the CLK IN pin, but it can not be faster than 110 sec.


CS: chip select is an active low input used to activate the ADC0804 chip. To access the ADC0804, this pin is must be low. RD(read): this is an input signal and is active low. The ADC converts the analog input to its binary equivalent and holds it in an internal register. RD is used to get the converted data out of the ADC0804 chip. When CS=0, if a high-to-low pulse is applied to the RD pin, the 8-bit

digital output shows up at the D0-D7 data pins. The Rd pin is also referred to as output enable (OE). WR(write): this is an active low input used to inform the ADC0804 to start the conversion process. If CS=0 when WR makes a low-to-high transition, the ADC0804 starts converting the analog input value of Vin to an 8-bit digital number. The amount of time it takes to convert varies depending on the CLK IN and CLKR values. When the data conversion is complete. The INTR pin is forced low by the ADC0804. CLK IN and CLK R: CLK IN is an input pin connected to an external clock source when an external clock is used for timing. The 804 has an internal clock generator. To use the internal clock generator of the ADC0804, the CLK IN and CLK R pins are connected to a capacitor and a resistor. In that case clock frequency is determined by the equation: f = 1/1.1RC INTR(interrupt): this is an output pin and is active low. It is a normally high pin and when the conversion is finished, it goes low to signal the CPU that the converted data is ready to be picked up. After INTR goes low, we makes CS=0 and send a high-to-low pulse to the RD pin to get the data out of the ADC0804 chip. Vin(+) and Vin(-): these are the differential analog inputs where Vin=Vin(+) Vin(-). Often the Vin(-) pin is connected to ground and the Vin(+) pin is used as the analog input to be converted to digital. Vcc: this is the +5 volt power supply. It is also used as a reference voltage when the Vref/2 input is open. Vref/2: pin 9 is an input voltage used for the reference voltage. If this pin is open, the analog input voltage for the ADC0804 is in the range of 0 to 5 volts. However, there are many applications where the analog input applied to Vin needs to be other than the 0 to +5V range. Vref/2 is used to implement analog input voltages other than 0 to 5V.

D0-D7: D0-D7 are the digital data output pins since ADC0804 is a parallel ADC chip. These are tri-state buffered and the converted data is accessed only when CS=0 and RD is forced low. Analog ground and digital ground: these are the input pins providing the ground for both the analog and the digital signal. Analog ground is connected to the ground of the analog Vin while digital ground is connected to the ground of the Vcc pin. The reason of having 2 ground pins is to isolate the analog Vin signal from transient voltages caused by digital switching of the output D0-D7. Such isolation contributes to accuracy of the digital data output. Clock source for ADC0804: the speed at which an analog input is converted to the digital output depends on the speed of the clk input. The typical operating frequency of ADC0804 is approximately 640kHz at 5 volts.


A microcontroller (sometimes abbreviated C, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications. Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, and toys. By reducing the size and cost compared to a design that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes. Mixed signal microcontrollers are common, integrating analog components needed to control non-digital electronic systems. Some microcontrollers may use Four-bit words and operate at clock rate frequencies as low as 4 kHz, for low power consumption (milliwatts or microwatts). They will generally have the ability to retain functionality while waiting for an event such as a button press or other interrupt; power consumption while sleeping (CPU clock and most peripherals off) may be just nanowatts, making many of them well suited for long lasting battery applications. Other microcontrollers

may serve performance-critical roles, where they may need to act more like a digital signal processor (DSP), with higher clock speeds and power consumption. Eight-bit micro-controllers are the most popular micro-controllers in use today. It has very useful word size for everyday controller task. Capable of 256 decimal values, or qyarter-percent resolution, the 1-byte data word is adequate for many control and monitoring applications. In addition, most low cost RAM and ROM memories store 1 byte per memory location for easy interfacing to an 8-bit micro-controller. Figure 9.1 shows the block diagram of 8-bit micro-controller. Unique features of microcontroller are o Internal ROM and RAM o I/O ports with programmable pins o Timers and counters o Serial data communication. The figure also shows the usual CPU components: program counter, ALU, working registers and clock circuits. The architecture consists of these specific features: Eight bit CPU with registers A and B. Sixteen-bit program counter (pc) and data pointer (DPTR) Eight- bit program status word (PSW) Eight-bit stack pointer(SP) Internal ROM or EPROM of 0 to 4K Internal RAM of 128 bytes: Four register banks, each containing eight registers Sixteen bytes, which may be addressed at the bit level Eighty bytes of general-purpose data memory

Thirty-two input/output pins arranged as four 8-bit ports: P0-P3 Two 16-bit timer/counters: T0 and T1 Full duplex serial data receiver/transmitter: SBUF Control registers: TCON, TMOD,SCON, PCON,IP, and IE Two external and three internal interrupt sources

Figure 9.1 8051 block diagram

3.5.1 The 8051 oscillator and clock

The heart of the 8051 is the circuitry that generates the clock pulses by which all internal operations are synchronized. Pins XTAL1 and XTAL2 are provided for connecting a resonant network to form an oscillator. A quartz crystal and capacitors are employed. The crystal frequency is the basic internal clock frequency of the micro controller. Serial data communication needs often dictate the frequency of the oscillator because of the requirement that internal counters must divide the basic clock rate to yield standard communication bit per second (baud) rates.

3.5.2 Program counter and data pointer

The 8051 contains two 16-bit registers: the program counter (pc) and the data pointer (DPTR). Each is used to hold the address of a byte in memory. Program instruction bytes are fetched from locations in memory that are addresses by the pc. Program ROM may be on chip at addressed 0000h to 0FFFh, external to the chip for addresses that exceed 0FFFh, or totally external for all addresses from 0000h to FFFFh. The pc is the only register that does not have an internal address. The DPTR register is made up of two 8-bit registers, named DPH and DPL, which are used to furnish memory addresses for internal and external code access and external data access. DPTR does not have a single internal address; DPH and DPL are each assigned an address.

3.5.3 A and B CPU registers

The 8051 contains 34 general-purpose, or working, registers. Two of these, registers A and B, hold results of many instructions, particularly math and logical operations of the 8051 central processing unit(CPU). The other 32 are arranged as part of internal RAM in four banks, B0-B3, of eight registers and comprise the mathematical core. The accumulator A register is the most versatile of the two CPU registers and is used for many operations, including addition, subtraction, integer multiplication and division and Boolean bit manipulations.

3.5.4 Flags and the program status word (PSW)

Flags are 1-bit registers provided to store the result of certain program instructions. Other instruction can test the condition of the flags and make decisions based on the flag states. The

flags may be addressed, they are grouped inside the program status word (PSW) and the power control (PCON) register. The 8051 has four math flags that respond automatically to the outcomes of math operations and three general-purpose user flags including carry (C) auxiliary carry (AC), overflow (OV), and parity (P). The program status word is shown in below figure. The PSW contains math flags, user program flag F0, and the register select bits that identify which of the four general-purpose register banks is currently in use by the program. The remaining two user flags, GF0 and GF1, are stored in PCON.

3.5.5 Internal memory

The 8051 has internal RAM and ROM memory. Additional memory can be added externally using suitable circuits. Unlike Microcontroller with von neumann architectures, which can use a single memory address for either program code or data, but not for both, the 8051 has a harvard architecture, which uses the same address, in different memories, for code and data.

3.5.6 Internal RAM

The 128-byte internal RAM is organized into three distinct areas: 1. Thirty-two bytes from address 00h to 1Fh that make up 32 working registers organized as four banks of eight registers each. The four register bank are numbered 0 to 3 and are made up of eight registers named R0 to R7. 2. A bit- addressable area of 16 bytes occupies RAM byte addresses 20h to 2Fh, forming a total 128 addressable bits. An addressable bit may be specified by its bit address or byte address. 3. A general-purpose Ram area above the bit area, addressable as bytes.

3.5.7 Ports
Port 0: port 0 pins may serve as inputs, outputs, or, when used together, as a bidirectional loworder address and data bus for external memory. For example, when a pin is to be used as an input, a 1 must be written to the corresponding port 0 latches by the program, thus turning both of the output transistors off, which in turn causes the pin to float in a high impedance state, and the pin is essentially connected to the input buffer. When used as an output, the pin latches that are programmed to a 0 will turn on the lower FET, grounding the pin. All latches that are programmed to a 1 still float; thus external pull up resistors will be needed to supply a logic high when using port 0 as an output. Port 1: port 1 pins have no dual functions. Therefore, the output latch is connected directly to the gate of the lower FET, which has an FET circuit labeled internal FET pull up as an active pull up load. Used as an input, a 1 is written to the latch, turning the lower FET off; the pin and the input to the pin buffer are pulled high by the FET load. An external circuit can overcome the highimpedance pull up and drive the pin low to input a 0 or leave the input high for a 1.

If used as an output, the latches containing a 1 can drive the input of an external circuit high through the pull up. If a 0 is written to the latch, the lower FET is on, the pull up is off, and the pin can drive the input if the external circuit low. Port 2: port 2 may be used as an input/ output port similar in operation to port 1. The alternate use of port 2 is to supply a high-order address byte in conjunction with the port 0 low-order byte to address external memory. Port 2 pins are momentarily changed by the address control signals when supplying the high byte a 16-bit address. Port 2 latches remain stable when external memory is addressed, as they do not have to be turned around (set to 1) for data input as is the case for port 0. Port 3: port 3 is an input/ output port similar to port 1. The input and output functions can be programmed under the control of the P3 latches or under the control of various other special function registers. Each pin of port 3 may be individually programmed to be used either as I/O or as one of the alternate function.

The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with insystem programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller, which provides a highly flexible and cost-effective solution to many, embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a sixvector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes.

The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM con-tents but freezes the oscillator, disabling all other chip functions until the next interrupt.

FEATURES OF AT89S52 Compatible with MCS-51 Products

8K Bytes of In-System Reprogrammable Flash Memory Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 256 x 8-bit Internal RAM 32 Programmable I/O Lines Three 16-bit Timer/Counters Eight Interrupt Sources Programmable Serial Channel Low-power Idle and Power-down Modes 4.0V to 5.5V Operating Range Full Duplex UART Serial Channel Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag Fast Programming Time Flexible ISP Programming (Byte and Page Mode)

Applications for Atmel Microcontrollers

Automotive Building Automation Home Appliances

Home Entertainment Industrial Automation Lighting Metering Mobile Electronics PC Peripherals

3.6 RS232C
In telecommunications, RS-232 (Recommended Standard 232) is the traditional name for a series of standards for serial binary single-ended data and control signals connecting between a DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment). It is commonly used in computer serial ports. The standard defines the electrical characteristics and timing of signals, the meaning of signals, and the physical size and pin out of connectors. The current version of the standard is TIA-232-F Interface Between Data Terminal Equipment and Data Circuit-Terminating Equipment Employing Serial Binary Data Interchange, issued in 1997. RS-232 was first introduced in 1962. The original DTEs were electromechanical teletypewriters and the original DCEs were (usually) modems. When electronic terminals (smart and dumb) began to be used, they were often designed to be interchangeable with teletypes, and so supported RS-232. The C revision of the standard was issued in 1969 in part to accommodate the electrical characteristics of these devices. Since application to devices such as computers, printers, test instruments, and so on was not considered by the standard, designers implementing an RS-232 compatible interface on their equipment often interpreted the requirements idiosyncratically. Common problems were nonstandard pin assignment of circuits on connectors, and incorrect or missing control signals. The lack of adherence to the standards produced a thriving industry of breakout boxes, patch boxes, test equipment, books, and other aids for the connection of disparate equipment. A common deviation from the standard was to drive the signals at a reduced voltage: the standard requires the transmitter to use +12 V and 12 V, but requires the receiver to distinguish voltages as low as +3 V and -3 V. Some manufacturers therefore built transmitters that supplied +5 V and -5 V and labeled them as "RS-232 compatible." Later personal computers (and other devices) started to make use of the standard so that they could connect to existing equipment. For many years, an RS-232-compatible port was a standard feature for serial communications, such as modem connections, on many computers. It remained in widespread use into the late 1990s. In personal computer peripherals it has largely been supplanted by other interface standards, such as USB. RS-232 is still used to connect older designs of peripherals, industrial equipment (such as PLCs), console ports and special purpose equipment such as a cash drawer for a cash register.

The standard has been renamed several times during its history as the sponsoring organization changed its name, and has been variously known as EIA RS-232, EIA 232, and most recently as TIA 232. The standard continued to be revised and updated by the Electronic Industries Alliance and since 1988 by the Telecommunications Industry Association (TIA).[3]Revision C was issued in a document dated August 1969. Revision D was issued in 1986. The current revision is TIA-232-F Interface Between Data Terminal Equipment and Data CircuitTerminating Equipment Employing Serial Binary Data Interchange, issued in 1997. Changes since Revision C have been in timing and details intended to improve harmonization with the CCITT standard V.24, but equipment built to the current standard will interoperate with older versions. The RS232 standard is not TTL compatible; therefore, it requires a line driver such as the MAX232 chip to convert RS232 voltage levels to TTL levels, and vice versa. The interfacing of microcontroller with RS232 connectors via the MAX232 chip. The microcontroller has two pins that are used specifically for transferring and receiving data serially. These two pins are called TxD and RxD and are part of the port 3 group (p3.0 and 3.1). these pins are TTL compatible ; therefore, they require a line driver to make them RS232 compatible. One such driver is MAX232 chip. 3.6.1 MAX232

The MAX 232 converts from RS232 voltage levels to TTL voltage levels, and vice versa. One advantage of the MAX232 chip is that it uses a +5V power source voltage for 8051. The MAX232 has two sets of line drivers for transferring and receiving data as shown. The line drivers used for TxD are called T1 and T2, while the line drivers for RxD are designated as R! and R2. MAX232 requires four capacitors ranging from 1 to 22microF.



Transducer 1

I to V Converter

Instrument ation Amplifier1



Transducer 2 cer 1

I to V Converter

Instrument ation Amplifier2

LPF2 MUX RS232 Interfa ce

Transducer 3

I to V Converter

Instrument ation Amplifier3


Transducer 4

I to V Converter

Instrument ation Amplifier4


Data acquisition begins with the physical phenomenon that can be measured such as temperature, light intensity, gas pressure, fluid flow, and force. A transducer is a device that converts a physical quantity into a corresponding electrical signal (e.g., a voltage or current). The transducer output which is in the form of current is then converted to voltage form through I-V converter and then passed through instrumentation amplifier AD8226 is designed to work with a very wide range of voltages. It can operate on supplies ranging from 1.2 V to 18 V AD8226 inputs are designed to connect to real-world sensors. A low-pass filter provide a smoother form of a signal, removing the short-term fluctuations the multiple low-pass filter outputs are then sent to DG409 eight channel differential analog multiplexer and multiplexed output is obtained the analog output is sent to ADC0804 is a 8 bit a/d converter which converts the instrumentation amplifier output into digital form. The output of this is interfaced with the microcontroller AT89C52 for PC communication.

Testing of each components:
A transducer is a device that converts a physical property into a corresponding electrical signal (e.g., a voltage or current) that can easily be converted to electrical signal which is the input of our Data acquisition system. We have considered the output of transducer as current output in our project, we have built a current source circuit and tested its working which produces output of 4mA and 20mA as output

4.1 The current source circuit:

Design: 1. For 4mA output VIN=2.13V Rload=230ohm R1=81ohm 2. For 20mA output

VIN=2.13V Rload=21.3ohm R1=35ohm We obtained the current source output as 4mA and 20mA and the output is given as input to the I-V converter which is the next stage in our project to convert current to voltage source output which is required for the input to the instrumentation amplifier. The I-V converter circuitis designed and the output of I-V converter is obtained as 0v for 4mA and 5v for 20mA is obtained 4.2

4-20mA current to voltage converter (0-5V)

Design: Vin=3.6v I=4mA Output we obtained as Vout=0.3v

Vin=9.0v I=20mA output we obtained as Vout=5v We have designed the second order low pass filter circuit and tested its working for the given design.


Design: R1=68kohm R2=68kohm C1=C2=470nf, vin=1v