Vous êtes sur la page 1sur 23

1.

INTRODUCTION

1.1Problem definition/statement

The Gas Analyzer System (GAS) and DCS are incompatible as GAS is
manufactured by Hartmann & Braun and DCS is manufactured by EMMERSON.
The data sent by gas through the rs232 port is in floating point format, whereas data
recognizable by DCS is in integer form.
So we have to design a system that converts data format of GAS to a suitable
recognizable by the DCS

1.2 Literature survey

1.2.1 Gas Analyzer System


GAS ANALYSER SYSTEM is one system that measures the proportion of gases.If the
proportion of gases or the constituent elements is not measured properly, or if there is
even a slight error in the proportion in which the constituent elements are mixed, there
can be an error. This error could lead to a major accident.

Hence, utmost care needs to be taken while manufacturing these chemicals or fertilizers.
Before supplying the constituent gases or chemicals to the plants their proportion is
checked thoroughly using highly advanced instruments and machines. And only after
measuring, are the constituent mixtures or gases supplied to the plants.

1
1.2.2 Working Principle

The Gas Analyzer System measures the gases Carbon dioxide (CO2 in volume %),
Methane (CH4 in volume %), Oxygen (O2 in volume %), and Hydrogen (H2 in volume
%). The values can be calibrated and maintained in mA also.
The input to the system is the mixture of gases and the output of the system is the values
that are measured by the system.

The Gas Analyzer System has Central processing unit (CPU) to monitor the working of
the system. The system has a built in front panel, which displays the values that are
measured by the system. The CPU also has several ports to connect the system to other
devices like computer, etc.

1.2.3 External Interface

Information from the AO2000 ( Gas Analyzer of the Advance Optima series
manufactured by Hartmann & Braun ) can be transferred to a PC via the Modbus.
Measurement values, status signals and also signals of analog and digital inputs and
outputs are thus available for further processing.

The AO2000 Gas Analyzer supports the Modbus slave protocol with RTU (Remote
Terminal Unit) mode. The RS232 and the RS485 interface located on the RS232 / RS485
module in AO2000 are supported, where only one can be operated at a time.

Distributed control system


A DCS typically uses custom designed processors as controllers and uses both proprietary
interconnections and protocols for communicationA distributed control system (DCS)
refers to a control system usually of a manufacturing system, process or any kind of
dynamic system, in which the controller elements are not central in location (like the
brain) but are distributed throughout the system with each component sub-system
controlled by one or more controllers. The entire system of controllers are connected by

2
networks for communication and monitoring. Distributed Control Systems (DCSs) are
dedicated systems used to control manufacturing processes that are continuous or batch-
oriented

Gas Analyzer Block Diagram

3
1.3 Study and analysis
1.3.1 Modbus
Modbus is a serial communications protocol published by Modicon in 1979 for use with
its programmable logic controllers (PLCs). It has become a de facto standard
communications protocol in industry, and is now the most commonly available means of
connecting industrial electronic devices.

1.3.2 SERIAL COMMUNICATION

Serial communications is the process of sending data one bit at one time, sequentially,
over a communications channel or computer bus. This is in contrast to parallel
communications, where all the bits of each symbol are sent together. Serial
communications is used for all long-haul communications and most computer networks,
where the costs of cable and synchronization difficulties make parallel communications
impractical.

There are two basic types of serial communications, synchronous and asynchronous.
With synchronous communications, the two devices initially synchronize themselves to
each other, and then continually send characters to stay in synchronization. Even when
data is not really being sent, a constant flow of bits allows each device to know where the
other is at any given time. That is, each character that is sent is either actual data or an
idle character. Synchronous communications allows faster data transfer rates than
asynchronous methods, because additional bits to mark the beginning and end of each
data byte are not required. The serial ports on IBM-style PCs are asynchronous devices
and therefore only support asynchronous serial communications.

Asynchronous means "no synchronization", and thus does not require sending and
receiving idle characters. However, the beginning and end of each byte of data must be
identified by start and stop bits. The start bit indicates when the data byte is about to

4
begin and the stop bit signals when it ends. The requirement to send these additional two
bits causes asynchronous communication to be slightly slower than synchronous however
it has the advantage that the processor does not have to deal with the additional idle
characters.

An asynchronous line that is idle is identified with a value of 1 (also called a mark state).
By using this value to indicate that no data is currently being sent, the devices are able to
distinguish between an idle state and a disconnected line. When a character is about to be
transmitted, a start bit is sent. A start bit has a value of 0 (also called a space state). Thus,
when the line switches from a value of 1 to a value of 0, the receiver is alerted that a data
character is about to be sent.

1.3.3 RS-232
Devices which use serial cables for their communication are split into two categories.
These are DCE (Data Communications Equipment) and DTE (Data Terminal
Equipment.) Data Communications Equipment are devices such as your modem, TA
adapter, plotter etc while Data Terminal Equipment is your Computer or Terminal.
The electrical specifications of the serial port are contained in the EIA (Electronics
Industry Association) RS232 standard. It states many parameters few important one are
as shown below: -
A "Space" (logic 0) will be between +3 and +25 Volts.
A "Mark" (Logic 1) will be between -3 and -25 Volts.
The region between +3 and -3 volts is undefined
An open circuit voltage should never exceed 25 volts. (In Reference to GND)
A short circuit current should not exceed 500mA. The driver should be able to handle this
without damage.
Serial Ports come in two "sizes", There are the D-Type 25 pin connector and the D-Type
9 pin connector both of which are male on the back of the PC, thus you will require a
female connector on your device. Below is a table of pin connections for the 9 pin D-
Type connectors.

5
1.3.4 RS-232 LEVEL SHIFTER

Many microcontrollers have asynchronous serial ports, but their inputs and outputs use
5V logic rather than RS 232 voltage. Interfacing 5V logic to an RS 232 port requires
converting to and from RS 232 levels.5V logic means the logic levels used by TTL or
CMOS logic chips powered by a single +5V power supply, with signal voltages
referenced to ground. More positive logic level is logic high or logic 1,while less positive
logic level is logic low or logic0.

1.3.5 Microcontroller

The data acquired from the Gas Analyzer through the MAX-232 is transferred to the
serial port receiver of the microcontroller. This data is then modified by the
microcontroller and sent back through the transmitter port via MAX-232 to the DCS.

1.3.6 Block diagram

MAX 232
T1 IN T1 OUT

R1OUT R1 IN
RxD

6
TxD
Gas Analyzer

Microcontroller

MAX232

R1out R1in
RxD RS232
port

TxD T1out T1in

DCS

2. Proposal

2.1 Proposed work

7
The first part of the project deals with the converting the format of the data acquired from
the Gas Analyzer system to the format which is decodable by the DCS. This is done
implementing the Modbus Protocol.

The next part of the project includes developing a modbus interface for the above
retrieved data.

It is further planned for the development of a LAN Utility so that many terminals can
access the same data.

2.2 System requirement


The required parts:

1 x female serial port connector


1 x max 232
4 x 1uF capacitor
1 x 10uF capacitor
Atmega32L
Printer port
Software: WinAVR2006
Soldering iron, wires, breadboard etc.

2.3 Scope

We will implement Modbus Interface in the project. Modbus is a standard for


communications protocol in industry, and is now the most commonly available means of

8
connecting industrial electronic devices. Hence other industries, using electronic devices
that transmit and receive data serially can also remotely control their machines.

In company like R.C.F. the plants are located in remote areas. Engineers have to control
many parameters by sitting in control room. Thus development of Modbus interface can
be implemented on large scale practically.

3. Design of System

3.1 Modbus Protocol


3.1.1 Introduction

9
The MODBUS standard defines an application layer messaging protocol, positioned at
level 7 of the OSI model that provides "client/server" communications between devices
connected on different types of buses or networks. It standardizes a specific protocol on
serial line to exchange MODBUS request between a master and one or several slaves.
MODBUS Serial Line protocol is a Master-Slave protocol.

3.1.2 Modbus Protocol Message Structure

The Modbus protocol defines a message structure that controllers will recognize and use,
regardless of the type of networks over which they communicate. It describes the process
a controller uses to request access to another device, how it will respond to requests from
the other devices, and how errors will be detected and reported. It establishes a common
format for the layout and contents of message fields.

3.1.3 PARAMETER SETTINGS

In order to achieve successful data transfer, the parameters of both the ends of
communication link should be matched. The project includes Gas Analyzer System at one
end which uses Modbus protocol that has following serial port parameters,
Modbus address : 1
Modbus type : RS-232
Modbus baud rate : 19200

10
Modbus parity : none
Modbus stop bits : 1
Therefore the parameters of serial port of server PC have been set accordingly.

3.1.4 PORT PROGRAMMING


Port programming has been done to interface the Gas Analyzer System with server PC.

To obtain real time data, the parameters of both the terminals should be matched. The
data is transferred in modbus frame format via RS232.
This data is in ASCII format which is needed to be converted to Hexadecimal format.
Then the data field from the frame is to be extracted. The data values are in IEEE 754 32
Bit floating point representation.

The sign, exponent and mantissa are thus extracted and decoded to get the data value of
the composition of the gaseous components

3.2 RS-232
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 non-standard pin assignment of circuits on connectors, and incorrect or
missing control signals.

11
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 +12V and -12V, but requires the
receiver to distinguish voltages as low as +3V and -3V. Some manufacturers therefore
built transmitters that supplied +5V and -5V and labeled them as "RS-232 compatible."

In telecommunications, RS-232 (Recommended Standard 232) is a standard for serial


binary data signals connecting between a DTE (Data Terminal Equipment) and a DCE
(Data Circuit-terminating Equipment). It is commonly used in computer serial ports. A
similar ITU-T standard is V.24

12
Male RS232 Female RS232

3.2.1 Signals
Commonly-used signals are:
Transmitted Data (TxD)
Data sent from DTE to DCE.
Received Data (RxD)
Data sent from DCE to DTE.
Request To Send (RTS)
Asserted (set to 0) by DTE to prepare DCE to receive data. This may require action on
the part of the DCE, e.g. transmitting a carrier or reversing the direction of a half-duplex
channel. For the modern usage of "RTS/CTS handshaking," see the section of that name.

13
Ready To Receive (RTR)
Asserted by DTE to indicate to DCE that DTE is ready to receive data. If in use, this
signal appears on the pin that would otherwise be used for Request To Send, and the DCE
assumes that RTS is always asserted; see RTS/CTS handshaking for details.
Clear To Send (CTS)
Asserted by DCE to acknowledge RTS and allow DTE to transmit. This signaling was
originally used with half-duplex modems and by slave terminals on multidrop lines: The
DTE would raise RTS to indicate that it had data to send, and the modem would raise
CTS to indicate that transmission was possible. For the modern usage of "RTS/CTS
handshaking," see the section of that name.
Data Terminal Ready (DTR)
Asserted by DTE to indicate that it is ready to be connected. If the DCE is a modem, this
may "wake up" the modem, bringing it out of a power saving mode. This behaviour is
seen quite often in modern PSTN and GSM modems. When this signal is de-asserted, the
modem may return to its standby mode, immediately hanging up any calls in progress.
Data Set Ready (DSR)
Asserted by DCE to indicate the DCE is powered on and is ready to receive commands or
data for transmission from the DTE. For example, if the DCE is a modem, DSR is
asserted as soon as the modem is ready to receive dialing or other commands; DSR is not
dependent on the connection to the remote DCE (see Data Carrier Detect for that
function). If the DCE is not a modem (e.g. a null modem cable or other equipment), this
signal should be permanently asserted (set to 0), possibly by a jumper to another signal.
Data Carrier Detect (DCD)
Asserted by DCE when a connection has been established with remote equipment.
Ring Indicator (RI)
Asserted by DCE when it detects a ring signal from the telephone line.

3.3 MAX-232

14
When communicating with various micro processors one needs to convert the RS232
levels down to lower levels, typically 3.3 or 5.0 Volts..
Serial RS-232 (V.24) communication works with voltages -15V to +15V for high and
low. On the other hand, TTL logic operates between 0V and +5V . Modern low power
consumption logic operates in the range of 0V and +3.3V or even lower.

RS-232 TTL Logic


-15V … -3V +2V … +5V High
+3V … +15V 0V … +0.8V Low

Thus the RS-232 signal levels are far too high TTL electronics, and the negative RS-232
voltage for high can’t be handled at all by computer logic.
To receive serial data from an RS-232 interface the voltage has to be reduced. Also the
low and high voltage level has to be inverted.

This level converter uses a Max232 and five capacitors. The max232 is quite cheap.
The MAX232 from Maxim was the first IC which in one package contains the necessary
drivers and receivers to adapt the RS-232 signal voltage levels to TTL logic. It became
popular, because it just needs one voltage (+5V or +3.3V) and generates the necessary
RS-232 voltage levels.
Schematic of MAX232 interfaced with rs232

15
PIN OUT OF MAX232

16
MAX232(Full duplex)
The circuit below use MAX232 which is the MAXIM's devices.This circuit is very stable
and use for professional design. This device is inexpensive and it can provides 2 channel
for RS232 .
The MAX232 line drivers/receivers are designed for RS-232 and V.28 communications in
harsh environments. Each transmitter output and receiver input is protected against ?
15kV electrostatic discharge (ESD) shocks, without
latchup.It can operate from a Single +5V Power Supply.

MAX232 for RS232 transceiver

17
MAX 232 includes a Charge Pump, which generates +10V and -10V from a single 5v
supply. This I.C. also includes two receivers and two transmitters in the same package.
This is handy in many cases when you only want to use the Transmit and Receive data
Lines. You don't need to use two chips, one for the receive line and one for the transmit.
However all this convenience comes at a price, but compared with the price of designing
a new power supply it is very cheap.
There are also many variations of these devices. The large value of capacitors are not
only bulky, but also expensive. Therefore other devices are available which use smaller
capacitors and even some with inbuilt capacitors. (Note : Some MAX-232's can use 1
micro farad Capacitors). However the MAX-232 is the most common, and thus we will
use this RS-232 Level Converter in our examples

A standard serial interface for PC, RS232C, requires negative logic, i.e., logic 1 is -3V to
-12V and logic 0 is +3V to +12V. To convert TTL logic, say, TxD and RxD pins of the
microcontroller thus need a converter chip. A MAX232 chip has long been using in many
microcontrollers boards. It is a dual RS232 receiver / transmitter that meets all RS232
specifications while using only +5V power supply. It has two onboard charge pump
voltage converters which generate +10V to -10V power supplies from a single 5V supply.
It has four level translators, two of which are RS232 transmitters that convert
TTL/CMOS input levels into +9V RS232 outputs. The other two level translators are
RS232 receivers that convert RS232 input to 5V. Typical MAX232 circuit is shown
below.

18
3.4 Microcontroller
It is also possible to use microcontrollers to transmit and receive Serial data. Some of
these MCU's (Micro Controller Units) have built in UART's among other things. Take the
application we have used above. We want to monitor analog voltages using a ADC and
then send them serially to the PC. If the Microcontroller also has a ADC built in along
with the UART or SCI, then we could simply program the device and connect a RS-232
Line Driver. This would minimize your chip count and make your PCB much smaller.
Take another example, displaying the serial data to a common 16 character x 2 line LCD
display. A common problem with the LCD modules is they don't accept cartridge returns,
line-feeds, form-feeds etc. By using a microcontroller, not only can you emulate the
UART, but you can also program it to clear the screen, should a form-feed be sent or
advance to the next line should a Line-feed be sent.
Talking of chip count, most Microcontrollers have internal oscillators thus you don't
require the 74HC4060 14 Bit Binary Counter and Oscillator. Many Microcontrollers such
as the 68HC05J1A and PIC16C84 have a smaller pin count, than the 40 Pin UART. This
not only makes the project smaller in size, it reduces complexity of the PCB.
But there are also many disadvantages of the Microcontroller.
.We can either use 8051 or Atmel Mega 32L series microcontroller in our case.

Features

• High-performance, Low-power Microcontroller


• Advanced RISC Architecture
– 131 Powerful Instructions – Most Single-clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16 MHz
– On-chip 2-cycle Multiplier
• Nonvolatile Program and Data Memories
– 32K Bytes of In-System Self-Programmable Flash

19
Endurance: 10,000 Write/Erase Cycles
– Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
– 1024 Bytes EEPROM
Endurance: 100,000 Write/Erase Cycles
– 2K Byte Internal SRAM
– Programming Lock for Software Security
• JTAG (IEEE std. 1149.1 Compliant) Interface
– Boundary-scan Capabilities According to the JTAG Standard
– Extensive On-chip Debug Support
– Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface
• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
Mode
– Real Time Counter with Separate Oscillator
– Four PWM Channels
– 8-channel, 10-bit ADC
8 Single-ended Channels
7 Differential Channels in TQFP Package Only
2 Differential Channels with Programmable Gain at 1x, 10x, or 200x
– Byte-oriented Two-wire Serial Interface
– Programmable Serial USART

The ATmega32 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced
RISC architecture. By executing powerful instructions in a single clock cycle, the
ATmega32 achieves throughputs approaching 1 MIPS per MHz allowing the system
designer to optimize power consumption versus processing speed.
– Master/Slave SPI Serial Interface
– Programmable Watchdog Timer with Separate On-chip Oscillator

20
– On-chip Analog Comparator
• Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated RC Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby
and Extended Standby
• I/O and Packages
– 32 Programmable I/O Lines
– 40-pin PDIP, 44-lead TQFP, and 44-pad MLF
• Operating Voltages
– 2.7 - 5.5V for ATmega32L
– 4.5 - 5.5V for ATmega32
• Speed Grades
– 0 - 8 MHz for ATmega32L
– 0 - 16 MHz for ATmega32

21
MAX 232 AND MICROCONTROLLER INTERFACE

22
4. Conclusion
4.1 Status
We have become familiar with the working of DCS and Gas analyser system and
observed that both follow different standards.In order to interface them we have designed
a data converter for which we have studied the basics of RS232,MAX232,Atmega 32 and
other miscellaneous devices.

4.2 Future course of action

During the second phase of the project, i.e. during the semester VIII of our course, we
intend to carry out the following steps towards completion of the project:

Development of interface for the DCS and Gas analyzer


Analyzing the data transmitted by the gas analyzer
Coding of the microcontroller
Implementing error control
Establishing the various parameters as references
To carry out field testing of the processes

4.3 Further features can be added to the project like:-


Security can be provided to the software.
This project can be further extended for interfacing other machines.

23

Vous aimerez peut-être aussi