You are on page 1of 70

1.

INTRODUCTION
1.1. Background
Monitoring of industrial process parameter is complete system in which
sensors are used to collect the data from the actual industrial environment. This
actual environment may be the boiler, chemical tank, nuclear reactor or furnace
etc whose temperature we have to monitor over the Ethernet. The accuracy of
data collection is depending on type of sensor and process whose parameter is
to be monitor, in case of nuclear reactor the accuracy should be high, where as
in case of furnace less accuracy can be acceptable. If we need to connect more
serial devices at a time with high data rate at a time which make the data
processing somewhat difficult due to which system performance is poor.
Another important factor is distance between sensor and host device, as the
distance is increases as the length of wire is increases, which increase the drop.
The solution for this problem we are replacing previous control methods based
on microcontroller with ARM processor and embedded Ethernet interface
system. In which host system carry out one communication at a time which
reduces its load.
The main aim of our project is to implement industrial automation console
that can be easily accessible from distant places through a simple web server
running inside the industry. The basic functionalities in this proposed system
includes automatic control of Lights and monitoring temperature. Internetenabled hardware products are slowly becoming popular. A real web server can
be implemented in a device in your own home connected to your pc via a local
area network. This will allow you to do things like display temperature, control
heater/geyser and switch light/fan remotely from any web browser in the house.
This project comprises of two sub-parts. The front end involves designing a web
1

page application using HTML language to communicate with remote


microcontrollers over the Ethernet. The back end involves building a network of
microcontroller based prototypes to emulate devices used at residential
locations for the purpose of home automation such as TV ON/OFF control,
speed control of fan, lighting control etc. Micro-controllers communicate with
each other via Ethernet a wired communication. Because these systems use
hard-wired Ethernet, communication between components is reliable and fast.
This kind of systems is particularly useful for the disabled or elderly,
improving the life quality and avoiding special aid expenses. The industrial
Automation System integrates electrical devices in the house with each other in
order to control domestic activities such as pet feeding, smart lighting or
entertainment systems. These devices are often connected through a computer
network, al lowing them to be controlled by any personal computer or mobile
device (smart phones, tablets, etc.). The communication technologies used in
the systems are mostly determined by the house topology. Pre-existing houses
use PLC or wireless networks (radio or IR), while new homes can be out tted
for dedicated wiring through the walls, avoiding some interference issues and
lowering the nal cost.
The NXP (founded by Philips) LPC2148 is an ARM7TDMI-S based highperformance 32-bit RISC Microcontroller with Thumb extensions 512KB onchip Flash ROM with In-System Programming (ISP) and In-Application
Programming (IAP), 32KB RAM, Vectored Interrupt Controller, Two 10bit
ADCs with 14 channels, USB 2.0 Full Speed Device Controller, Two UARTs,
Two I2C serial interfaces, Two SPI serial interfaces Two 32-bit timers,
Watchdog Timer, PWM unit, Real Time Clock with optional battery backup,
Brown out detect circuit General purpose I/O pins.

The application of microcontroller in such an instrument will reduce cost.


Primarily, the microcontroller is capable of storing and a programming. The
microcontroller contains a CPU (central processing unit), RAM (random-access
memory), ROM (read only memory), IO (input/output), serial and parallel ports,
timers, and sometimes other built-in peripherals such as A/D (analog-to-digital)
and D/A (digital-to-analog) converters.
There is a large variety of microcontroller on the market today. We will
focus on a few versatile microcontroller chips called programmable interface
controller ARM7 chips from PHILIPS. PHILIPS uses ARM7 to describe its
series of ARM micro controllers.
At controlling system side, we have Bluetooth module, micro controller
and load controlling circuits. Whenever this blue tooth module receives
command from its paired blue tooth transmitter then it transfers this command
to micro controller. Micro controller will control the respective loads depends
upon the command it received.

1.2. Problem Outline


Various wireless technologies that can support some form of remote data
transfer, sensing and control such as Bluetooth, Wi-Fi, RFID, and cellular
networks have been utilized to embedded various levels of intelligence in the
industries. The studies have presented Bluetooth based home automation
systems using Android Smart phones without the Internet controllability. The
devices are physically connected to a Bluetooth sub-controller which is then
accessed and controlled by the Smart phone using built-in Bluetooth
connectivity. However, due to limited range of operation (maximum up to 100
3

m) the system is unable to cope with mobility and can only be controlled within
the vicinity. A GSM based communication and control for home appliances has
also been presented by where different AT commands are sent to the Home
Mobile for controlling different appliances. The drawback of this system is that
users are not provided with a graphical user interface and users have to
remember different AT commands to control the connected devices.

1.3. Proposed System


The goal of this project is to develop industrial automation system that
gives the user complete control over all remotely controllable aspects of
industry. The automation system will have the ability to be controlled from a
central host PC, and the Internet. In this project we will create an application to
monitor temperature, voltage and control electrical appliance like light. from
webpage. This web page can be opened from anywhere using computer. In this
web page we have some options or buttons to control the appli, whenever we
operate this application then it sends command to controlling system through
internet link.
At controlling system side, we have Ethernet module, micro controller and
load controlling circuits. Whenever this Ethernet module receives command
from its web application then it transfers this command to micro controller.
Micro controller will monitor temperature and voltage then control the
respective load depends upon the command it received. The communication
between internet and micro controller is established using Ethernet module and
the controller is used in this project is ARM7 based LPC2148 32-bit controller.
We can also control loads of that industry from this webpage.

1.4. Scope of Study


The scope of study which is needed for the completion of this project
involves the following criteria:
1. Architecture of LPC2148- ARM 7 knowledge
2. Programming in C language.
3. The study of the serial communication.
4. Interfacing LCD with microcontroller.
5. Interfacing temperature with microcontroller.
6. Interfacing ETHERNET with microcontroller.
7. The circuitry and devices that is needed to construct the devices
and establish the necessary communication between the devices.

2. LITERATURE REVIEW
In this chapter, we will discuss about the information found by study and
research that is critical and have an important value in the contribution of the
whole project. It also gives some basic knowledge or theoretical base and is
used as a foundation to successfully achieve the main objectives. Most of the
literatures are from the related articles, journals, books and previous works of
the same fields. These literatures are then compiled and use as a guidance to the
work of this project.
Every client can access the industry directly without any interaction with
additional server and modules [7]. Fig 1 shows proposed DAC system with an
embedded web server. This contains a portable ARM 7 processor. An ARM
processor is responsible for handling all tasks like measuring & conversion of
signals, data base updating, communicating with owner by sending HTML
pages. An ARM 7 processor manages all tasks in parallel in tiny amounts of
time. The client can monitor and control the various industrial parameters in the
web server.
Data acquisition system is most important in industry and consumer
applications. In many applications, human beings have been replaced by
unmanned devices that will acquire data and relay the data back to the base.
There are data-acquisition and control devices that will be a substitute for a
supervisor in a multisite job operation. A web server provides access to the end
device as per the request of client. In these system there is a central functional
unit that host web pages. In these applications, data are uploading on a central
server and are then served to the clients via the Internet. A person that needs to
access any data must first access the server. When configured IP address
entered, predesigned web page get displayed through which we can monitor and
control particular device. However, there is still no effort to minimize the
6

operational costs (including the costs to transfer a large amount of data). In


addition, this system is based on an industrial PC, thus making it an expensive
solution. Interaction with the embedded unit is also an important issue. In, an
embedded PC card placed on the Internet allows limited interaction through
commands sent through Transmission Control Protocol/IP (TCP/IP) and User
Datagram Protocol.

2.1. ARM7 LPC2148 TDMI


Over the last few years, the ARM architecture has become the most
pervasive 32-bitarchitecture in the world through wide range of ICs available
from various IC manufacturers. The ARM processors are embedded in products
ranging from cell/mobile phones to automotive braking systems. Worldwide
community of ARM partners and third-party vendors has developed among
semiconductor and product design companies including hardware engineers,
software developers, and system designers.
ARM7 is one of the widely used micro-controller family in embedded
system application. This section is humble effort for explaining basic features of
ARM-7. The ARM is a family of instruction set architectures for computer
processors based on a reduced (RISC) architecture developed by British
company ARM Holdings.

2.2. ETHERNET
Ethernet is the family of wired network technology. And Ethernet is
standardized as IEEE 802.3. The data of Ethernet is grouped into bytes often
called frame. The start of the frame is preamble which is of 7 bytes length. It
contains sets of 0s and 1s arranged alternately. The SFD or start frame
delimiter is a 1 byte binary value. Its left most end contains a 11 by
identifying it, the receiver gets information about arrival of the new frame. Then
7

comes the 48-bit MAC address that contains both source and destination
address. The type of length which is of 2 bytes gives information about the
protocol bound in the succeeding data payload. The frame terminates with a 32bit checksum that performs CRC checking to identify if any error is present [4].

2.3. Temperature Sensor (LM35)


The Temperature- LM35 sensor continuously monitors the temperature of
surface at which it is mounted, generally vehicle engine and body. If the
Temperature exceeds predefined value, the microcontroller will send alert to the
driver by means of buzzer usually fixed near to Dash board.

2.4. Similar Type Projects


Industrial Parameter Monitoring and Controlling Using Gsm and Web
Server:
Remote Monitoring, and Control is one of the most important and necessary
criteria for increasing production and process plant availability. There is lot of
development in industry and the requirement for industrial monitoring system is
getting higher. System should be able to acquire, save, analyze, and process real
time data. It is also required controlling particular machines, to change related
environment factors and monitoring in long distance so that it realizes modern,
intelligent, and accurate control. We can achieve these advantages by the
substitution of embedded ARM processor to realize data acquisition and control
(DACS). This DACS system measures the remote signals and controls the
remote devices through reliable protocols and communication network as a web
server. In addition of that a GSM Mobile Communication will help to providing
information about related parameter to the system when web server is not
available to client.

Arm Based Real Time Monitoring and Controlling of Industrial


Parameters Using GPRS:
Day by day the scope of networked embedded system is rapidly increasing
for monitoring & controlling either home appliances or industry devices. The
World Wide Web is a global system of interconnected computer networks that
utilizes the standard Internet Protocol Suite (TCP/IP) and allows the user to
interface many real-time Embedded applications similar to data acquisition,
Industrial automations and safety measures etc,. Users can monitor & control
remote machines/systems by using an embedded web server. The main objective
of this system is used to monitor the industrial parameters and control the
various machines/systems in the industry from anywhere in the world through
embedded web server. The machine/instrument is monitored and controlled by
ARM 7 and in-build web server with GPRS technology. Various sensors are
used to monitor the parameters like pressure, speed and temperature in the
industry. A relay is used in this system to control the machine/instrument by
giving ON/OFF command in the web page. The embedded device
communicates through General Packet Radio Service (GPRS). GPRS
technology along with GSM can be accessed from anywhere in the world.
Industrial Process Parameter Monitor using Ethernet:
In todays world networking is important part of industrial automation in
monitoring of industrial process parameters. To provide this automation we
propose a system which uses ARM Processor with Ethernet controller ENC
28J60. As most of industrial devices does not have network interface capability
so ENC 28J60 will use to provide interface capability. In industries there are
several parameters which must be monitor continuously. In this paper we are
focus on Sensor selection criterion, because correct selected sensor will receive
data correctly and further it will have processed by the system. ENC 28J60 is
9

another important part of this system which is used as Ethernet network


interface for any controller equipped with SPI. It will satisfy the all
specifications of IEEE 802.3, also it has MAC and PHY modules, it will
provide faster data transfer using internal DMA. By using RJ 45 connector we
can connect a processor to a required MBPS network. To access the ENC 28J60
we have to configure the register and memory. This design basically consists of
SPI communication module, processor module and Ethernet interface module.
Due to which system has high performance and offers widest range of features
viz. flexibility, reliability, durability when compared with conventional and old
solution to monitor.

10

3. INTRODUCTION TO EMBEDDED SYSTEMS


3.1. Introduction
An embedded system can be defined as a computing device that does a
specific focused job. Appliances such as the air-conditioner, VCD player, DVD
player, printer, fax machine, mobile phone etc. are examples of embedded
systems. Each of these appliances will have a processor and special hardware to
meet the specific requirement of the application along with the embedded
software that is executed by the processor for meeting that specific requirement.
The embedded software is also called firm ware. The desktop/laptop
computer is a general purpose computer. You can use it for a variety of
applications such as playing games, word processing, accounting, software
development and so on. In contrast, the software in the embedded systems is
always fixed listed below:
Embedded systems do a very specific task; they cannot be programmed to
do different things. Embedded systems have very limited resources, particularly
the memory. Generally, they do not have secondary storage devices such as the
CDROM or the floppy disk. Embedded systems have to work against some
deadlines. A specific job has to be completed within a specific time. In some
embedded systems, called real-time systems, the deadlines are stringent.
Missing a deadline may cause a catastrophe-loss of life or damage to property.
Embedded systems are constrained for power. As many embedded systems
operate through a battery, the power consumption has to be very low. Some
embedded systems have to operate in extreme environmental conditions such as
very high temperatures and humidity.

11

3.2. Application Areas


Nearly 99 per cent of the processors manufactured end up in embedded
systems. The embedded system market is one of the highest growth areas as
these systems are used in very market segment- consumer electronics, office
automation,

industrial

automation,

biomedical

engineering,

wireless

communication, data communication, telecommunications, transportation,


military and so on.

3.2.1. Consumer appliances:


At home we use a number of embedded systems which include digital
camera, digital diary, DVD player, electronic toys, microwave oven, remote
controls for TV and air-conditioner, VCO player, video game consoles, video
recorders etc. Todays high-tech car has about 20 embedded systems for
transmission control, engine spark control, air-conditioning, navigation etc.
Even wristwatches are now

becoming embedded systems. The palmtops are

powerful embedded systems using which we can carry out many generalpurpose tasks such as playing games and word processing.

3.2.2. Office automation:


The office automation products using embedded systems are copying
machine, fax machine, key telephone, modem, printer, scanner etc.

3.2.3. Industrial automation:


Today a lot of industries use embedded systems for process control.
These include pharmaceutical, cement, sugar, oil exploration, nuclear energy,
electricity generation and transmission. The embedded systems for industrial
use are designed to carry out specific tasks such as monitoring the temperature,
pressure, humidity, voltage, current etc., and then take appropriate action based
12

on the monitored levels to control other devices or to send information to a


centralized monitoring station. In hazardous industrial environment, where
human presence has to be avoided, robots are used, which are programmed to
do specific jobs. The robots are now becoming very powerful and carry out
many interesting and complicated tasks such as hardware assembly.

3.2.4. Medical electronics:


Almost every medical equipment in the hospital is an embedded system.
These equipments include diagnostic aids such as ECG, EEG, blood pressure
measuring devices, X-ray scanners; equipment used in blood analysis, radiation,
colonoscopy, endoscopy etc. Developments in medical electronics have paved
way for more accurate diagnosis of diseases.

3.2.5. Computer networking:


Computer networking products such as bridges, routers, Integrated
Services Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25
and frame relay switches are embedded systems which implement the necessary
data communication protocols. For example, a router interconnects two
networks. The two networks may be running different protocol stacks. The
routers function is to obtain the data packets from incoming pores, analyze the
packets and send them towards the destination after doing necessary protocol
conversion. Most networking equipments, other than the end systems (desktop
computers) we use to access the networks, are embedded systems.

3.2.6. Telecommunications:
In the field of telecommunications, the embedded systems can be
categorized as subscriber terminals and network equipment. The subscriber
terminals such as key telephones, ISDN phones, terminal adapters, web cameras
13

are embedded systems. The network equipment includes multiplexers, multiple


access systems, Packet Assemblers Dissemblers (PADs), sate11ite modems etc.
IP phone, IP gateway, IP gatekeeper etc. are the latest embedded systems that
provide very low-cost voice communication over the Internet.

3.2.7. Wireless technologies:


Advances in mobile communications are paving way for many interesting
applications using embedded systems. The mobile phone is one of the marvels
of the last decade of the 20h century. It is a very powerful embedded system
that provides voice communication while we are on the move. The Personal
Digital Assistants and the palmtops can now be used to access multimedia
services over the Internet. Mobile communication infrastructure such as base
station controllers, mobile switching centers are also powerful embedded
systems.

3.2.8. Insemination:
Testing and measurement are the fundamental requirements in all
scientific and engineering activities. The measuring equipment we use in
laboratories to measure parameters such as weight, temperature, pressure,
humidity, voltage, current etc. are all embedded systems. Test equipment such
as oscilloscope, spectrum analyzer, logic analyzer, protocol analyzer, radio
communication test set etc. are embedded systems built around powerful
processors. Thank to miniaturization, the test and measuring equipment are now
becoming portable facilitating easy testing and measurement in the field by
field-personnel.

14

3.2.9. Security:
Security of persons and information has always been a major issue. We
need to protect our homes and offices; and also the information we transmit and
store. Developing embedded systems for security applications is one of the most
lucrative businesses nowadays. Security devices at homes, offices, airports etc.
for authentication and verification are embedded systems. Encryption devices
are nearly 99 percent of the processors that are manufactured end up in~
embedded systems. Embedded systems find applications in every industrial
segment-

consumer

electronics,

transportation,

avionics,

biomedical

engineering, manufacturing, process control and industrial automation, data


communication, telecommunication, defense, security etc. Used to encrypt the
data/voice being transmitted on communication links such as telephone lines.
Biometric systems using fingerprint and face recognition are now being
extensively used for user authentication in banking applications as well as for
access control in high security buildings.

3.2.10. Finance:
Financial dealing through cash and cheques are now slowly paving way
for transactions using smart cards and ATM (Automatic Teller Machine, also
expanded as Any Time Money) machines. Smart card, of the size of a credit
card, has a small micro-controller and memory; and it interacts with the smart
card reader! ATM machine and acts as an electronic wallet. Smart card
technology has the capability of ushering in a cashless society. Well, the list
goes on. It is no exaggeration to say that eyes wherever you go, you can see, or
at least feel, the work of an embedded system.

15

3.3. INTRODUCTION TO MICROCONTROLLER


Based on the Processor Side Embedded Systems is mainly divided into 3
types
1. Micro Processor: - are for general purpose e.g.: our personal computer
2. Micro Controller: - are for specific applications, because of cheaper cost
we will go for these
3. DSP (Digital Signal Processor): - are for high and sensitive application
purpose

3.3.1. MICROCONTROLLER VERSUS MICROPROCESSOR


A system designer using a general-purpose microprocessor such as the
Pentium or the 68040 must add RAM, ROM, I/O ports, and timers externally to
make them functional. Although the addition of external RAM, ROM, and I/O
ports makes these systems bulkier and much more expensive, they have the
advantage of versatility such that the designer can decide on the amount of
RAM, ROM and I/O ports needed to fit the task at hand.
A Microcontroller has a CPU (a microprocessor) in addition to a fixed
amount of RAM, ROM, I/O ports, and a timer all on a single chip. In other
words, the processor, the RAM, ROM, I/O ports and the timer are all embedded
together on one chip; therefore, the designer cannot add any external memory,
I/O ports, or timer to it. The fixed amount of on-chip ROM, RAM, and number
of I/O ports in Microcontrollers makes them ideal for many applications in
which cost and space are critical.
General Micro Processor
1. cpu for computers
2. No RAM, ROM, I/O on CPU chip itself
16

3. Example : Intels x86


A smaller Computer
On chip RAM, ROM, I/O PORTS.
Example: Intel 8052 etc.
Table 3.1: Differences between microprocessor and microcontroller
Microprocessor vs. Microcontroller
Microprocessor

Microcontroller

CPU is standalone RAM,

CPU, RAM, ROM, I/O and

RAM, I/O and timer are separate

timer are all on a single chip

Designer can decide on the

Fix amount of on chip ROM,

amount of ROM, RAM and I/O RAM, I/O Ports.


ports.
Expansive, Versatility

For applications in which cost,


power and space are critical

General purpose

Single purpose

3.3.2. THE BUILDING BLOCKS OF EMBEDDED SYSTEM


Now, let us see the details of the various building blocks of the hardware of
an embedded system as shown in figure 2.1.
Central Processing Unit (CPU).
Memory (Read only Memory and Random Access Memory)
Input Devices.
Output devices.
Communication interfaces.
17

Application specific circuitry.

Read Only
Memory

Random
Access
Memory

Central Processing Unit


Input devices

Output devices

(CPU)

Application specific circuitry

Communication
interfaces

Figure 3.1: Building blocks of embedded system

1. Central processing unit (CPU)


A CPU is composed of an Arithmetic Logic Unit (ALU), a Control Unit
(CU), and many internal registers that are connected by buses. The ALU
performs all the mathematical operations (Add, Sub, Mul, Div), logical
operations (AND, OR), and shifting operations within CPU The timing and
sequencing of all CPU operations are controlled by the CU, which is actually
built of many selection circuits including latches and decoders. The CU is
responsible for directing the flow of instruction and data within the CPU and
continuously running program instructions step by step. The CPU works in a
cycle of fetching an instruction, decoding it, and executing it, known as the
18

fetch decode execute cycle. The cycle begins when an instruction is fetched
from a memory location pointed to by the PC to the IR via the data bus.
For embedded system design, many factors impact the CPU selection, e.g.,
the maximum size (number of bits) in a single operand for ALU (8, 16, 32, 64
bits), and CPU clock frequency for timing tick control, i.e. the number of ticks
(clock cycles) per second in measures of MHz A microcontroller is a low cost
processor. Its main attraction is that on the chip itself, there will be many other
components such as memory, serial communication interface, analog to digital
converter etc. So, for small applications, a microcontroller is the best choice as
the number of external components required will be very less. On the other
hand, microprocessors are more powerful, but you need to use many external
components with them. DSP is used mainly for applications in which signal
processing is involved such as audio and video processing.
2. Memory
The memory is categorized as Random Access Memory (RAM) and Read
Only Memory (ROM). The contents of the RAM will be erased if power is
switched off to the chip, whereas ROM retains the contents even if the power is
switched off. So, the firmware is stored in the ROM. When power is switched
on, the processor reads the ROM; the program is executed.
3. Input devices
Unlike the desktops, the input devices to an embedded system have very
limited capability. There will be no keyboard or a mouse, and hence interacting
with the embedded system is no easy task. Many embedded systems will have a
small keypad you press one key to give a specific command. A keypad may be
used to input only the digits. Many embedded systems used in process control
do not have any input device for user interaction they take inputs from sensors
or transducers.
19

4. Output devices
The output devices of the embedded systems also have very limited
capability. Some embedded systems will have a few Light Emitting Diodes
(LEDs) to indicate the health status of the system modules, or for visual
indication of alarms. A small Liquid Crystal Display (LCD) may also be used to
display some important parameters.
5. Communication interfaces
The embedded systems may need to, interact with other embedded systems
at they may have to transmit data to a desktop. To facilitate this, the embedded
systems are provided with one or a few communication interfaces such as
RS232, RS422, RS485, Universal Serial Bus (USB), and IEEE 1394, Ethernet
etc.
6. Application specific circuitry
Sensors, transducers, special processing and control circuitry may be
required in an embedded system, depending on its application. This circuitry
interacts with the processor to carry out the necessary work. The entire
hardware has to be given power supply either through the 230 volts main supply
or through a battery. The hardware has to design in such a way that the power
consumption is minimized.
7. Power supply
Most of the embedded systems now a days work on battery operated
supplies because low power dissipation is always required. Hence the systems
are designed to work with batteries.

4. HARDWARE IMPLEMENTATION OF THE PROJECT


20

This chapter briefly explains about the Hardware Implementation of the


project. It discusses the design and working of the design with the help of block
diagram and circuit diagram and explanation of circuit diagram in detail. It
explains the features, timer programming, serial communication, interrupts of
LPC2148 microcontroller. It also explains the various modules used in this

project.
4.1. Project Design
The implementation of the project design can be divided in two parts.
Hardware implementation
Firmware implementation
Hardware implementation deals in drawing the schematic on the plane paper
according to the application, testing the schematic design over the breadboard
using the various ICs to find if the design meets the objective, carrying out the
PCB layout of the schematic tested on breadboard, finally preparing the board
and testing the designed hardware.
The firmware part deals in programming the microcontroller so that it can
control the operation of the ICs used in the implementation. In the present
work, we have used the Orcad design software for PCB circuit design, the Keil
v4 software development tool to write and compile the source code, which has
been written in the C language. The Proload programmer has been used to write
this compile code into the microcontroller. The firmware implementation is
explained in the next chapter. The project design and principle are explained in
this chapter using the block diagram and circuit diagram. The block diagram
discusses about the required components of the design and working condition is
explained using circuit diagram and system wiring diagram.

21

4.1.1 Block Diagram of the Project and its Description


The block diagram of the design is as shown in Fig 4.1. It consists of
Power Supply Unit, ARM 7 (LPC 2148), Temperature sensor, voltage circuit,
light and LCD. The brief description of each unit is explained as follows.
Block Diagram:

Fig 4.1: Block diagram

4.2 Power Supply

22

The input to the circuit is applied from the regulated power supply. The a.c.
input i.e., 230V from the mains supply is step down by the transformer to 12V
and is fed to a rectifier. The output obtained from the rectifier is a pulsating d.c
voltage. So in order to get a pure d.c voltage, the output voltage from the
rectifier is fed to a filter to remove any a.c components present even after
rectification. Now, this voltage is given to a voltage regulator to obtain a pure
constant dc voltage.

Vmsint

Transf
ormer

To AC line

Rect
ifier

Filt
er

Regu
lator

Iout

load

Vout

Fig 4.2: Components of a regulated power supply


4.2.1. Transformer:
Usually, DC voltages are required to operate various electronic equipment
and these voltages are 5V, 9V or 12V. But these voltages cannot be obtained
directly. Thus the a.c input available at the mains supply i.e., 230V is to be
brought down to the required voltage level. This is done by a transformer. Thus,
a step down transformer is employed to decrease the voltage to a required level.

23

4.2.2. Rectifier:
The output from the transformer is fed to the rectifier. It converts A.C. into
pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this
project, a bridge rectifier is used because of its merits like good stability and full
wave rectification.
4.2.3. Filter:
Capacitive filter is used in this project. It removes the ripples from the
output of rectifier and smoothens the D.C. Output received from this filter is
constant until the mains voltage and load is maintained constant. However, if
either of the two is varied, D.C. voltage received at this point changes.
Therefore a regulator is applied at the output stage.
4.2.4. Voltage regulator:
As the name itself implies, it regulates the input applied to it. A voltage
regulator is an electrical regulator designed to automatically maintain a constant
voltage level. In this project, power supply of 5V and 12V are required. In order
to obtain these voltage levels shown in figure 4.3, 7805 and 7812 voltage
regulators are to be used. The first number 78 represents positive supply and the
numbers 05, 12 represent the required output voltage levels.
1

2 T1

In

7805

Out
R1-330

C1

0-18V/25mA

104PF

1000F/25v

LED

Diode Bridge

Figure 4.3: Power circuit diagram

4.3. ARM CONTROLLER [LPC2148]


24

4.3.1 General Description


The LPC2148 microcontrollers are based on a 16-bit/32-bit ARM7TDMI-S
CPU with real-time emulation and embedded trace support, that combine
microcontroller with embedded high speed flash memory ranging from 32 kB to
512 kB. A 128-bit wide memory interface and unique accelerator architecture
enable 32-bit code execution at the maximum clock rate. For critical code size
applications, the alternative 16-bit Thumb mode reduces code by more than 30
% with minimal performance penalty. Due to their tiny size and low power
consumption, LPC2148 are ideal for applications where miniaturization is a key
requirement, such as access control and point-of-sale. Serial communications
interfaces ranging from a USB 2.0 Full-speed device, multiple UARTs, SPI,
SSP to I2C-bus and on-chip SRAM of 8 kB up to 40 kB, make these devices
very well suited for communication gateways and protocol converters, soft
modems, voice recognition and low end imaging, providing both large buffer
size and high processing power. Various 32-bit timers, single or dual 10-bit
ADC(s), 10-bit DAC, PWM channels and 45 fast GPIO lines with up to nine
edge or level sensitive external interrupt pins make these microcontrollers
suitable for industrial control and medical systems.

4.3.1.1. Features
16-bit/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64
package.
8 kB to 40 kB of on-chip static RAM and 32 kB to 512 kB of onchip flash memory. 128-bit wide interface/accelerator enables high-speed
60 MHz operation.

25

In-System Programming/In-Application Programming (ISP/IAP)


via on-chip boot loader software. Single flash sector or full chip erase in
400 ms and programming of 256 bytes in 1 ms.
Embedded ICE RT and Embedded Trace interfaces offer real-time
debugging with the on-chip Real Monitor software and high-speed
tracing of instruction execution.
USB 2.0 Full-speed compliant device controller with 2 kB of
endpoint RAM. In addition, the LPC2146/48 provides 8 kB of on-chip
RAM accessible to USB by DMA.
One or two (LPC2141/42 vs. LPC2148) 10-bit ADCs provide a
total of 6/14 analog inputs, with conversion times as low as 2.44 s per
channel.
Single 10-bit DAC provides variable analog output (LPC2148
only).
Two 32-bit timers/external event counters (with four capture and
four compare channels each), PWM unit (six outputs) and watchdog.
Low power Real-Time Clock (RTC) with independent power and
32 kHz clock input.
Multiple serial interfaces including two UARTs (16C550), two Fast
I2C-bus (400k bit/s), SPI and SSP with buffering and variable data length
capabilities.
Vectored Interrupt Controller (VIC) with configurable priorities
and vector addresses.

26

Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny


LQFP64 package.
Up to 21 external interrupt pins available.
60 MHz maximum CPU clock available from programmable onchip PLL with settling time of 100 s.
On-chip integrated oscillator operates with an external crystal from
1 MHz to 25 MHz.
Power saving modes include idle and Power-down.
Individual enable/disable of peripheral functions as well as
peripheral clock scaling for additional power optimization.
Processor wake-up from Power-down mode via external interrupt
or BOD.

27

4.3.2 Block Diagram of LPC2148


The block diagram of LPC 2148 controller is shown in figure 4.4

28

Figure 4.4: Block Diagram of LPC2148

4.3.3 Pin Diagram


The pin diagram of LPC 2148 controller is shown in figure 4.5

29

Figure 4.5: Pin Diagram of LPC2148

4.3.4 Pin Description


The pin description of ARM7 LPC2148 is shown in below table 4.1
Table 4.1: ARM 7 Pin Description

30

Symbol

P
in

Description

ype

P0.0 to

P0.31

/O

Port0 is a 32 bit i/o port with


individual direction Controls for each bit.
Total of the 31 pins of the port 0 can be
used as a general purpose bidirectional
digital I/Os while port0.31 is output only
pin. The operation of port0 pins depends
upon the pin function selected via the pin
connected block.
Pin P0.24, P0.26, P0.27 are not available.

P0.0/TXD
0/PWM1

1
9

I
/O

P0.0-General purpose Digital I/O.


TXD0-Transmitter

output

for

O UART0.
O

PWM1-Pulse

Width

Modulator

output1.
P0.1/RX
D0/PWM3/

2
1

I
/O

EINT0

P0.1-General purpose I/O


RXD0-Receiver output for UART0

PWM3-pulse

width

modulator

O output3

P0.2/SCL
O/CAP0.0

2
2

EINT0-Enable interrupts 0 inputs.

P0.2-General

/O

purpose

input/output

digital pin
I

/O

SCLO-I2c clock input/output.


CAP0.0-Capture input for timer0,

O channel0.
P0.3/SDA
0/MAT0.0/E

2
6

I
/O

INT1

purpose

input/output

digital pin.
I

/O

P0.3-General

31
SDAOI2c clock input/output.

MAT0.0-match output for timer0,

4.3.5. Functional Description


4.3.5.1. Architectural overview
The ARM7TDMI-S is a general purpose 32-bit microprocessor, which
offers high performance and very low power consumption. The ARM
architecture is based on Reduced Instruction Set Computer (RISC) principles,
and the instruction set and related decode mechanism are much simpler than
those of micro programmed Complex Instruction Set Computers (CISC). This
simplicity results in a high instruction throughput and impressive real-time
interrupt response from a small and cost-effective processor core. Pipeline
techniques are employed so that all parts of the processing and memory systems
can operate continuously. Typically, while one instruction is being executed, its
successor is being decoded, and a third instruction is being fetched from
memory. The ARM7TDMI-S processor also employs a unique architectural
strategy known as Thumb, which makes it ideally suited to high-volume
applications with memory restrictions, or applications where code density is an
issue. The key idea behind Thumb is that of a super-reduced instruction set.
Essentially, the ARM7TDMI-S processor has two instruction sets:
The standard 32-bit ARM set.
A 16-bit Thumb set.

The Thumb sets 16-bit instruction length allows it to approach twice the
density of standard ARM code while retaining most of the ARMs performance
advantage over a traditional 16-bit processor using 16-bit registers. This is
possible because Thumb code operates on the same 32-bit register set as ARM
code.
32

Thumb code is able to provide up to 65 % of the code size of ARM, and 160
% of the performance of an equivalent ARM processor connected to a 16-bit
memory system. The particular flash implementation in the LPC2148 allows for
full speed execution also in ARM mode. It is recommended to program
performance critical and short code sections (such as interrupt service routines
and DSP algorithms) in ARM mode. The impact on the overall code size will be
minimal but the speed can be increased by 30% over Thumb mode.

4.3.5.2. On-chip flash program memory


The LPC2148 incorporates a 32 kB, 64 kB, 128 kB, 256 kB and 512 kB
flash memory system respectively. This memory may be used for both code and
data storage. Programming of the flash memory may be accomplished in several
ways. It may be programmed In System via the serial port. The application
program may also erase and/or program the flash while the application is
running, allowing a great degree of flexibility for data storage field firmware
upgrades, etc. Due to the architectural solution chosen for an on-chip boot
loader, flash memory available for users code on LPC2148 is 32 kB, 64 kB,
128 kB, 256 kB and 500 kB respectively. The LPC2148 flash memory provides
a minimum of 100,000 erase/write cycles and 20 years of data-retention.

4.3.5.3. On-chip static RAM


On-chip static RAM may be used for code and/or data storage. The SRAM
may be accessed as 8-bit, 16-bit, and 32-bit. The LPC2141, LPC2142/44 and
LPC2146/48 provide 8 kB, 16 kB and 32 kB of static RAM respectively. In case
of LPC2146/48 only, an 8 kB SRAM block intended to be utilized mainly by
the USB can also be used as a general purpose RAM for data storage and code
storage and execution.
33

4.3.5.4. Memory map


The LPC2148 memory map incorporates several distinct regions, as shown
in Figure 4.6. In addition, the CPU interrupt vectors may be remapped to allow
them to reside in either flash memory (the default) or on-chip static RAM. This
is described in System control.

4GB
3.75G
3.5GB

AHB PERIPHERALS
VPB PERIPHERALS
RESERVED ADDRESS SPACE

0FFFF FFFF
0F000 0000

3GB
0E000
2GB

BOOT BLOCK(12KB REMAPPED FROM


ON-CHIP FLASH MEMORY
007FF FFFF
07FFF D000
RESERVED ADDRESS SPACE

0000
0C000 0000
0C000 0000

07FFF CFFF
8KB ON-CHIP DMA SPACE
RAM
04000
8000
(LPC 2148)
03000 7FFF
RESERVED ADDRESS SPACE
04000 0000
32KB ON-CHIP STATIC 03FFF
RAM FFFF
00008 0000
16KB ON=CHIP STATIC RAM
00007 FFFF
8KB ON-CHIP STATIC RAM
00004 0000
(LPC 2141)
RESERVED ADDRESS SPACE
00003 FFFF
TOTAL OF 512KB ON-CHIP
NON
00001
0000
VOLATILE MEMORY (LPC 2148)
00000
FFFF
TOTAL OF 256KB ON-CHIP
NON
00000 0000
VOLATILE MEMORY (LPC 2146)
TOTAL OF 128KB ON-CHIP
NON
00000
7FFF
00000 8000
VOLATILE MEMORY (LPC 2144)
TOTAL OF 64KB ON-CHIP NON
00000 7FFF
34(LPC 2142)
VOLATILE MEMORY
TOTAL OF 32KB ON-CHIP NON
VOLATILE MEMORY (LPC 2141)

1GB

0.0GB

Figure 4.6:LPC2148 Memory map

4.3.5.5 Interrupt controller


The Vectored Interrupt Controller (VIC) accepts all of the interrupt request
inputs and categorizes them as Fast Interrupt Request (FIQ), vectored Interrupt
Request (IRQ), and non-vectored IRQ as defined by programmable settings.
The programmable assignment scheme means that priorities of interrupts from
the various peripherals can be dynamically assigned and adjusted. Fast interrupt
request (FIQ) has the highest priority. If more than one request is assigned to
FIQ, the VIC combines the requests to produce the FIQ signal to the ARM
processor. The fastest possible FIQ latency is achieved when only one request is
classified as FIQ, because then the FIQ service routine does not need to branch
into the interrupt service routine but can run from the interrupt vector location.
If more than one request is assigned to the FIQ class, the FIQ service routine
will read a word from the VIC that identifies which FIQ source(s) is (are)
requesting an interrupt. Vectored IRQs have the middle priority. Sixteen of the
interrupt requests can be assigned to this category. Any of the interrupt requests
can be assigned to any of the 16 vectored IRQ slots, among which slot 0 has the
highest priority and slot 15 has the lowest. Non-vectored IRQs have the lowest
priority. The VIC combines the requests from all the vectored and non-vectored
35

IRQs to produce the IRQ signal to the ARM processor. The IRQ service routine
can start by reading a register from the VIC and jumping there. If any of the
vectored IRQs are pending, the VIC provides the address of the highest-priority
requesting IRQs service routine, otherwise it provides the address of a default
routine that is shared by all the non-vectored IRQs. The default routine can read
another VIC register to see what IRQs are active.

4.3.5.6. Pin connect block


The pin connect block allows selected pins of the microcontroller to have
more than one function. Configuration registers control the multiplexers to
allow connection between the pin and the on chip peripherals. Peripherals
should be connected to the appropriate pins prior to being activated, and prior to
any related interrupt(s) being enabled. Activity of any enabled peripheral
function that is not mapped to a related pin should be considered undefined. The
Pin Control Module with its pin select registers defines the functionality of the
microcontroller in a given hardware environment. After reset all pins of Port 0
and 1 are configured as input with the following exceptions: If debug is enabled,
the JTAG pins will assume their JTAG functionality; if trace is enabled, the
Trace pins will assume their trace functionality. The pins associated with the
I2C0 and I2C1 interface are open drain.

4.3.5.7. Fast general purpose parallel I/O (GPIO)


Device pins that are not connected to a specific peripheral function are
controlled by the GPIO registers. Pins may be dynamically configured as inputs
or outputs. Separate registers allow setting or clearing any number of outputs
simultaneously. The value of the output register may be read back, as well as the
current state of the port pins.
36

LPC214148 introduces accelerated GPIO functions over prior LPC2000


devices:
GPIO registers are relocated to the ARM local bus for the fastest
possible I/O timing.
Mask registers allow treating sets of port bits as a group, leaving
other bits unchanged.

All GPIO registers are byte addressable, Entire port value can be

written in one instruction.


Features
Bit-level set and clear registers allow a single instruction set or
clear of any number of bits in one port.
Direction control of individual bits.
Separate control of output set and clear.
All I/O default to inputs after reset.

4.3.5.8. 10-bit ADC


The LPC2141/42 contains one and the LPC2144/46/48 contains two analog
to digital converters. These converters are single 10-bit successive
approximation analog to digital converters. While ADC0 has six channels,
ADC1 has eight channels. Therefore, total number of available ADC inputs for
LPC2148 is 14.
Features

10 bit successive approximation analog to digital converter.

37

Measurement range of 0 V to VREF (2.0 V VREF VDDA).

Every analog input has a dedicated result register to reduce

interrupt overhead.

Burst conversion mode for single or multiple inputs.

Optional conversion on transition on input pin or timer match

signal.

Global Start command for both converters (LPC2142/44/46/48

only).

4.3.5.9. UARTs
The LPC2148 each contains two UARTs. In addition to standard transmit
and receive data lines, the LPC2148 UART1 also provide a full modem control
handshake interface. Compared to previous LPC2000 microcontrollers, UARTs
in LPC2148 introduce a fractional baud rate generator for both UARTs,
enabling these microcontrollers to achieve standard baud rates such as 115200
with any crystal frequency above 2 MHz. In addition, auto-CTS/RTS flowcontrol functions are fully implemented in hardware (UART1 in LPC2148
only).
Features
16 byte Receive and Transmit FIFOs.
Register locations conform to 550 industry standard.
Receiver FIFO trigger points at 1, 4, 8, and 14 bytes Built-in
fractional baud rate generator covering wide range of baud rates without a
need for external crystals of particular values.
38

Transmission FIFO control enables implementation of software


(XON/XOFF) flow control on both UARTs.
LPC2148 UART1 equipped with standard modem interface
signals. This module also provides full support for hardware flow control
(auto-CTS/RTS).

4.3.5.10. Crystal oscillator


On-chip integrated oscillator operates with external crystal in range of 1
MHz to 25 MHz. The oscillator output frequency is called fosc and the ARM
processor clock frequency is referred to as CCLK for purposes of rate
equations, etc.

4.3.5.11. Reset and wake-up timer


Reset has two sources on the LPC2148: the RESET pin and watchdog reset.
The RESET pin is a Schmitt trigger input pin with an additional glitch filter.
Assertion of chip reset by any source starts the Wake-up Timer (see Wake-up
Timer description below), causing the internal chip reset to remain asserted until
the external reset is de-asserted, the oscillator is running, a fixed number of
clocks have passed, and the on-chip flash controller has completed its
initialization. When the internal reset is removed, the processor begins
executing at address 0, which is the reset vector. At that point, all of the
processor and peripheral registers have been initialized to predetermined values.
The Wake-up Timer ensures that the oscillator and other analog functions
required for chip operation are fully functional before the processor is allowed
to execute instructions. This is important at power on, all types of reset, and
39

whenever any of the aforementioned functions are turned off for any reason.
Since the oscillator and other functions are turned off during Power-down mode,
any wake-up of the processor from Power-down mode makes use of the Wakeup Timer.

The Wake-up Timer monitors the crystal oscillator as the means of checking
whether it is safe to begin code execution. When power is applied to the chip, or
some event caused the chip to exit Power-down mode, some time is required for
the oscillator to produce a signal of sufficient amplitude to drive the clock logic.
The amount of time depends on many factors, including the rate of VDD ramp
(in the case of power on), the type of crystal and its electrical characteristics (if
a quartz crystal is used), as well as any other external circuitry (e.g. capacitors),
and the characteristics of the oscillator itself under the existing ambient
conditions.

4.4. Temperature Sensor


LM35 converts temperature value into electrical signals. LM35 series
sensors are precision integrated-circuit temperature sensors whose output
voltage is linearly proportional to the Celsius temperature. The LM35 requires
no external calibration since it is internally calibrated. The LM35 does not
require any external calibration or trimming to provide typical accuracies of
14C at room temperature and 34C over a full 55 to +150C temperature
range.
The LM35s low output impedance, linear output, and precise inherent
calibration make interfacing to readout or control circuitry especially easy. It
can be used with single power supplies, or with plus and minus supplies. As it
draws only 60 A from its supply, it has very low self-heating, less than 0.1C
in still air.
40

Features
Calibrated directly in Celsius (Centigrade)
Linear + 10.0 mV/C scale factor
0.5C accuracy guaranteed (at +25C)
Rated for full 55 to +150C range
Suitable for remote applications
Low cost due to wafer-level trimming
Operates from 4 to 30 volts
Less than 60 A current drain
Low self-heating, 0.08C in still air
Nonlinearity only 14C typical
Low impedance output, 0.1 W for 1 mA load

The characteristic of this LM35 sensor is:


For each degree of centigrade temperature it outputs 10milli volts.

4.5. VOLTAGE SENSING CIRCUIT

41

Fig: Circuit Diagram Of Votage Sensing Circuit


In this circuit, we will show how to build a voltage sensor circuit.
A voltage sensor circuit is a circuit that can sense the voltage input into it. If
the voltage reaches a certain threshold, then an indicator, such as an LED, will
turn on.
This is not a voltmeter circuit, where we know or are measuring the amount
of voltage input into it. That's a different thing entirely.
This is a voltage sensor circuit, where if we get to a certain level of voltage,
then the output will turn on.
And we can build a voltage sensor circuit, simply with a POT (variable
resistor), This arrangement is normally used to vary voltage. we place the
reference voltage or the threshold voltage, If the voltage reaches or goes above
this level, the output will turn on
Potentiometer
Variable resistors used as potentiometers have all three terminals
connected. This arrangement is normally used to vary voltage, for example to
set the switching point of a circuit with a sensor, or control the volume
(loudness) in an amplifier circuit. If the terminals at the ends of the track are
42

connected across the power supply, then the wiper terminal will provide a
voltage which can be varied from zero up to the maximum of the supply.

Presets

Fig: Preset
These are miniature versions of the standard variable resistor. They are
designed to be mounted directly onto the circuit board and adjusted only when
the circuit is built. For example, to set the frequency of an alarm tone or the
sensitivity of a light-sensitive circuit, a small screwdriver or similar tool is
required to adjust presets.

43

Presets are much cheaper than standard variable resistors so they are
sometimes used in projects where a standard variable resistor would normally
be used.
Multiturn presets are used where very precise adjustments must be made.
The screw must be turned many times (10+) to move the slider from one end of
the track to the other, giving very fine control.

4.6. TRIAC BT136


General Description
Glass passivated, sensitive gate triacs in a plastic envelope, intended for
use in general purpose bidirectional switching and phase control applications,
where high voltages sensitivity is required in all four quadrants.

44

4.7. TRIAC DRIVER MOC3021


The MOC301XM and MOC302XM series are optically isolated triac
driver devices. These devices consist of gallium arsenide infrared emitting
diodes, optically coupled to silicon bilateral switch and are designed for
applications requiring isolated triac triggering, lowcurrent isolated ac
switching, high electrical isolation (to 7500 VAC peak), high detector standoff
voltage, small size, and low cost. This series is designed for interfacing between
electronic controls and power triacs to control resistive and inductive loads for
115/240V AC operations.

45

Features:
Low input current required (typically 5mA).
High isolation voltage-minimum 7500 VAC peak
Applications:
TRIAC driver
Industrial controls
Traffic lights
Vending machines
Motor control
Solid state relay
Solenoid/valve controls
Static AC power switch
Incandescent lamp dimmers
Lamp ballasts

4.8. Ethernet Module


46

This board utilizes the new Microchip ENC28J60 Stand- Alone Ethernet
Controller IC featuring a host of features to handle most of the network protocol
requirements. The board connects directly to most microcontrollers with a
standard SPI interface with a transfer speed of up to 20 MHz. This module
contains what you need to enable ethernet on your next microcontroller project.
It includes a ENC28J60 ethernet controller, an RJ45 socket with link/activity
lights and integrated transformer. This ethernet module enables you to connect a
particular Embedded device (equipped with SPI support) on to a network. By
using this Ethernet module (along with a microcontroller running a small
TCP/IP stack) applications like Embedded Web server can be easily developed.

Fig: Ethernet module


Use this module to enable Ethernet interface for your product. It works with
any microcontroller operating at 3.3V or 5V. This module works at 5V and is
compatible with 5V interface lines. Use SPI process to interface with it. Host
web server, ping the module or add it to home automation via internet. Heart of
this module is ENC28J60 Ethernet controller from Microchip. This board is
assembled with all components as shown in the picture.

47

The circuit board includes all required components for the ethernet
controller, plus a 3.3V Voltage Regulator and a RJ-45 jack with integrated
transformer and built-in Link and Activity LEDs for connection to an Ethernet
Local Area Network.
Features
1. Microchip ENC28J60 Ethernet Chip supporting Microchips
TCP/IP protocol stack, with IPv4,
2. UDP, TCP, DHCP, ICMP, FTP, and HTTP support
3. On board voltage regulator for 3V
4. Compatible with all controllers having an SPI interface, SPI
interface takes only few pins to add Ethernet interface to your
microcontroller project
5. Suitable for Either 5V or 3.3V Interface
6. LAN connector with build in transformer
7. Link and Activity LED's on Ethernet connector
8. 8 pin standard interface connector with spacing of 0.1 (2.54 mm)
row pins
9. IEEE 802.3 Compatible with Integrated MAC and 10Base-T PHY
10.

Fully Compatible with 10/100/1000Base-T Networks

11.

Supports One 10Base-T Port with Automatic Polarity

Detection and Correction


12.

Supports Full and Half-Duplex modes

13.

Programmable Automatic Retransmit on Collision


48

14.

Programmable Padding and CRC Generation

15.

Programmable SPI Interface with Clock Speeds Up to 20

MHz
Applications
a. Remote control and monitoring
b. Data capture and logging
c. Industrial Automation
d. Building Automation
e. Appliance remote management
f. Robotics
g. Microcontroller Research and Development
h. TCP/IP Research and Development
Specification
a. Board Size: 2.3 x 0.94 (60x24mm)
b. Operating Voltage: +5V DC
c. Current Consumption: 160mA
d. Pin Spacing: 0.1" (2.54mm)
e. Output wire length: 12(304mm)

Typical Application Setup

49

Software
Microchip's TCP-IP stack full featured TCP-IP stack, very easy to configure
and use with PIC microcontrollers. Microchip provides a driver for the
ENC28J60 and a TCP/IP stack including an HTTP web server. Web pages are
stored in external or internal eeprom. This firmware is written in C (Compatible
with Microchip C18 compiler).

4.9. LIQUID CRYSTAL DISPLAY


LCD stands for Liquid Crystal Display. LCD is finding wide spread use
replacing LEDs (seven segment LEDs or other multi segment LEDs) because of
the following reasons:
1. The declining prices of LCDs.
2. The ability to display numbers, characters and graphics. This is in
contrast to LEDs, which are limited to numbers and a few characters.
3. Incorporation of a refreshing controller into the LCD, thereby
relieving the CPU of the task of refreshing the LCD. In contrast, the LED
must be refreshed by the CPU to keep displaying the data.
4. Ease of programming for characters and graphics.
These

components

are

specialized

for

being

used

with

the

microcontrollers, which means that they cannot be activated by standard IC


circuits. They are used for writing different messages on a miniature LCD.

50

A model described here is for its low price and great possibilities most
frequently used in practice. It is based on the HD44780 microcontroller
(Hitachi) and can display messages in two lines with 16 characters each. It
displays all the alphabets, Greek letters, punctuation marks, mathematical
symbols etc. In addition, it is possible to display symbols that user makes up on
its own.
Automatic shifting message on display (shift left and right), appearance of
the pointer, backlight etc. are considered as useful characteristics.
Pins Functions
Pi

Function

Name

Ground (0V)

Ground

Supply Voltage, 5V(4.7 V-5.3V)

Vcc

Contrast adjustment, through a variable resistor

VEE

Selects command register when low, and the

Register

n No

register when high


5

select

Low to write to the register, high to read from the


register

Read
/Write

Sends data to data pins when a high to low pulse is

Enable

given
7

DB0

51

DB1

DB2

10

8- BIT DATA PINS

DB3

11

DB4

12

DB5

13

DB6

14

DB7

15

Backlight Vcc(5V)

Led +

16

Backlight ground(0V)

Led+

There are pins along one side of the small printed board used for connection
to the microcontroller. There are total of 14 pins marked with numbers (16 in
case the background light is built in). Their function is described in the table
below:
LCD screen:
LCD screen consists of two lines with 16 characters each. Each character
consists of 5x7 dot matrix. Contrast on display depends on the power supply
voltage and whether messages are displayed in one or two lines. For that reason,
variable voltage 0-Vdd is applied on pin marked as Vee. Trimmer potentiometer
is usually used for that purpose. Some versions of displays have built in
backlight (blue or green diodes). When used during operating, a resistor for
current limitation should be used (like with any LE diode).

52

LCD Basic Commands


All data transferred to LCD through outputs D0-D7 will be interpreted as
commands or as data, which depends on logic state on pin RS:
RS = 1 - Bits D0 - D7 are addresses of characters that should be displayed.
Built in processor addresses built in map of characters and displays
corresponding symbols. Displaying position is determined by DDRAM address.
This address is either previously defined or the address of previously transferred
character is automatically incremented.
RS = 0 - Bits D0 - D7 are commands which determine display mode. List of
commands which LCD recognizes are given in the table below:

Command

RS

RW

D7

D6

D5

D4

D3

D2

D1

D0

Execution
Time

Clear display

1.64Ms

Cursor home

1.64mS

Entry mode set

I/D

40uS

on/off 0

40uS

Display

53

control
Cursor/Display

D/C

R/L

40uS

DL

40uS

CGRAM 0

CGRAM address

DDRAM 0

DDRAM address

40uS

BUSY 0

BF

DDRAM address

D7

D6

D5

D4

D3

D2

D1

D0

40uS

from 1

D7

D6

D5

D4

D3

D2

D1

D0

40uS

Shift
Function set
Set

40uS

address
Set
address
Read
flag (BF)
Write to CGRAM
or DDRAM
Read
CGRAM

or

DDRAM

I/D 1 = Increment

R/L 1 = Shift right

(by 1)

0 = Shift left
0 = Decrement

(by 1)
S 1 = Display shift on

DL 1 = 8-bit interface

0 = Display shift

0 = 4-bit interface

off
D 1 = Display on

N 1 = Display in two lines

0 = Display off

0 = Display in
one line

U 1 = Cursor on

F 1 = Character format
5x10 dots

0 = Cursor off
54

0 = Character
format 5x7

B 1 = Cursor blink on

D/C 1 = Display shift

0 = Cursor blink

0 = Cursor shift

off

LCD Connection
Depending on how many lines are used for connection to the
microcontroller, there are 8-bit and 4-bit LCD modes. The appropriate mode is
determined at the beginning of the process in a phase called initialization. In
the first case, the data are transferred through outputs D0-D7 as it has been
already explained. In case of 4-bit LED mode, for the sake of saving valuable
I/O pins of the microcontroller, there are only 4 higher bits (D4-D7) used for
communication, while other may be left unconnected.

Consequently, each data is sent to LCD in two steps: four higher bits are
sent first (that normally would be sent through lines D4-D7), four lower bits are
sent afterwards. With the help of initialization, LCD will correctly connect and
interpret each data received. Besides, with regards to the fact that data are rarely
read from LCD (data mainly are transferred from microcontroller to LCD) one
more I/O pin may be saved by simple connecting R/W pin to the Ground. Such
saving has its price.
Even though message displaying will be normally performed, it will not be
possible to read from busy flag since it is not possible to read from display.

55

LCD Initialization
Once the power supply is turned on, LCD is automatically cleared. This
process lasts for approximately 15mS. After that, display is ready to operate.
The mode of operating is set by default. This means that:
1. Display is cleared
2. Mode
DL = 1 Communication through 8-bit interface
N = 0 Messages are displayed in one line
F = 0 Character font 5 x 8 dots
3. Display/Cursor on/off
D = 0 Display off
U = 0 Cursor off
B = 0 Cursor blink off
4. Character entry
ID = 1 Addresses on display are automatically incremented by 1
S = 0 Display shift off
Automatic reset is mainly performed without any problems. If for any
reason power supply voltage does not reach full value in the course of 10mS,
display will start perform completely unpredictably.
56

If voltage supply unit cannot meet this condition or if it is needed to


provide completely safe operating, the process of initialization by which a new
reset enabling display to operate normally must be applied.
Algorithm according to the initialization is being performed depends on
whether connection to the microcontroller is through 4- or 8-bit interface. All
left over to be done after that is to give basic commands and of course- to
display messages.

Contrast control:
To have a clear view of the characters on the LCD, contrast should be
adjusted. To adjust the contrast, the voltage should be varied. For this, a preset
is used which can behave like a variable voltage device. As the voltage of this
preset is varied, the contrast of the LCD can be adjusted.

57

Potentiometer
Variable resistors used as potentiometers have all three terminals
connected. This arrangement is normally used to vary voltage, for example to
set the switching point of a circuit with a sensor, or control the volume
(loudness) in an amplifier circuit. If the terminals at the ends of the track are
connected across the power supply, then the wiper terminal will provide a
voltage which can be varied from zero up to the maximum of the supply.

Presets
These are miniature versions of the standard variable resistor. They are
designed to be mounted directly onto the circuit board and adjusted only when
the circuit is built. For example, to set the frequency of an alarm tone or the
sensitivity of a light-sensitive circuit, a small screwdriver or similar tool is
required to adjust presets.

58

Presets are much cheaper than standard variable resistors so they are
sometimes used in projects where a standard variable resistor would normally
be used.
Multiturn presets are used where very precise adjustments must be made.
The screw must be turned many times (10+) to move the slider from one end of
the track to the other, giving very fine control.

5. FIRMWARE IMPLEMENTATION OF HT PROJECT


DESIGN

5.1 Firmware Implementation


Firmware implementation deals in programming the microcontroller so that
it can control the operation of the ICs used in the implementation. In the
present work, we have used the Orcad design software for PCB circuit design,
the Keil v4 software development tool to write and compile the source code,
which has been written in the C language. The Flash magic programmer has
been used to write this compile code into the microcontroller.
Software Tools Required

Orcad

Keil Vision4

59

Flash Magic

Orcad is used for drawing the schematic diagram, it is mentioned above.


Keilv4, Flash magic are the two software tools used to program
microcontroller. The working of each software tool is explained below in detail.

5.1.1 Programming code description


A compiler for a high level language helps to reduce production time. To
program the LPC2148 microcontroller the Keil v4 is used. The programming
is done in the embedded C language or Assembly language. Keil v4 is a suite
of executable, open source software development tools for the microcontrollers
hosted on the Windows platform.
One of the difficulties of programming microcontrollers is the limited
amount of resources the programmer has to deal with. In personal computers
resources such as RAM and processing speed are basically limitless when
compared to microcontrollers. In contrast, the code on microcontrollers should
be as low on resources as possible.

5.1.2 Keil Compiler


Keil compiler is software used where the machine language code is written
and compiled. After compilation, the machine source code is converted into hex
code which is to be dumped into the microcontroller for further processing. Keil
compiler also supports C language code.
The compilation of the C program converts it into machine language
file (.hex). This is the only language the microcontroller will understand,
because it contains the original program code converted into a hexadecimal
format. During this step there are some warnings about eventual errors in the
program. If there are no errors and warnings then run the program, the system
performs all the required tasks and behaves as expected the software developed.

60

If not, the whole procedure will have to be repeated again. Below figures show
the compilation of the program.

Figure 5.1 Compilation of source Code.

61

Figure 5.2 Run process of compiled Code.

5.2.3 Flash magic


Flash Magic is a PC tool for programming flash based microcontrollers
from NXP using a serial or Ethernet protocol while in the target hardware. The
figures below show how the baud rate is selected for the microcontroller, how
are the registers erased before the device is programmed.
62

Figure 5.3 Dumping of the code into Microcontroller

63

Figure 5.4 Dump process finished


If dumping process of the hex file is completed, then the controller will
work as per our requirement.

64

6. WORKING PROCEDURE OF THE PROJECT


SCHEMATIC DIAGRAM

65

6.1. WORKING PROCEDURE


The aim of this project is to monitor the parameters of industry from
anywhere in the world from PC or phones through internet. In this project we
will create an application to monitor the industry parameters like monitoring
temperature and voltage from webpage. Whenever we open this application it
gives the current status of industry.
The web page was created by using HTML. The web page was opened by
just entering the IP address of the Ethernet module in the web browser address
bar. Here in this project we are using the temperature sensor and the voltage
sensor to monitor the temperature and the voltage. The outputs of these sensors
are connected to the ADC pins of the LPC2148 microcontroller. The internal
ADC will convert those analog values from the sensor into the corresponding
digital values and stores those into the internal registers of the ADC. Those
registers data will be read by the microcontroller into the temporary variable
and these digital parameters are displayed on the LCD screen as well. The
industrial loads are controlled from the web page itself. When you open the web
page in the browser, it shows the status of the industry parameters and also the
status of the loads. There are separate knobs for the controlling of each load. If
you press that knob ON/OFF buttons, we can control the loads from the web
page.

66

7. RESULTS AND CONCLUSIONS


7.1 RESULTS
The implementation and realization of Substation Parameters Monitoring
and Control Using Arm Controller is done successfully. The communication is
properly done without any interference between different modules in the design.
Design is done to meet all the specifications and requirements. Software tools
like keil uvision simulator, Flash magic to dump the source code into the
microcontroller, OrCAD for the schematic diagram have been used to develop
the software code before realizing the hardware.
The objective of this system is to monitor the industrial process parameter
on real time basis using Ethernet. This system has advantages that is has small
size, Reliability, and low power consumption.

7.2 CONCLUSION
This is low cost method for monitoring the industrial parameter like
temperature remotely LM 35 is better because it is suitable for all industrial
application in which temperature from -200 C to 600 C , It is accurate, less
expensive and easy to use. Its output is relatively large changed with
temperature as compare with thermocouple. The ARM can communicate with
PC using serial port using RS 232, It support online supervision using not only
private LAN but also using Public network. By using embedded hardware and
software we can control the require industrial parameter and industrial
automation using Ethernet with high accuracy. If we select the proper sensor
depending on the range of temperature measure or industrial environment, we
can increase the sensitivity of this system.
67

7.3 FUTURE SCOPE:


In present system, the load was connected to the voltage sensor and the load
was controlled through the value of the voltage output of the sensor and the
same thing was updated to the web through Ethernet module. But if there was
any load absence or load failure occurs, we cannot get the notification. So in the
future, we can add a ZCD to get the alert, if in case of any load absence or load
failure detects, through the interrupt signal to the microcontroller.

7.4 ADVANTAGES
1. Power saving
2. No need to go to industry to check parameters status
3. Easy to use
4. Secured also
5. No need of computer ,from mobile itself we can monitor

7.5 APPLICATIONS
Emergency alerts when parameters exceeds their threshold values
Can also be used for

access control system and appliances

controlling system
Can be used for home or industry security systems
Useful for Weather monitoring systems

68

REFERENCES
[1] www.microbuilder.edu/tutorials/LPC 2148.
[2]

Philips

semiconductor,

LPC

2142/2146/2138,

prelimnary

datasheet,rev.0.1,JUNE2005. [3] Microchip Technology Inc. ENC 28J60 Data


Sheet 2008.
[4] Dhananjay patil ,Industrial Parameter control and monitoring using
LAN ,IRNET explore ,7th Oct.2012
[5] S. Ferber ARM System on Chip Aechitecture , Addison-Wesley, Boston,
MA, 2000.
[6] Alen Rajan, Aby K. Thomas, Rejin Mathew A Comparative
Performance Analysis of ARM based Web Servers with Integrated and External
Ethernet Interfaces for Industrial Applications of paper with only first word
capitalized, International Journal of Computer Applications (0975 8887)
Volume 44 No.21, April Page N0 28-35.
[7] S.A.N. Sandeep, P. Malyadri, ARM-based Embedded Ethernet
Interface Design Using DAC System, International Journal of Engineering and
Advanced Technology (IJEAT) ISSN: 2249 8958, Volume-1, Issue-6, August
2012.
[8]www.facsstaff.bucknell.edu/mastascu/elessonsHTML/sensors/TempR.ht
ml.
[9] Florin Ravigan, Niculae Boteanu, Adrian Mircea Drighiciu, Ethernet
interface for a system of Automation with microcontroller,Annals of the
university of Craiova Electrical Engineering series No 35, 2011, ISSN 18424805

69

[10] Kumbhar trupti sambhaji, Prof S.B. Patil, Design of PIC based
Ethernet interface to control the industrial parameter, International journa of
engineering reasurch and application (IJERA), ISSN: 2248-9622 Vol. 2 Issue 4,
July-n Aug 2012 PP 977-979
[11] U. suneetha, K. tanveer alam, N. Anuja latha, B.V. S. goud,B.
ramamurthi, Ethernet based remote monitoring and control of temperature by
uning Rabbit processor, International journal of advanced computer science
and applications(IJACSA),Vol.3, No 9, 2012
[12] Mr M.R. Gaikar, Prof S.G.Galande, Prof. D.B.Rane Ethernet
Controller ARM Processor International journal of Electronics communication
and soft computing science and engineering volume 2 issue 1
[13] Bin Tan, Bo Yuan and Bing Zhu, The Design of ethernet controller
interface circuit based on ENC 28J60 Proceding of second International
Symposium on networking and network security(ISNNS10) 2-4 April 2010.
[14] Data acquisition basics from National Instruments.
[15] Switched and fast Ethernet, Second Edition, Robort Breyer and Sean
Riley,1996,Macmilan Computer Publishing USA
[16] The Industrial Ethernet Book, Issue 1, Published by field bus
Publication.

70