Online Monitoring And Control From A Database Server For Manufacturing System.

UNIVERSITI TEKNIKAL MALAYSIA MELAKA
ONLINE MONITORING AND CONTROL FROM A DATABASE
SERVER FOR MANUFACTURING SYSTEM
This report submitted in accordance with requirement of the Universiti Teknikal
Malaysia Melaka (UTeM) for the Bachelor Degree of Manufacturing Engineering
(Robotic and Automation) with Honours.

by

MOHD SHAFADILAH BIN MASHOR

FACULTY OF MANUFACTURING ENGINEERING
2008

DECLARATION

I hereby, declared this report entitled “Online Monitoring and Control from a
Database Server for Manufacturing System” is the results of own my research except
as cited in references.

Signature:………………………………………

Author’s Name: Mohd Shafadilah Bin Mashor
Date: 13th October 2008

APPROVAL

This report is submitted to the Faculty of Manufacturing Engineering of UTeM as a
partial fulfillment of the requirements for the degree of Bachelor of Manufacturing
Engineering (Robotic and Automation) with Honours. The member of supervisor
committee is as follow:

(Signature of Supervisor)

(Official Stamp of Supervisor)

ABSTRACT

This project will describe about online monitoring system. Online monitoring will be use
to monitor the data such as temperature data. Online monitoring also will allow the
worker to know about the condition of a system. In this project, database is use to collect
and store the data. In database also has the data that will be use as reference or baseline

for this system and this system will give feedback base on this baseline. The aim of this
project is to communicate personal computer (PC) to Programmable Logic Controller
(PLC). Serial communication protocol will be use to communicate PC to PLC and use
RS 232 as cable connection between PC to PLC. In serial communication, PC will send
the massage to PLC to control PLC. Lastly, this project will be use Visual Basic 6.0
software to design Human Machine Interface (HMI), retrieving data and to
programming PLC for serial communication.

i

ABSTRAK

Projek ini menerangkan tentang sistem pemantauan secara terus ataupun secara
langsung. Sistem pemantauan secara terus akan di gunakan untuk memantau data
contohnya data suhu. Sistem pemantauan secara terus juga membolehkan pekerja untuk
mengetahui keadaan sebenar sesuatu sistem itu. Dalam projek ini, pengkalan data
digunakan untuk mengumpul dan menyimpan data. Di dalam pengkalan data juga
terdapat data yang telah ditetapkan sebagai data rujukan dan sistem ini akan memberikan
tindak balas berdasarkan data rujukan tersebut Sasaran utama projek ini adalah untuk
menghubungkan komputer kepada Pengawal Logik Aturcara. Komunikasi secara siri

digunakan untuk menghubungkan komputer kepada Pengawal Logik Aturcara dan
menggunakan kabel RS 232 sebagai sambungan komputer kepada Pengawal Logik
Aturcara. Dalam komunikasi secara siri, komputer akan menghantar pesanan kepada
Pengawal Logik Aturcara untuk mengawal Pengawal Logik Aturcara tersebut. Akhirnya,
projek ini menggunakan perisian Visual Basic 6.0 untuk mencipta antaramuka antara
manusia dan mesin, mendapatkan data dan untuk mengaturcara Pengawal Logik
Aturcara untuk komunikasi secara siri.

ii

DEDICATION

Special Dedicated to My Beloved Family

Mashor Dasuki
Rohayati Poying
Nur Shafika Mashor
Mohd Azmir Mashor

My Supervisor

En. Shariman Abdullah

And
All my Friends

iii

ACKNOWLEDGEMENTS

Assalammualaikum. First of all, I want to say that I am very grateful to God, because of
God’s grace; I finally succeeded in finishing my Projek Sarjana Muda (PSM). I would
like to thanks to my project supervisor, Encik Shariman Bin Abdulllah because of his
guidance and advice on my project in many ways kept me going. I appreciate all his
suggestions and encouragement through out the process of completing this PSM. I also
want to say thanks to my parents who have helped me a lot throughout of the process do
my project. Always support me and give me encouragement until the end of this project.
To my brother and also to my sister that always stay besides me, support me when I’m
down and never give up with me. To my friends, because always help me and give an
advice to improve my project. To all lecture because has given cooperation and
teachings to me. Thanks to all who has to be involved in this project “Online Monitoring

And Control From Database Server For Manufacturing System”, for all the help,
support, encouragement, cooperation and advice that they all has give to me throughout
this project.

Thank you very much.

iv

TABLE OF CONTENT

Abstract

i

Abstrak

ii

Dedication


iii

Acknowledgement

iv

Table of Content

v

List of Tables

viii

List of Figures

ix

1. Introduction


1

1.1 Project Overview

3

1.2 Advantages of System

4

1.3 Problem Statement

4

1.4 Objective

4

1.5 Scope


5

2. Literature Review

6

2.1 Database

7

2.1.1 Database Engine

9

2.1.2. Microsoft Jet

9

2.1.3 Table and Field


10

2.1.4 Record SET

11

2.2 Accessing Database

12

2.2.1 Data Access Object (DAO)

13

2.2.2 Remote Data Objects (RDO)

14

2.2.3 ActiveX Data Objects (ADO)


15

2.3 Database Software

16

2.3.1 Microsoft Access

16

2.3.2 SQL Server

17

v

2.3.2.1 Microsoft SQL Server 2000

17


2.3.2.1.1 Database Architecture

19

2.3.3 MySQL

20

2.3.4 mSql

21

2.4 Pc to Plc Communications

22

2.4.1 Serial Port

27

2.4.1.1 RS232

30

2.4.2 Parallel Port

34

2.5 Programming

37

2.6 PLC

40

2.6.1 Why Use PLC

41

2.6.2 Programming Standard

41

2.6.2.1 Ladder Diagrams

41

2.6.2.2 Functional Block Diagram

42

2.6.2.3 Instruction List

43

2.6.2.4 Structure Text (ST)

44

2.6.3 Serial Communication for PLC

44

2.7 Sensor

49

2.7.1 Temperature Sensor

50

2.7.1.1 Temperature Control System using LM35

50

2.8 Summary

52

3. Methodology

53

3.1 Introduction to Project Methodology

53

3.2 Methodology Flow Chart

54

3.2.1 Identified Problem Statements

55

3.2.2 Project Planning Using Gantt chart

55

3.2.3 Information Searching

58

3.2.3.1 Books

58

3.2.3.2 Journals and Articles

58

3.2.3.3 Internet and Web Pages

59

vi

3.2.3.4 Discussion with lecturer

59

3.2.4 Literature Review

59

3.2.5 Software Design

60

3.2.6 Testing

60

3.2.6.1 SQL Server 2000 Testing

61

3.2.6.2 Visual Basic 6.0 Testing

61

3.2.6.3 PC to PLC communication Testing

61

3.2.7 Analysis

61

3.2.8 Improvement

62

3.3 Summary

62

4. Conclusion of PSM 1

63

Reference

64

vii

LIST OF TABLES

2.1: Microsoft SQL Server 2000 Architecture

18

2.2: Show cmd operation

25

2.3: 9-pin serial port pin outs, male (Corey, 2000)

32

2.4: 25-pin serial port pin outs, male (Corey, 2000)

33

2.5: signal on a 25-pin parallel port connector (Corey, 2000)

35

3.1: Gantt chart for PSM 1

56

3.2: Gantt chart for PSM 2

57

viii

LIST OF FIGURES
1.1: Overview Online Monitoring System

3

2.1: Relationship of four major components in Database (Date 2000)

8

2.2: Database Engine in database system

9

2.3: Example of table and field using SQL

10

2.4: Relationship between recordset and table (Fowler.com 2008).
2.5: The client side of the ODBC architecture (Freeze 2000)

12

2.6: The class diagram representing the relationships

13

for the DAO pattern (Sun Microsystems 2002)
2.7: general characteristics of RDO (McManus 1999)

14

2.8: How to gain access to information in a database

15

using ADO and OLE DB (McManus 1999)
2.9: The relationship of process in Microsoft Access

17

(Bay City 2006)
2.10: Four system databases in SQL server (MicrosoftTechNet 2008)

19

2.11: The client/server design of MySQL (Yarger 1999)

21

2.12: How serial data is transferred (TechTarget 2007)

22

2.13: Example of serial port programming using C

26

2.14: Example of coding to setting serial port

27

2.15: The speeds at which most computers' serial ports (TechTarget 2007)

28

2.16: A typical serial data format. (Pei An 2002)

28

2.17: DB9 RS232 programming cable

31

2.18: DB25 RS232 programming cable

31

2.19: 9-pin male socket (Pei An 2002)

31

2.20: 25-pin male socket (Pei An 2002)

32

2.21: Parallel Port (James, 1999)

34

2.22: DB-25 female jack connector (James, 1999)

36

2.23: DB-25 male plug connector (James, 1999)

36

2.24: Parallel connection

36
ix

2.25: Several components in connecting a VB to database (McManus 1999)

38

2.26: The connection has been made in VB

38

2.27: Step to create database using SQL 2000.

39

2.28: Step to create database using Microsoft Access

39

2.29: Example of Ladder Diagrams Programming (Groover 2008)

42

2.30: Example programming use Functional Block

42

Diagram programming (Lewis1998)
2.31: Example of Instruction List Programming (Hugh 2001)

43

2.32: Example of Instruction List Programming (Lewis1998)

44

2.33: Coding send to serial port

46

2.34: Coding to receive data in serial communication

46

2.35: Serial output using ladder diagram

47

2.36: Massage function for serial communication

47

2.37: System overview

50

x

CHAPTER 1
INTRODUCTION

1.0

Introduction

Online Monitoring and Control from Database for Manufacturing System is an industrial
control system that uses a computer system monitoring and controlling a process and use
database to record the data of the process. This system consist a few subsystems to make
a complete the system. The sub systems are a Human-Machine Interface (HMI),
database system, programmable logic controllers (PLC) and communication
infrastructure. Human-Machine Interface or HMI is the apparatus which presents
process data to a human operator, and through which the human operator monitors and
controls the process. The HMI of this system is where data is processed and presented to
be viewed and monitored by a human operator. This interface usually includes controls
function where the individual can interface with the system. HMI are an easy way to
standardize the facilitation of monitoring multiple PLC. Usually PLC will run a pre
programmed process, but monitoring each of them individually can be difficult, usually
because they are spread out over the system. Because PLC historically had no
standardized method to display or present data to an operator, the system communicates
with PLC throughout the system network and processes information that is easily
disseminated by the HMI. HMI also can be linked to a database, which can use data
gathered from PLC to give option to the operator to retrieve or key in the data.

Second subsystem is database system. All subsystem work to acquiring data on the
process and sending commands to the process. The term database system refers to the
servers and software responsible for communicating with the field equipment, PLC, and
then to the HMI software running on workstations in the control room or elsewhere. In
1

smaller systems, the master station may be composed of a single Personal Computer
(PC). In larger systems, the master station may include multiple servers, distributed
software applications, and disaster recovery sites. To increase the integrity of the system
the multiple servers will often be configured in a dual-redundant or hot-standby
formation providing continuous control and monitoring in the event of a server failure.

Third subsystem is PLC. This subsystem connecting to sensors in the process,
converting sensor signals to digital data and sending digital data to the database system.
The PLC, located at a remote site, gathers data from field devices such as sensor, pumps
and valves into memory until the HMI initiates a send command. The central processing
unit within the PLC receives a data stream hardware equipment protocol. When the PLC
sees its specific address embedded in the protocol, data is interpreted and the CPU
directs the specified action to take.

Last subsystem is communication infrastructure. This subsystem function is to connect
the PC to the PLC. Online Monitoring System used direct serial or modem connections
to meet communication requirements, although Ethernet and IP are also frequently used
at large sites. Integration of serial devices into this system network infrastructure offers
distinct advantages for seeking to centralize their operations, overcome the distance
limitations of standard serial communications or lower costs associated with hands-on
administration of these devices. However, integrating serial communications into a
network is difficult as Ethernet topology is not capable of directly transmitting serial
data from one device to another. Most devices used in data acquisition or control
applications, such as time clocks, traffic control signals, data collectors and alarm panels
are usually serial based because it is a reliable and low-cost technology.

This project will involve in database, HMI and PLC. It will produce a system to monitor
and control system such as temperature. This project allows the automated reaction
when the problem is occurring such as the temperatures exceed the limit. Visual Basic
6.0 will be use in this project as interface and to program the PLC using serial
communication and allows to retrieving or adds the data using interface.

2

1.1

Project Overview

Online Monitoring and Control from Database for Manufacturing System will work by
relationship between database, PLC and Human Machine Interface. This system refers to
centralized systems which monitor and control entire sites or complexes of systems
spread out over large areas. Most control actions are performed automatically by PLC.
Data collection begins at the PLC level and includes meter readings and equipment
status reports that are communicated. Data is then compiled and formatted in such a way
that a control room operator using the HMI can make decisions to adjust or override
PLC controls. Data may also be fed to a database, often built on a commodity database
system, to allow trending and other analytical auditing.
.

Database

Communication

RS

PLC
Figure 1.1: Overview Online Monitoring System

3

RS

PLC

1.2

Advantages of System

When one system is developing, the important thing is to convince people that the
system is good and useable. One practical way to convince the people is by show the
advantage of the system. For Online Monitoring System, there are several advantage that
the people will get when use this system. First advantage is grown and the demands for
reliable and accurate performance and trend data have increased. Second advantage is
the worker need to be able to remotely and instantaneously, identify problem that are
affected, and respond accordingly. Beside that, when a particular section of the
distribution system goes down, the worker are provided with instant information. In
addition, the engineers are able to examine historical data for load trending, planning
and improving system performance.

1.3

Problem Statement

Nowadays, the readout of the majority of data collection in environmental or industrial
is not true. It is because occur some adjustment to correct the data especially in down
time problem. So, this project is developing to avoid incorrect data collection and to
automate the solution when a problem occurs.

1.4

Objective

There are several objectives need to achieve in this project:
(a) To make database using SQL Server 2000.
(b) To retrieving data from SQL Server 2000 using Visual Basic 6.0.
(c) To design Human Machine Interface Visual Basic 6.0.
(d) To communicate PC to PLC using serial communication with Visual Basic 6.0.

4

1.5

Scope

This project will focus on programming for monitoring system from temperature sensor
using Visual Basic 6. It will use Visual Basic 6 software to give instruction to the PLC
for control the system. Port programming which enables interrupt process for the
operating system can be used to control any external devices attached to the pc via serial
port. Port programming and user interface design can be done using Visual Basic 6
software. This project also use SQL Server 2000 to create a database and retrieving the
data using Visual Basic 6.0.Basically, the idea is to connect output devices to the pc via
serial port. Then, control software to control output device will be developed using
Visual Basic software. Thus, the Visual Basic is used to monitor the data such as
temperature data.

5

CHAPTER 2
LITERATURE REVIEW

2.0

Introduction

In this chapter, it will give information and described all components that involve in
Online Monitoring and Control from Database for Manufacturing System project and it
have seven major component to complete one system. The major components consists
Database, Accessing Database, Database Software, PC to PLC Communication, Visual
Basic 6, PLC and sensor. So, from this seven major components, the system can collect,
retrieve the data and make decision when the problem occur. Database will allow to
store and collect the data. The Accessing data base will function to allow retrieving or
inserting the data. Database software is listing of software can be use to make a
database. PC to PLC communication means the way to connect PC to PLC. Visual Basic
6.0 is software to make interface in Human Machine Interface and sensor is device that
uses to collect the data.

6

2.1

Database

A database is a logically coherent collection of data with some inherent meaning,
representing some aspect of real world and which is designed, built and populated with
data for a specific purpose. A phone book, for instance, could be considered a database
as it stores related pieces of information such as name and phone number. However, in
the world of computers, a database usually refers to a collection of related pieces of
information stored electronically. Aside from the ability to store data, a database also
provides a way for other computer programs to quickly retrieve and update desired
pieces of data. Beside that, database also is a collection of information that is organized
so that it can easily be accessed, managed and updated. In one view, databases can be
classified according to types of content: bibliographic, full-text, numeric, and images.

McManus J. P. (1999), claim database is a repository of information. Relational
databases are storage data in table which are in turn composed of rows, also known as
records and columns, also known field, enable to retrieve subjects of data from table and
enable to connect table together for the purpose of retrieving related record stored in
different table. Freeze W.S. (2000), claim a database is simply a genera-purpose tool that
allows people to store any information that can be read and updated by one or more
concurrent application programs in secure and reliable fashion.

Before databases appeared as a separate technology, data was stored in a variety of
ways, often proprietary and specific to the implementation in question. Data could not be
shared and could not be utilized outside of the application in which it resided. This
clearly proved problematic. If a company had the data, but couldn’t do more with it as
new requirements came about. Databases evolved to take responsibility for the data
away from the application and most importantly enable it to be shared. As applications
grew and new applications appeared, a single data repository evolved a repository that
all applications could access. To understand the database, the major component of
database must be known. Date, C.J (2000), determine there are four major components:

7