Anda di halaman 1dari 70

P.V.G.’s College of Engineering and Technology, Pune.

A

PROJECT

ON

MODBUS BASED DISTRIBUTED CONTROL SYSTEM

BY

PUJARI SUJAY

TOPHKHANE SAURABH

KUMTHEKAR AVADHOOT

Under Guidance of

Prof. Mrs. M. P. Atre

Technical Assistance

W.A.K.E.

Project Category

INHOUSE PROJECT

1

CERTIFICATE This is to certify that following students have satisfactorily completed their project titled ‘

CERTIFICATE

This is to certify that following students have satisfactorily completed their project titled MODBUS BASED DISTRIBUTED CONTROL SYSTEM’, towards the fulfillment of Bachelor’s Degree in Electronics & Telecommunication Engineering.

Kumthekar Avadhoot D.

B-3073034

Pujari Sujay G.

B-3073046

Tophkhane Saurabh S.

B-3073086

Prof. Mrs. M. P. Atre.

Project Guide

2

Prof. N. P. Deshpande

Head, Dept of E & TC

ACKNOWLEDGEMENT

Firstly, we would like to express our sincere thanks to our Internal Guide Prof. Mrs. M.P. Atre whose guidance, supervision, patience and support has been instrumental in the successful completion of this project.

We would also like to thank our Project Coordinator, Prof. Mr. P. G. Shete, our Head of the department, Prof. Mr. N. P. Deshpande and Prof. R. G. Kaduskar for supporting the project and extending their help and co-operation.

We would like to thank ‘W.A.K.E.’ foundation and our classmates for their timely help and unconditional support. Without them, lot of our problems would have been left unsolved.

Last but not the least; we would like to extend our appreciation to the non-

teaching staff who are always eager to help us by providing us with the necessary

equipments.

Pujari Sujay Girish.

Kumthekar Avadhoot Dattatraya

Tophkhane Saurabh Sanjay.

3

TABLE OF CONTENT:

SR.NO

TITLE

PAGE

NO.

I

LIST OF FIGURES

6

II

LIST OF TABLES

7

1.

SYNOPSIS

8

2.

LITERATURE SURVEY

9

3.

INTRODUCTION

10

4.

SYSTEM SPECIFICATION

12

5.

BLOCK DIAGRAM

14

6.

BLOCKWISE DESIGN

15

7.

DESIGN APPROACH

16

1)SERVER

2)RS485 IMPLEMENTATION

3)SCADA SYSTEM

8.

HARDWARE DESIGN

19

9.

SOFTWARE DESIGN

29

10.

APPLICATION

48

11.

TESTING

50

1 2.

FUTURE SCOPE

54

13.

BIBLIOGRAPHY

55

4

14.

APPENDIX

56

15.

CIRCUIT DIAGRAM

62

16.

DATA SHEETS

69

I. LIST OF FIGURES

Figure5.1

Block diagram DCS……………………………………………………

14

Figure 6.1

 

to

6.4

Internal Block diagram of all modules…………………………….… 15

Figure7.1

DCS system flow chart…………………………………………….……16

Figure8.1

power supply design……………………………………………….……20

5

Figure8.2

RS485 biasing circuit……………………………………………….…

24

Figure8.3

Driver circuit for Buzzer……………………………………….………

25

Figure8.4

Signal conditioning circuit……………………………………………….27

Figure9.1

Network layer…………………………………………………….……

30

Figure9.2

Modbus Transaction diagram…………………………….…….………36

Figure9.3

………….….………37

To

9.8

Flowcharts of various functions

……………………………

to…

42

Figure9.9

RTU frame……………………………………………………………… 45

Figure10.1

Application block diag…………………………………………… …….48

Figure14.1

Modbus protocol &ISO model comparison…………………….……

56

Figure14.2

Modbus Frame…………………………………………………………

58

Figure14.3

Address rule……………………………………………………………

58

Figure14.4

4 wire Topology for RS485…………………………………………… 59

Figure14.5

CRC calculations………………………………………………………

59

Figure15.1

Module C………………………………………………………………….63

Figure15.2

Module B………………………………………………………………….64

Figure15.3

Module A………………………………………………………………….65

Figure15.4

Module D………………………………………………………………….66

II.

LIST OF TABLES

Table9.1

System supported functions……………………………………………30

Table9.2

Exception code………………………………………………………… 31

Table9.3

Address allotment of Module A………………………………………

43

Table9.4

Address allotment of Module B…….………………………………… 43

Table9.5

Address allotment of Module C………………………………………

44

Table14.1

Primary table………………………………………………….………… 57

6

Table15.1

Components & Bill…………………………………………………

1. SYNOPSIS

60,61

Modbus based Distributed control System (DCS)

Domain: Industrial process automation.

Hardware Platform: 8-bit microcontroller.

Programming Language: Embedded C.

Application layer protocol: Modbus Protocol (A de-facto Industrial Application layer protocol),SPI.

Physical Layer Interface: RS-232, RS-485.

Parameter monitoring SCADA

7

System will continuously monitor the temperature and stores the value in its internal memory. On receiving a Modbus command from the PC based software / Control system with specified formatted protocol will send the read value as a Modbus response. A temperature can be set through the PC based software which can send indication over Modbus at some other remote place. A 24V to 5V DC/DC Converter is used to power up the system

.

According to alarm Trigger Pt. Setting Buzzer & Led’s will indicate. Control over all 3 modules from module D or Master is over MODBUS-RS485.

2. LITERATURE SURVEY

To get basic knowledge about “Modbus protocol”, we referred following Web resources:

1. www.MODICON.com

2. www.wikipedia.com

3. www.google.com.

After getting used to with protocol, we started from Physical layer which tells about topology, for that we referred Application Note[AN002] from www.modicon.com,[Mazi] and [JanS] .

8

For

RS232

we

referred:

Application

note

[AN723],[AN2020]

from

www.maxim.com.

 

For

RS485

we

referred:

Application

note[AN1063],[AN736],AN[723]

from

www.maxim.com.

& [SLLA272B] from www.TI.com

Power supply design concepts were found from [Boye].

Moving further towards upper layers, we decided to implement system modules using Atmega32 controller, which is 8-bit controller from AVR family. To study this we referred [DhanG].

Software tools used:

IDE: AVRSTUDIO4, Compiler: WINAVR, Downloader: FreeIsp,

Ref: Manual: doc2510, doc1019.

While working on UART again [JanS] was useful.

To Implement Application layer with device profile

Ref: Application Note [AN001], [AN003]

3. INTRODUCTION

Name of project:

Our project is named as “Modus based Distributed Control System”. It is basically a model which just demonstrates system

Need of project:

In industries there are certain processes where human intervention is not possible due to harsh environmental conditions and criticality of application, but at the same time physical parameter like temperature, pressure, air flow etc. have to be monitored and controlled. Remote monitoring and controlling is must in such cases, which is RTU .

Our system is a RS-232/ RS485 based temperature transmitter can read the surrounding temperature, send this data over Modbus protocol to the PC based software or a PLC control system which controls it. A distributed control system (DCS) 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

9

DCS is a very broad term used in a variety of industries, to monitor and control distributed equipment.

Why MODBUS?

1)It is openly published and royalty-free

2)Relatively easy industrial network to deploy

3)It moves raw bits or words without placing many restrictions on vendors

Basic idea & approach:

we are going to develop distributed control system

Which consist of 4 modules->master taking service from 3 slaves (Servers).

Master-> pc : module D.

Slaves->Module A: Temp module

Module B: Generic module

Module C: Alarm & process status indicator .

They all will communicate using Modbus protocol over RS-485.

Module-D

Is PC based Modbus Master running SCADA - supervisory control and data acquisition systems

Module-A

10

System will continuously monitor the temperature and stores the value in its internal memory. At particular trigger point of temperature set by master alarm module will come in picture.

Module-B

Generic module is universal sensing device. User also has to feed data read in the form of 0-5v and conversion factor.

Module-C

This module consists of two parts

1) To indicate exceeding of trigger point temperature .

2) For the purpose of controlling part 3LED’s are provided to show different works or functions.

4. SYSTEM SPECIFICATION

Power I/P:

230 v ac, 50Hz

1)Module A:

Intelligent Temperature Sensor Module

Temp Range:

0 to 100˚C

Display:

Communication port:

Resolution

:

16x2 Character Display

Modbus over RS485 (TWI).

0.1˚C

2)Module B: Generic Analog I/P Module

Variable I/p:

Display:

0 to 5v simulating any physical quantity

16x2 Character Display

Communication port: Modbus over RS485 (TWI).

11

Resolution:

10bit

3)Module C:Alarm & process status indicator

Communication port: Modbus over RS485 (TWI)

Two Alarm Signals:

Visuals: 3 LEDs .

Audio: Buzzer .

4) RS232-Rs485 Converter

2 communication port: RS232/RS485

RS 485-2 wire configuration

Calculated Termination Resistance

5) Module D: PC Based mini SCADA System

VB/Turbo c Based Front End s/w

Communication: Modbus Master over RS 232

Data Logging Facility

Alarm Trigger Pt Setting

Monitoring Parameter

6) UART:

Baud Rate Supported (bps):4800, 9600, 19.2k, 38.4k, 57.6k, and 115.2k

Data Bits: 7, 8

Parity: N, 0, E

Stop bits: 1(for E), 2

12

Flow Control: None

Domain:

Hardware Platform:

Programming Language:

Application layer protocol:

Physical Layer Interface:

Data Link Layer Interface:

Parameter monitoring Software using (PC based Mini SCADA system) :

Industrial process automation. 8-bit microcontroller.(ATMega32) Embedded C. Modbus Protocol RS-232, RS-485. UART

VB 6.0 / VC++.

5. BLOCK DIAGRAM

LT1 RS RS PC - - (SCADA 232 SYSTEM) Generic D: MODBUS Master Device B:
LT1
RS
RS
PC
-
-
(SCADA
232
SYSTEM)
Generic
D: MODBUS Master
Device
B: MODBUS Slave
Temperatur
e Module
Alarm
and
process
A: MODBUS Slav
status
13

Fig 5.1

C: MODBUS Slave

LT2

6. BLOCKWISE DESIGN

1) MODULE A: Temp Module

A TTL B TTL to
A
TTL
B
TTL to

2) MODULE B : Generic device

A TTL B TTL to
A
TTL
B
TTL to

Controller

Fig 6.1

Controller

Fig 6.2

ADC

TEMPRATURE SENSOR
TEMPRATURE SENSOR

TEMPRATURE

SENSOR

Fig 6.1 Controller Fig 6.2 ADC TEMPRATURE SENSOR ADC 0 to 5V analog I/p 3) MODULE

ADC

0 to 5V analog I/p
0 to 5V analog I/p

0 to 5V analog I/p

0 to 5V analog I/p
Fig 6.2 ADC TEMPRATURE SENSOR ADC 0 to 5V analog I/p 3) MODULE C: Alarm and

3) MODULE C: Alarm and Process status indicator

A

TTL to
TTL to

TTL

Controller

14

TEMPRATURE SENSOR ADC 0 to 5V analog I/p 3) MODULE C: Alarm and Process status indicator
TEMPRATURE SENSOR ADC 0 to 5V analog I/p 3) MODULE C: Alarm and Process status indicator

B

Fig 6.3

B Fig 6.3 4) MODULE D: PC based mini SCADA system Serial port 232 RS232 TTL

4) MODULE D: PC based mini SCADA system

Serial port 232 RS232 TTL PC RS232 To TTL Fig 6.4 TTL to 485
Serial port
232
RS232
TTL
PC
RS232
To
TTL
Fig 6.4
TTL to
485

7. DESIGN

APPROACH

15

A

B

Fig 7.1

DCS system Flowchart

->

SLAVE BOOTING PROCESS

SLAVE BOOTING PROCESS
Fig 7.1 DCS system Flowchart -> SLAVE BOOTING PROCESS MASTER BOOTING POLL FOR SLAVE DEVICES SET
MASTER BOOTING

MASTER BOOTING

MASTER BOOTING
MASTER BOOTING
system Flowchart -> SLAVE BOOTING PROCESS MASTER BOOTING POLL FOR SLAVE DEVICES SET CONDITION FOR ALARM
POLL FOR SLAVE DEVICES

POLL FOR SLAVE DEVICES

POLL FOR SLAVE DEVICES
POLL FOR SLAVE DEVICES
SLAVE BOOTING PROCESS MASTER BOOTING POLL FOR SLAVE DEVICES SET CONDITION FOR ALARM START MONITORING THE
SET CONDITION FOR ALARM

SET CONDITION FOR ALARM

SET CONDITION FOR ALARM
SET CONDITION FOR ALARM
BOOTING POLL FOR SLAVE DEVICES SET CONDITION FOR ALARM START MONITORING THE PROCESS YES NO CHECK
START MONITORING THE PROCESS

START MONITORING THE PROCESS

START MONITORING THE PROCESS
START MONITORING THE PROCESS
DEVICES SET CONDITION FOR ALARM START MONITORING THE PROCESS YES NO CHECK FOR SET ALARM OR
YES NO CHECK FOR
YES
NO
CHECK
FOR
SET ALARM OR LED’S
SET ALARM OR LED’S

SET ALARM

OR LED’S

System is broadly divided in 3 parts

1) SERVER

2) RS485 implementation

1) SERVER

3) SCADA system

16

Hardware approach

:

These are modules A,B&C

In which common requirement s are

8-bit microcontroller->AVR ATMEGA32 selected

Power supply ->230v to 9v conversion.

For the purpose of testing of various interfaces like

1) Ttl-Rs232

2) Downloading section

3) Display unit

4) ADC interface

& many more

A unique Development board built around ATmega32 Is required.

Module a)

1) Sensor selection according to resolution and range->LM35

2) Signal condition circuit-

3) LCD interface

Module b)

To make it user friendly, Menu driven->tactile switches & LCD

Device protection circuitry

Module c)

Hooter and led indicator.

Logical approach:

17

Module b) module will show 2 modes on display

1) Program mode

User can select parameter to be sensed & its convergent

factor

2) Run mode

Run mode is common for all modules or server

It just means server waiting for command from client & eager to respond.

2) RS-485 implementation

1) For level conversion needed for slaves ->

RS485 –TTl Transceivers (for slaves)

2) For level conversion needed for master ->

RS232-RS485 ->

A) RS232 to TTL and TTl to RS485 transceiver

B) RS232 to RS485 transceiver

3) Termination resistance selection->

3) SCADA system

1) Modbus Master- slave driver implementation

Programming language-visual basic

2) Graphics User Interface

18

8. HARDWARE DESIGN

1)

POWER SUPPLY DESIGN

19

1 N 4 0 0 7 U 2 L M 7 8 0 5 C
1
N
4 0
0 7
U
2
L
M
7 8
0 5 C
/ TO
1
3
I N
O U
T
+
-
Vin=24V
4
1
DC
Vout=5V
regulated
6 0
0
u F
0
.
3
3 u
F
0
.
1
u F
3
2
2
G N
D

Fig 8.1

As shown in above diagram;

Bridge rectifier:

I/P=24V.

It is commonly used circuit for large amount of DC power. At one time two diodes conduct simultaneously. We are using 1N4007 diodes.

Voltage drop=0.7*2=1.4V

So O/P of bridge rectifier is

24-1.4=22.6V.

Filters:

A circuit that removes ripples from a rectifier output without affecting DC voltage

is

known as filter.

We are going to use capacitor filter. We will assume ripple factor as 5%.

We know;

Ripple factor= r=Vr (rms) /Vdc.

=Idc/4*3

1/2 *f*C*Vdc

=1/4*3 1/2

*f*C*R L

Substituting values;

20

0.05 =1/ 4*3 1/2 *f*C*R L

Now we have for our modules;

Idc=150mA

R L =5/150mA=33.33ohm

So we have

C = 1732uF.

IC7805:

0.05=

1/ 4*3 1/2 *f*C*33.33

C=2200uF (standard).

From datasheet we have;

1. Wide input range: 7-35V

2. Max current capacity:1A

3.Output voltage : 5V regulated

Then i/p of IC 7805 ;

Vdc=22.6v

(I/P range for ic 7-35V)

Capacitors C in and C o are used at input and output side of IC….

Need of capacitor:

1. Capacitor C in filters out effects of stray inductance of input wire.

2. Output capacitor is generally not used but it improves the transient of Regulator.

Power dissipation consideration:

We know from datasheet IC has max. PD=2W.

We know

Power dissipation =(V in -V out )*Io.

21

We have

Io=150mA and V in to 7805=22.6V

For max.2W PD we need

V in -V out =2W/0.5

=4V

But we have Vin-V out =17.6V

So in our case PD will be

PD=17.6*150mA

PD =2.64W

Since we have more PD we NEED heat sink…

We are going to use general 25x50 mm Heat Sink which dissipates

power up to 3 watts.

2)

8-bit Microcontroller

Controller selection (ATMega32)

Advanced RISC Architecture

Large amount of In-System Self-programmable Flash program memory

22

At least 1K Bytes EEPROM

Inbuilt 8-channel

10-bit ADC Programmable Serial USART

Baud Rate achievable 115Kbps @ Fosc=3.6864MHz With 0% error

Sophisticated

IDE, Software tools like compiler, library

Free downloading circuit and software

Availability of prototype board

23

mV between A and B data line. Fig 8.2 As we know that using modbus

mV between A and B data line.

mV between A and B data line. Fig 8.2 As we know that using modbus we

Fig 8.2

As we know that using modbus we can connect up to 32 devises. so RS485 can have at max

32 nodes. In our case we are going to use 3 slaves and 1 master. So we have 4 RS485 Nodes.

Each RS 485 node has load impedance of 12K. so for such 4 nodes in parallel give load of 3k.

24

1

3

Minimum requirement of voltage between terminals A and B=200mV.

So to maintain this voltage the bias current required to flow through load is

given by

Bias current=200mV/(120||3K||120)

Bias current =3.4mA

Now to calculate bias resistance value we have;

3.4mA=5V/(2R+(120||3K||120))

2R+59=5V/3.4mA

2R+59=1470

2R=1411

R=705 ohm.

Value used=700 ohm

4) Transistor driver circuit for buzzer

5V

5 V

4 0 0 o h m L S 1 1 2 B U Z Z
4
0 0
o
h m
L
S
1
1
2
B
U
Z
Z
E
R
B
5
4 7

R

2

C0 0 o h m L S 1 1 2 B U Z Z E R 0 0 o h m L S 1 1 2 B U Z Z E R

0 o h m L S 1 1 2 B U Z Z E R B

2

Fig 8.3

For 5V supply, Since buzzer draws about 1.5 mA we will consider Ic as 10mA

So

25

4 7

K

o

h m

From datasheet;

Ic =10mA.

Vce=1V.

1. Applying KVL to C-E;

For Ib we know;

Vcc=Ic*R1+Vce

5=10mA*R1+1

R1=400 ohm.

Ib=Ic/Hfe(min).

From datasheet of BC547 we have;

So,

Hfe(min)=110.

Ib=10mA/110

Ib =90.90uA.

2. Applying KVL to B-E, we have

VIN=Ib*R2+Vbe

5=Ib*R2+0.7

4.3=Ib*R2

4.3=90.90uA*R2

R2=4.3/90.90uA

So we have

R2=47.3047Kohm.

R1=400ohm and R2=47.3047kohm.

5)SIGNAL CONDITIONING

26

Fig 8.4 For non inverting amplifier ; Gain: 1+R f /R i . Required gain:

Fig 8.4

For non inverting amplifier ;

Gain: 1+R f /R i.

Required gain: Vo/Vin:

=5/1.5

=3.333.

We will use Ri=1K… then we have

3.33=1+Rf/1K

Rf=2.33K

We will use 10K pot as Rf.

So we have

Ri=1K and

Rf=10K(variable)…

Now for offset nulling technique as shown in figure…

We are going to use LM358 so Vcc=5V and from datasheet of that opamp we got value of input offset voltage as 7mV(max)….

27

V=Vcc=5V

Vios=(Rc/Rb)V

7mV= (Rc/Rb)5

Rb=1400Rc

Choose Rc as 20 ohm

Rc=20ohm

Rb=1400*20

=28Kohm

then we have

Take Rmax=Rb/10 so

Rmax=2800

As we know Rmax=Ra/4

Ra/4=2800

Ra=11.2Kohm(this is variable one)

We can adjust this variable Ra till the output reaches to zero…

28

9. SOFTWARE DESIGN

Device Profile

Modbus Application layer

UART

29

RS-485

Network layer

Fig 9.1

As per our system consider, We support following Functins:

   

Access

 

Function

Primary Table

Object type

Type

Reference

Supported

Discrete Input

Single bit

Read Only

1x

0x2

Coil

Single bit

Read/Write

0x

0x1

0x5

Input Register

16

bit word

Read Only

3x

0x4

Holding Register

16

bit word

Read/Write

4x

0x3

 

0x6

0x10

Table 9.1

Exception Codes

Code

Name

Meaning

30

01

ILLEGAL FUNCTION

The function code received in the query is not an allowable action for the slave. If a Poll Program Complete command was issued, this code indicates that no program function preceded it.

02

ILLEGAL DATA ADDRESS

The data address received in the query is not an allowable address for the slave.

   

A

value contained in the

03

query data field is not

ILLEGAL DATA VALUE

an allowable value for the slave.

04

SLAVE DEVICE FAILURE

An unrecoverable error occurred while the slave was attempting to perform the requested action.

05

ACKNOWLEDGE

The slave has accepted the request and is processing it, but a long duration of time will be required to do so. This response is returned to prevent a timeout error from occurring in the master. The master can next issue a Poll Program Complete message to determine

if

processing is

completed.

Main for Module A :

1. Start

Table 9.2

Algorithms

31

2. Initialize all variable.

3. Initialize all Ports.

4. Initialize ADC.

5. Initialize UART for Baud rate 9600,no Parity,1 Start and 1 Stop bit.

6. Init Timer0;

7. Enable USART_RXC Interrupt.

8. Set Global Interrupt Enable pin high.

9. Loop

10. Check sampling rate and log data into eeprom using internal ADC

Main for Module B:

11. Go to step 9

1. Start

2. Initialize all variable.

3. Initialize all Ports.

4. Initialize ADC.

5. Initialize UART for Baud rate 9600, no Parity, 1 Start and 1 Stop bit.

6. Init Timer0;

7. Enable USART_RXC Interrupt.

8. Set Global Interrupt Enable pin high.

9. Loop

10. Check sampling rate and log data into eeprom using internal ADC

32

Main for Module C

11. Go to step 9

1. Start

2. Initialize all variable.

3. Initialize all Ports.

4. Initialize UART for Baud rate 9600,no Parity,1 Start and 1 Stop bit.

5. Init Timer0;

6. Enable USART_RXC Interrupt.

7. Set Global Interrupt Enable pin high.

8. Loop

9. Go to step 9

ISR-RECIEVED COMPLETE

1. clear interrupt enable

2. disable USTART complete

3. initialize timer for 10usec

4. enable timer interrupt

5. received byte[count] = received byte

6. count = count +1

7. set delay count for 3.5msec

8. set interrupt enable

ISR-Transmission COMPLETE

1. Clear interrupt enable

33

2. If Current= Byte to send then go to step 3

Else transmit que[current++];go ot step 4;

3. Disable transmit complete interrupt

TIMER 0 interrupt enable

4. Set interrupt enable.

ISR-Timer0

 

1. Clear interrupt enable

2. if delay counter ON go to step 3

3. if delay count2=0 then delay counter OFF

else delay count 2=delay count2 - 1

4. if delay count!=0, then delay count= delay count - 1

Go to step 7

5. if count=0, then no of bytes received = count

else go to step 7

6. if first received byte [0] = slave id

a) Call updateQue()

b) Enable USART transmission complete interrupt

c) Transmit Que[0]

d) Current = 1

7. Preset counter.

8. Send interrupts enable flag.

UpdateQue

1. Current = 0

2. Que(0) = slave id

3. If login, then go to step4 else go to step 6

34

4.

Check if exception

5.

if exception

a)

Que(1) = 80Hex + received byte [1]

b)

Que(2) = Exception code

c)

byte to send=3

d)

return

6.

if password wrong

a)

send exception 4

b)

return

7.

Que(1) = received byte [1]

8.

serve functions

9.

return

UpdateQue()

STATE DIAGRAMs

Whenever Responding to any query wile updating Queue of Response frame it may be Exception or Normal Response.

35

Figure 9.2 : Modbus Transaction diagram. Function 1 ENTR MB Server receives mb_req_pdu 36 NO
Figure 9.2 : Modbus Transaction diagram.
Function 1
ENTR
MB Server receives mb_req_pdu
36
NO
Function code
ExceptionCode=04
Starting Address &
Quantity of Registers
0x0001≤quantity of Registers ≤
MB Server Sends mb_rsp
ExceptionCode=01
NO
ExceptionCode=02
NO
Request processing
MB Server Sends mb_exception_rsp
Exit
YESYESYES
ExceptionCode=03
NO ExceptionCode=02 NO Request processing MB Server Sends mb_exception_rsp Exit YESYESYES ExceptionCode=03
YES NO ReadDiscreteOutp Figure 9.3 : Read Coil state diagram Function 2 ENTR MB Server
YES
NO
ReadDiscreteOutp
Figure 9.3 : Read Coil state diagram
Function 2
ENTR
MB Server receives mb_req_pdu
37
NO
Function code
ExceptionCode=01
ExceptionCode=04
Starting Address &
Quantity of Registers
0x0001≤quantity of Registers ≤
MB Server Sends mb_rsp
NO
ExceptionCode=02
NO
Request processing
Exit
YESYESYES
MB Server Sends mb_exception_rsp
ExceptionCode=03
mb_rsp NO ExceptionCode=02 NO Request processing Exit YESYESYES MB Server Sends mb_exception_rsp ExceptionCode=03
YES NO Read Discrete Inputs Figure 9.4 : Read Discrete Inputs state diagram Function 3
YES
NO
Read Discrete Inputs
Figure 9.4 : Read Discrete Inputs state diagram
Function 3
ENTR
MB Server receives mb_req_pdu
NO
Function code
38
YES
ExceptionCode=01
0x0001≤quantity of Registers ≤
ExceptionCode=04
Starting Address &
Quantity of Registers
MB Server Sends mb_rsp
NO
ExceptionCode=02
NO
Request processing
MB Server Sends mb_exception_rsp
Exit
YESYESYES
ExceptionCode=03
mb_rsp NO ExceptionCode=02 NO Request processing MB Server Sends mb_exception_rsp Exit YESYESYES ExceptionCode=03

NO

ReadMultipleRegister
ReadMultipleRegister

Figure 9.5 : Read Holding Register state diagram

Function 4

39

Function 5 Fig 9.6 40

Function 5

Fig 9.6

40

YES

ENTRMB Server receives mb_req_pdu NO Function code YES NO ExceptionCode=01 0x0001≤quantity of Registers ≤ YES

MB Server receives mb_req_pdu

NO Function code YES NO ExceptionCode=01 0x0001≤quantity of Registers ≤ YES ExceptionCode=03 Starting Address
NO
Function code
YES
NO
ExceptionCode=01
0x0001≤quantity of Registers ≤
YES
ExceptionCode=03
Starting Address & Quantity of Registers
NO
ExceptionCode=02
YES
Request processing
WriteSingleOutput
NO
YES
ExceptionCode=01
MB Server Sends mb_rsp
NO YES ExceptionCode=01 MB Server Sends mb_rsp MB Server Sends mb_exception_rsp Exit Figure 9.7 : Write
NO YES ExceptionCode=01 MB Server Sends mb_rsp MB Server Sends mb_exception_rsp Exit Figure 9.7 : Write
NO YES ExceptionCode=01 MB Server Sends mb_rsp MB Server Sends mb_exception_rsp Exit Figure 9.7 : Write
NO YES ExceptionCode=01 MB Server Sends mb_rsp MB Server Sends mb_exception_rsp Exit Figure 9.7 : Write

MB Server Sends mb_exception_rsp

MB Server Sends mb_exception_rsp
MB Server Sends mb_exception_rsp
MB Server Sends mb_exception_rsp
Exit
Exit

Figure 9.7 : Write Single Output state diagram

Function 6

41

ENTRMB Server receives mb_req_pdu NO Function code YES ExceptionCode=01 0x0001≤quantity of Registers ≤ NO YES

MB Server receives mb_req_pdu

NO Function code YES ExceptionCode=01 0x0001≤quantity of Registers ≤ NO YES ExceptionCode=03 Starting Address
NO
Function code
YES
ExceptionCode=01
0x0001≤quantity of Registers ≤
NO
YES
ExceptionCode=03
Starting Address & Quantity of Registers
NO
ExceptionCode=02
YES
Request processing
WriteSingleRegister
NO
YES
ExceptionCode=04
MB Server Sends mb_rsp
NO YES ExceptionCode=04 MB Server Sends mb_rsp MB Server Sends mb_exception_rsp Exit Figure 9.8 : Write
NO YES ExceptionCode=04 MB Server Sends mb_rsp MB Server Sends mb_exception_rsp Exit Figure 9.8 : Write
NO YES ExceptionCode=04 MB Server Sends mb_rsp MB Server Sends mb_exception_rsp Exit Figure 9.8 : Write
NO YES ExceptionCode=04 MB Server Sends mb_rsp MB Server Sends mb_exception_rsp Exit Figure 9.8 : Write

MB Server Sends mb_exception_rsp

MB Server Sends mb_exception_rsp
MB Server Sends mb_exception_rsp
MB Server Sends mb_exception_rsp
Exit
Exit

Figure 9.8 : Write Single Register state diagram

Module A :

Data address allotment

s.n.

Task

Data model

Access

Start address

Ending address

   

Holding

     

1

Enter passwod

Register

R/W

400020

400024

42

 

2 Login Status

Input Coil

R/O

100001

 
 

3 Logoff

Output coil

R/W

000010

 
 

4 Current data

Input Register

R/O

300001

 
   

Holding

     

5 Sample rate

Register

R/W

400100

400102

 

Hour

   

400100

 
 

Minute

   

400101

 
 

Seconds

   

400102

 
 

Retrieve logged

       

6 data

Output coil

R/W

000001

 

7 No. valid loggs

Input Register

R/O

300002

 
 

8 Access nth log

Input Register

R/O

301000

304999

   

Holding

     

9 Choose unit

Register

R/w

400002

Module B :

Table 9.3

s.n.

Task

Data model

Access

Start address

Ending address

   

Holding

     

1

Enter passwod

Register

R/W

410020

410024

2

Login Status

Input Coil

R/O

110001

 

3

Logoff

Output coil

R/W

010010

 

4

Current data

Input Register

R/O

310001

 
   

Holding

     

5

Sample rate

Register

R/W

410100

410102

 

Hour

   

410100

 
 

Minute

   

410101

 
 

Seconds

   

410102

 
 

Retrieve logged

       

6

data

Output coil

R/W

010001

7

No. valid loggs

Input Register

R/O

310002

 

8

Access nth log

Input Register

R/O

311000

314999

9

Read unit

Input Register

R/O

313002

 

10

Scaling Factor

Input Register

R/O

312000

 
 

Table 9.4

Module C:

 

Start

Ending

s.n.

Task

Data model

Access

address

address

   

Holding

     

1

Enter passwod

Register

R/W

420020

40024

2

Login Status

Input Coil

R/O

120001

 
 

43

3

Logoff

Output coil

R/W

20001

 

4

Buzzer

Output coil

R/W

20020

 

5

LEDs

Output coil

R/W

20100

20102

Calculations:

Table 9.5

Timer 0 interrupt for 100uS:

TCCR0 = 0x02;

Resultant clock source after multiplier = Fcrystal/8.

TCNT0 = 210;

Fclk

Resultant time=(256-TCNT0)/Fclk

UART:

=46/460.8K

=100uSec.

UBRR Settings for 3.6864MHz crystal.

= 3.6864MHz/8=460.8KHz.

Ref:Page166 Table 69 AtMega32 datasheet ,for 0% error up to 230.4K baud rate.

Delay count for Time Out:

MODBUS Message RTU Framing A MODBUS message is placed by the transmitting device into a frame that has a known beginning and ending point. This allows devices that receive a new frame to begin at the start of the message, and to know when the message is completed. Partial messages must be detected and errors must be set as a result.

44

In RTU mode, message frames are separated by a silent interval of at least 3.5 character times. In the following sections, this time interval is called t3,5.

the following sections, this time interval is called t3,5. Fig 9.9 Specifically, about 9600 baud rate.

Fig 9.9

Specifically, about 9600 baud rate.

In 9600 Baud rate each bit takes 1/9600 seconds to transmit.

For whole frame (Normal)= 1 start+1 stop+8 data bits=10bits=>

So require 10*1/9600 seconds. Which is time taken for transmitting 1 char

so for 3.5 char time taken will be=10*3.5/9600=3.5mSec.

For 3.5 msec with help of 100usec Interrupt popping out .

So ,we require 3.5m/100u=35 as Delay count.

SCADA Design:

45

SCADA usually starts with login process and after that continuously monitor for expected information. While designing there are many free SCADA’s available to use with MODBUS like-> Modscan32, SimplyModbus6.3.6 (Master) & very useful Docklight.

First of all we tried with Docklight

very useful Docklight. First of all we tried with Docklight Wrong Id, wrong password, password ….

Wrong Id, wrong password, password ….

At the last, Logoff.

46

Expected GUI ( Font end) under VB2008 Algorithm followed-> 1. Select device from user. Generate

Expected GUI ( Font end) under VB2008

Algorithm followed->

1. Select device from user. Generate slave ID accordingly.

2. Check login status, if login then continuously monitor for current reading.

3. Else ask for password. Unless right one is not entered.

In Back End, it will monitor for trigger point and take accordingly action.

10. APPLICATIONS

47

process control

Factory floor automation

Manufacturing process

Industrial process automation

Industrial process automation: Press Forging

Press forging Forging is one of the oldest known metalworking processes

In modern times, industrial forging is done either with presses or with hammers powered by compressed air, electricity, hydraulics or steam. These hammers are large, having reciprocating weights in the thousands of pounds.

Press forging is an operation characterized by the process of deformation which consists of a lot of heating and cooling. During the process, the material is slowly condensed into a shape by increasing pressure. There are two dies; one stationary and one pushed towards the other, which compresses the part. Press forging is variation of drop-hammer forging. Unlike drop-hammer forging, press forges work slowly by applying continuous pressure or force. The main advantage of press forging, as compared to drop-hammer forging, is its ability to deform the complete work piece

MODBUS 2 4 Pc Over RS485 Vin (condition: 0v<Vin<5v) based 3 8 Pressure sensor SCADA
MODBUS
2
4
Pc
Over RS485
Vin (condition: 0v<Vin<5v)
based
3
8
Pressure sensor
SCADA
2
5
&
Generic
C
diti
i
Device
Temperatur
e
Conversion
GND
Factor
Process
status

Fig 10.1

Press Forging Beryllium Copper Billet: http://www.freedomalloysusa.com/index.html

48

It should be noted that production input billet casting is the beginning point of the

manufacturing process which eventually yields the various wrought forms of beryllium

copper.

yields the various wrought forms of beryllium copper. Beryllium copper application: C82500 BeCu Cast Electronic

Beryllium copper application:

C82500 BeCu Cast Electronic Component

Beryllium copper strip alloys have historically been specified in electronic connector applications in an impressive array of telecommunications, computer, and automotive electronics applications. Beryllium copper rod is utilized to produce certain machined connector designs and beryllium copper casting alloys are specified for intricate miniature investment cast connectors. Undersea fiber optic cable repeater housings and their associated components have been specified in beryllium copper for many years. These beryllium copper housing assemblies (wrought and cast components) must perform flawlessly, for an extended service life measured in decades, in the harsh deep water marine environment of the world’s oceans. Obviously, beryllium copper’s special combination of corrosion resistance, high strength, and durability characteristics match the severe operational requirements.

Communication

11.TESTING:

49

*For all serial communication purpose DOCKLIGHT Ver.1.6 s/w used.

RS232 Driver Implementation:

Circuit tested on bread board and following PCB is also tested.

tested on bread board and following PCB is also tested. ∑ Serial Communication with pc 1)First

Serial Communication with pc

1)First part, RXD & TXD pin shorted, echo of transmitted pattern obtained on PC

TXD pin shorted, echo of transmitted pattern obtained on PC 2)Second part,100 bytes Sent from Microcontroller

2)Second part,100 bytes Sent from Microcontroller and successfully received on PC

50

RS485 Driver Implementation:

Circuit Design & PCB:

Circuit tested on bread board and following PCB is also tested.

tested on bread board and following PCB is also tested. ∑ Serial Communication with pc as

Serial Communication with pc as half duplex

Using 2 nd PCB in Fig Transmission lines are shorted so as to get back echo on PC.

Serial Communication with pc as full duplex

Both PCB’s from Fig are used, one for Master side and another for slave side, so that 100 bytes sent from controller received on PC

Driver circuitry for Buzzer

Circuit designed resistances values were found out. Implemented on breadboard and tested .verified on multisim .Where buzzer Load impedance found out equal to 5kohm.

51

Temperature sensing: LM35 X M M 1 VCC 5V R1 X M M 2 4.3k

Temperature sensing: LM35

X M M 1

VCC 5V R1 X M M 2 4.3k R2 390 Q1 R3 47k BC547BP
VCC
5V
R1
X M M 2
4.3k
R2
390
Q1
R3
47k
BC547BP

Using internal ADC of controller temperature is observed on PC. For that LM35 and its signal conditioning circuit is used.

For that LM35 and its signal conditioning circuit is used. While implementing Timer on timer0 using

While implementing Timer on timer0 using 2 LED’s connected to 2 pin and implementing toggling algorithem timer of 100usec was verified.

SCADA testing:

52

SCADA tested using Modscan32.exe a freeware SCADA. 12.FUTURE SCOPE 53

SCADA tested using Modscan32.exe a freeware SCADA.

12.FUTURE SCOPE

53

We have used 4 wire interface for implementing RS485 . Instead of that we can make use of 2 wire interface. But for that we have to define directional logic which is necessary for that system interface.

There are two types of modes of MODBUS one is RTU and other is ASKII. we have implemented RTU mode. We can implement ASKII mode also.

We have implemented only 6 functions, can be upgraded to fully functional DCS.

For fully fledged system we have to consider effect of “Grounding and Isolation”

54

13. BIBLOGRAPHY

BOOKS

[Boye]

Electronic Devices and Circuit Theory.

8 th Edition.Robert Boylestad.

Prentice Hall India

[Mazi]

The 8051 Microcontroller and Embedded Systems

2 nd Edition, Muhammad Mazidi

Pearson Education

[JanS]

Serial Port Complete Penram International Pvt. Ltd. 2 nd Edition, Jan Axleson

[Dhan]

Programming and customizing the AVR microcontroller-Dhananjay V.

Gadre

APPLICATION NOTES

*Modicon.com

[AN001]

MODBUS APPLICATION PROTOCOL SPECIFICATION V1.1b

[AN002]

MODBUS over Serial LineSpecification and Implementation Guide

V1.02

[AN003]

Modicon Modbus Protocol Reference Guide PI–MBUS–300 Rev. J

*Texas Instruments

[SLLA272B]

The RS-485 Design Guide February 2008–Revised May 2008

*Maxim-IC

[AN1063]

Microcontroller Recognizes Addresses in RS-485 Systems

[AN736]

RS-485 (EIA/TIA-485) Differential Data Transmission System Basics

*Analog Devices

[AN960]

RS-485/RS-422 Circuit Implementation Guide by Hein Marais

55

MODBUS @

14. APPENDIX

The following figure gives a general representation of MODBUS serial communication stack compared to the 7 layers of the OSI model with respect to our system

to the 7 layers of the OSI model with respect to our system  Application layer

Application

layer

Fig 14.1

Data Encoding MODBUS uses a ‘big-Endean’ representation for addresses and data items. This means that when a numerical quantity larger than a single byte is transmitted, the most Significant byte is sent first.

MODBUS data model

MODBUS bases its data model on a series of tables that have

distinguishing characteristics.

56

The four primary tables are:

Primary table

Object

Type of

Comments

type

access

coils

Single bit

Read-

This type of data can be alterable by

Write

an application program

Input registers

16-bit word

Read-Only

This type of data can be provided by

an I/O system

Holding

16-bit word

Read-

This type of data can be alterable by

registers

Write

an application program

Discrete Input

Single bit

Read-Only

This type of data can be provided by

an I/O system

Table 14.1

Data link layer:

1) MODBUS frame description

The MODBUS protocol defined a simple protocol data unit (PDU) independent of the underlying communication layers. The mapping of

MODBUS protocol on specific buses or network can introduce some additional fields on the application data unit (ADU).

General MODBUS frame:

  ADU
 

ADU

  ADU
 

ADDITIONAL

 

FUNCTION

   

ADDRESSES

CODE

DATA

ERROR CHECK

 
  57

57

  57

PDU

Fig 14.2

The function code 1 byte. (128 – 255 reserved for exception responses).

Max size:

RS485 ADU = 256 bytes.PDU for serial line communication = 253 bytes

Server address (1 byte) , CRC (2 bytes)

2) MODBUS addressing rules:

address (1 byte) , CRC (2 bytes) 2) MODBUS addressing rules: Fig 14.3 3) The two

Fig 14.3

3) The two serial Transmission Modes

Two different serial transmission modes are defined: The RTU mode and the ASCII mode.

It defines the bit contents of message fields transmitted serially on the line. It determines how information is packed into the message fields and decoded.

The transmission mode (and serial port parameters) must be the same for all

devices on a MODBUS Serial Line.

58

General 4 wire topology.

General 4 wire topology. Fig 14.4 59

Fig 14.4

59

CRC CALCULATIONS

CRC CALCULATIONS Fig 14.5 Table 15.1: COMPONENT LIST AND BILL SR COMPONENT SPECIFICATIONS QTY COST (Rs)

Fig 14.5

Table 15.1: COMPONENT LIST AND BILL

SR

COMPONENT

SPECIFICATIONS

QTY

COST

(Rs)

NO

 

1

IC 7805

5V regulator

3

18

2

IC ATMEGA32

40-pin DIP

3

435

 

ICMAX232

16-pin-DIP

1

25

 

ICMAX485

8-pin DIP

8

320

 

ICLM35

TEMPERATURE

1

40

60

   

SENSOR

   
 

ICLM324

Quad OpAmp

2

20

3

IC base

16

pin dip

3

6

   

40

pin dip

3

12

   

8

pin dip

8

8

4

Relamet connector

6

pin

1

9

   

2

pin

6

12

5

Transistor

BC547

1

1

6

Toggle switch

SPDT

3

24

7

Zener diode

5.1

V

2

2

8

Diode

1N4007

16

16

9

Resistors

1K ohm 0.25watt

12

3

   

10

kohm 0.25watt

2

0.5

   

15

Kohm 0.25watt

1

0.25

   

4.7

kohm 0.25 watts

2

0.5

   

120ohm0.25watts

4

1

   

47Kohm0.25watts

1

0.25

   

680ohm0.25watts

4

1

   

20ohm0.25watts

4

1

   

402ohm0.25watts

1

0.25

10.

Variable Pot

10k,1k precesion

2

8

11.

Capacitors

1000uF,25V,electrolytic

1

6

   

100 uF,25V,electrolytic

1

2

   

10uF 25V, electrolytic

4

4

   

0.01 uF,22pF ceramic

10

10

   

2200uF, electrolytic

2

 

61

12.

Bur strips

40 pin

3

18

13.

2 pin push button

 

1

2

14

LEDs

3mm

10

10

15

PCB

     

16

Serial cable

Plug socket DB9

1

75

17.

DB 9 socket

Female

2

20

18.

Crystal

3.6864Mhz

1

15

19.

casing

     

20.

BUZZER

3V-24V

1

21

 

TOTAL

 

15. CIRCUIT DIAGRAM

62

MODULE C

5 V 1 . 8 K 1 . 8 K L E D 4 0
5 V
1
.
8
K
1
.
8
K
L
E D
4 0
0
o h m
L
S
1
U
1
1
.
8
K
L E
D
1
b u zze r
4
0
L
E D
1 D
P
B 0 / XC K 0 / T0
P
0 / A
C 0
2
A 3
9
1
.
8
K
L E
D
3 2 B 1 / T1
P
P
A 1
/ A
D
C
1
B
U
Z
Z
E R
3
8
1
.
8
K
P
B
2
/
I N
T2 / A I N
0
P
A 2 / A
D
C 2
3
7
4 B
P
3 / O
C
0 / A
I N
1
P
A 3 / A
D
C 3
3 6
1
.
8
K
L
E D
P
A 4 / A
D
C 4
3
5
5 B
P
4 / S
P
A 5 / A
D
C 5
5 V
6 S
3
4
L E
D
R 2
P
B
5 / M
O
S
I
P
A 6 / A
D
C 6
3
b u zze r
7
8 B
3
P
6 / M IS
O
P
A 7 / A
D
C 7
2
5 V
P
B
7 / S
C
K
B C
5
4 7
C 3
3
2
A
re f
4 7
K
o
h m
0
.
1
u F
9 1
3
R
E
S
E T
G
N D
3
0
C 3
A V
C C
1
0
0
.1 u F
V C C
1
1
G N
D
1
2
XTA L 2
Y
1
1
2
9
C 3
3 XTA L 1
P
C
7 / TO S C 2
C
R Y
S TA L
2
8
5 V
0
.
1
u F
P
6 / TO S C
1
2 2
p F
1 C
2
7
R
x D
_ in
4 D
P
0 / R
x D
P
C 5 / TC I
2 6
U
3
Tx D _ in
C
2
1 P
5 D 1 / Tx D
P
C 4 TD
O
2
5
P
C 3 / TM S
Tx D _ in
2
4
4
1
7 6 2 / I N T0
P
P
C 2 / TC
K
D
I
R O
1 1 D
2
6
P
D
3
/
I N
T1
R
E
A
A
Tx _ in
3
7
B
Tx _ in
C
1
D E
B
2
3
1 P
8 1
P
D
4 / O
C
B
C
1
/ S
D
A
1
9
2
2
8
P
D
5 / O
C
1 A
P
C
0 / S
C
L
+ C
V C
2
0 P
D
6
/
I C
P
1
2 2
p F
2
1
P D
7 / O
C
2
M A X4 8 5
3
1

D

I

P

4 0

63

A Tx _ in B Tx _ in A R x _ in B R
A
Tx _ in
B
Tx _ in
A
R
x _ in
B
R
x _ in
U
4
R
x D
_ in
4
1
D
I
R O
2
6
R
E
A
A
R
x _ in
3
7
D
E
B
B
R
x _ in
8
+
V C
C
0-5
V
M
A X4 8 5
5 v
C
3
0
.
1
u F
J P 1 1 2 3 4 4 H E A D
J
P
1
1
2
3
4
4 H
E
A D

E R

Fig 15.1

MODULE B

5 V 5 V 5 V C 3 0 . 1 u F 2 5
5 V
5 V
5 V
C
3
0
.
1
u F
2
5 K
o
h m
C
3
R
1
R
1
0
.
1
u F
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