Introduction
1.1 Introduction
Nowadays, with the advancement of technology, all the activities in our day to day
living have become a part of information and we find micro-controllers in each and
every application. Thus, the trend is directing towards the microcontroller based
applications. In this project micro controller is used for controlling various
parameters. The term Automation refers to means of control of electrical and
mechanical operations without human interference. In our project the automation
can be done from remote places through low power embedded web servers.
Internet and Computer communication systems are playing an important role in the
daily life. Many applications are possible to implement using this knowledge. Home
automation, utility meters, appliances, security systems, card readers, and building
controls, which can be easily, controlled using either special front-end software or a
standard internet browser client from anywhere around the world.
A web server in the device provides access to the user interface functions for the
device through a device web page. A web server can be embedded into any appliance
and connected to the Internet so the appliance can be monitored and controlled from
remote places through the browser in a desktop.
1
1.2 Aim of the project
The aim of the project is to control the devices or equipment’s from the remote place
through a web page. Here all the devices, which are to be controlled, are connected to
the relays (acts as switches) on the web server circuit board. The web-server circuit is
connected to LAN or Internet. The client or a person on the PC is also connected to
same LAN or Internet. By typing the IP-address of LAN on the web browser, the
user gets a web page on screen; this page contains all the information about the status
of the devices (whether they are ON or OFF). On this page the user is provided with
checkboxes to check or uncheck the boxes in order switch OFF or switch ON the
devices.
Controlling the home or any company appliances manually requires a lot of effort.
When we are outside the office/home we can’t even maintain them properly. This
may lead to power wastage and may reduce equipment life time thereby it may
reduce the system efficiency. Hence, we are going for this project.
In our project we are making use of a PIC micro controller, which use less power
when compared to other micro controllers. Here, we can access the control
information of devices through web page from remote places. This will reduce the
human effort to a great extent. By this way we can reduce the power usage and can
properly maintain the devices efficiently.
Lot of research has been carried out in the area of home automation which helps in
providing flexibility in handling home appliances from distant places. The web site
which we mostly referred is www.en.wikepedia.com. We also referred other web
sites such as www.microchip.com, www.flashmagic.com and
www.national.com/pf/LM/LM2825.html
2
We also referred text books such as Programming and Customizing PIC
microcontroller by Myke Predko, Serial Communication by Roger L.Stevens,
Embedded Ethernet and Internet complete by Jan Axelson etc and we had also
referred journals like EURASIP and some other articles related to our topic.
Our main intension here is to control the devices or equipment’s from the remote
place through a web page. Here all the devices, which are to be controlled, are
connected to the relays (acts as switches) on the web server circuit board. The web-
server circuit is connected to LAN or Internet. The client or a person on the PC is
also connected to same LAN or Internet. By typing the IP-address of LAN on the
web browser, the user gets a web page on screen; this page contains all the
information about the status of the devices. The user can also control the devices
interfaced to the web server by pressing a button provided in the web page.
3
DRIVER UNIT DEVICE
I
5V SUPPLY
DEVICE
DRIVER UNIT II
3.3V SUPPY
Sensor I
PIC AD
PROCESSOR C Sensor II
L PROTOCOL
A
N S
P SPI
C I COMMUNICATION DEVICE
O STATUS
N RJ45 10 Base READER
N ENC28J60
T ETHERNET
E
C Ethernet CONTROLLER
T
I
O
N
Client
LAN
4
1.6. Application of the project
Using the Internet many applications are implemented such as home automation,
utility meters, appliances, security systems, card readers, and building controls,
which can be easily, controlled using either special front-end software or a standard
internet browser client from anywhere around the world.
A wireless Automation Using Low Power Embedded Web server is used to provide
control of appliances from remote places through webpage. This finds applications in
automation of home or any company from remote places. This can also be used in
large industries to control required devices.
This project report consists of six chapters including introduction and conclusion.
Introduction about the project, aim and motivation are included in the first chapter.
Chapter 2 gives detailed description of the circuit diagram and chapter 3 contains
details about relays and temperature sensors used in the project. Serial
communication is discussed in chapter 4 and chapter 5 includes details of all the
embedded soft wares used to develop this project. Finally Results and Conclusions
are discussed in chapter 6.
5
Chapter-2
Circuit analysis
Introduction
In this chapter we are going to discuss about the PIC microcontroller and its
features, power supply unit, ADC module, Ethernet Controller, oscillator, voltage
regulator and also about the RJ45.
• It is 8-bit Microcontroller
6
• Low power, High speed Flash/EEPROM Technology
2.1.1. Features
7
pin an input (i.e., put the corresponding output driver in a Hi-Impedance mode).
Clearing a TRISA bit (= 0) will make the corresponding PORTA pin an output (i.e.,
put the contents of the output latch on the selected pin). Reading the PORTA
register reads the status of the pins, whereas writing to it will write to the port latch.
All write operations are read-modify-write operations. Therefore, a write to a port
implies that the port pins are read, the value is modified and then written to the port
data latch. Pin RA4 is multiplexed with the Timer0 module clock input to become
the RA4/T0CKI pin. The RA4/T0CKI pin is a Schmitt Trigger input and an open
drain output. All other PORTA pins have TTL input levels and full CMOS output
drivers. Other PORTA pins are multiplexed with analog inputs and analog VREF
input. The operation of each pin is selected by clearing/setting the control bits in the
ADCON1 register (A/D Control Register1).
Four of the PORTB pins, RB7:RB4, have an interrupt on- change feature. Only pins
configured as inputs can cause this interrupt to occur. The input pins (of RB7:RB4)
are compared with the old value latched on the last read of PORTB. The
8
“mismatch” outputs of RB7:RB4 are OR’ed together to generate the RB Port
Change Interrupt with flag bit RBIF (INTCON<0>).
2.1.4. PORT C
9
V D D
0 . 1 u F
S W 2 C 1 0
R 5 R 6
2 2 0 o h m 1 k
R E S E T
11
32
12
31
VSS
VSS
VDD
VDD
1 4 0 R B 7
M C L R M C L R / V p p R B 7 / 3P 9 G DR
R A 0 2 B 6
R A 0 R A 0 / A N 0 R B 6 / 3P 8 G CR
R A 1 3 B 5
R A 2 4 R A 1 / A N 1 R B 35 7 R B 4
R A 3 5 R A 2 / A N 2 / V
r e Rf - B 34 6 R B 3
R A 4 6 R A 3 / A N 3 / V
Rr e B f +3 / 3 P 5 G MR B 2
R A 5 7 R A 4 / T 0P C I C 1 6 FR
K I 8 B 7 3 27 4 R B 1
R E 0 8 R A 5 / A N U 4 3/ S S R B 31 3 R B 0
R E 1 9 R E 0 / A N 5 / R DR B 0 / I N T
R E 2 1 0 R E 1 / A N 6 / W R
R E 2 / A N 7 / C S
1 3
1 4 O S C 1 / C L K
I N 3 0 R D 7
O S C 2 / C L K
OR UD T7 / 2P 9 S RP 7D 6
R C 01 5 R D 6 / 2P 8 S RP 6D 5
Y 1
R C 11 6 R C 0 / T 1 O S OR / D T 51 /C 2 P K7 S I RP 5D 4
R C 21 7 R C 1 / T 1 O S IR/ C D C 4 /P 2 P 22 S RP 4D 3
R C 31 8 R C 2 / C C P 1 R D 3 / 2P 1 S RP 3D 2
4 M h z
R C 42 3 R C 3 / S C K / SR C D L 2 / 2P 0 S RP 2D 1
C 8 C 9 R C 52 4 R C 4 / S D I / S RD DA 1 / 1P 9 S RP 1D 0
2 7 p F 2 7 pR F C 62 5 R C 5 / S D O R D 0 / P S P 0
R C 72 6 R C 6 / T X / C K
R C 7 / R X / D T
T XR X
The ac voltage, typically 220V rms, is connected to a transformer, which steps that ac
voltage down to the level of the desired dc output. A diode rectifier then provides a
full-wave rectified voltage that is initially filtered by a simple capacitor filter to
10
produce a dc voltage. This resulting dc voltage usually has some ripple or ac voltage
variation.
A regulator circuit removes the ripples and also remains the same dc value even if the
input dc voltage varies, or the load connected to the output dc voltage changes. This
voltage regulation is usually obtained using one of the popular voltage regulator IC
units.
2.2.1. Transformer
Potential Transformers
PTs or VTs are the most common devices used. These devices are conventional
transformers with two or three windings (one primary with one or two secondary).
They have an iron core and magnetically couple the primary and secondary. The
high side winding is constructed with more copper turns than the secondary(ies),
and any voltage impressed on the primary winding is reflected on the secondary
windings in direct proportion to the turns ratio or PT ratio.
Current Transformers
11
isolates measurement and control circuitry from the high voltages typically present
on the circuit being measured. The potential transformer will step down the power
supply voltage (0-230V) to (0-6V) level. Then the secondary of the potential
transformer will be connected to the precision rectifier, which is constructed with
the help of op–amp.
The advantages of using precision rectifier are it will give peak voltage output as
DC, rest of the circuits will give only RMS output.[7]
When four diodes are connected as shown in figure, the circuit is called as bridge
rectifier. The input to the circuit is applied to the diagonally opposite corners of the
network, and the output is taken from the remaining two corners.
Let us assume that the transformer is working properly and there is a positive
potential, at point A and a negative potential at point B. the positive potential at
point A will forward bias D3 and reverse bias D4.
The negative potential at point B will forward bias D1 and reverse D2. At this time
D3 and D1 are forward biased and will allow current flow to pass through them; D4
and D2 are reverse biased and will block current flow.
The path for current flow is from point B through D1, up through RL, through D3,
through the secondary of the transformer back to point B. this path is indicated by
the solid arrows. Waveforms (1) and (2) can be observed across D1 and D3.
One-half cycle later the polarity across the secondary of the transformer reverse,
forward biasing D2 and D4 and reverse biasing D1 and D3. Current flow will now
be from point A through D4, up through RL, through D2, through the secondary of
T1, and back to point A. This path is indicated by the broken arrows. Waveforms
(3) and (4) can be observed across D2 and D4. The current flow through RL is
always in the same direction. In flowing through RL this current develops a voltage
corresponding to that shown waveform (5). Since current flows through the load
12
(RL) during both half cycles of the applied voltage, this bridge rectifier is a full-
wave rectifier.
This may be shown by assigning values to some of the components shown in views
A and B. assume that the same transformer is used in both circuits. The peak
voltage developed between points X and y is 1000 volts in both circuits. In the
conventional full-wave circuit shown—in view A, the peak voltage from the center
tap to either X or Y is 500 volts. Since only one diode can conduct at any instant,
the maximum voltage that can be rectified at any instant is 500 volts.
The maximum voltage that appears across the load resistor is nearly-but never
exceeds-500 v0lts, as result of the small voltage drop across the diode. In the bridge
rectifier shown in view B, the maximum voltage that can be rectified is the full
secondary voltage, which is 1000 volts. Therefore, the peak output voltage across
the load resistor is nearly 1000 volts. With both circuits using the same transformer,
the bridge rectifier circuit produces a higher output voltage than the conventional
full-wave rectifier circuit.
Voltage regulators comprise a class of widely used ICs. Regulator IC units contain
the circuitry for reference source, comparator amplifier, control device, and
overload protection all in a single IC. IC units provide regulation of either a fixed
positive voltage, a fixed negative voltage, or an adjustably set voltage. The
regulators can be selected for operation with load currents from hundreds of milli
amperes to tens of amperes, corresponding to power ratings from milli watts to tens
of watts.
13
provide fixed positive regulated voltages from 5 to 24 volts. Similarly, the series 79
regulators provide fixed negative regulated voltages from 5 to 24 volts.
D 1
1
V D D
J P 2
2 - + 4 1 2
2 V IV N O U T V D D
1 U 2
7 8 0 5 R 4
GND
2 2 0 V A C C 5 C 6 C 7 2 2 0 o h m
4 7 0 u F 1 0 0 u F0 . 1 u F
3
D 2
3
L E D
The operation of power supply circuits built using filters, rectifiers, and then
voltage regulators. Starting with an AC voltage, a steady DC voltage is obtained by
rectifying the AC voltage, then filtering to a DC level, and finally, regulating to
obtain a desired fixed DC voltage. The regulation is usually obtained from an IC
voltage regulator Unit, which takes a DC voltage and provides a somewhat lower
14
DC voltage, which remains the same even if the input DC voltage varies, or the
output Load connected to the DC voltage changes.
Initially all bits of SAR are set to 0. Then, beginning with the most significant bit,
each bit is set to 1 sequentially. If the DAC output does not exceed the input signal
voltage, the bit is left as a 1. Otherwise it is set back to 0. It is kind of a binary
search. For an n-bit ADC, n steps are required.
15
store. A pipeline store enables the A-D converter to do another conversion while the
previous data is transferred to the computer. [8]
16
o A/D Result High Register (ADRESH)
The ADCON0 register controls the operation of the A/D module. The ADCON1
register configures the functions of the port pins. The port pins can be configured as
analog inputs (RA3 can also be the voltage reference) or as digital I/O.
• ADCON 0 Register
• ADCON 1 Register:
2.4.1. Introduction
17
has been in use from around 1980 to the present, largely replacing competing LAN
standards such as token ring, FDDI, and ARCNET. [2]
2.4.2. Overview
2. Control registers which are used to control and monitor the ENC28J60.
3. A dual port RAM buffer for received and transmitted data packets.
4. An arbiter to control the access to the RAM buffer when requests are made from
DMA, transmit and receive blocks.
5. The bus interface that interprets data and commands received via the SPI
interface.
6. The MAC (Medium Access Control) module that implements IEEE 802.3
compliant MAC logic.
7. The PHY (Physical Layer) module that encodes and decodes the analog data that
is present on the twisted pair interface. [11]
18
2.4.3. Features
• Supports one 10BASE-T port with automatic polarity detection and correction
2.4.4. Ethernet IC
19
Fig 2.7: Ethernet IC [12]
20
Fig.2.9: Basic circuit diagram of Ethernet
2.5. Oscillator
21
Fig 2.10: Circuit diagram of oscillator
2.6.1. Description
The LM1117 is a series of low dropout voltage regulators with a dropout of 1.2V at
800mA of load current. It has the same pin-out as National Semiconductor's
industry standard LM317.
The LM1117 is available in an adjustable version, which can set the output voltage
from 1.25V to 13.8V with only two external resistors. In addition, it is also
available in five fixed voltages, 1.8V, 2.5V, 2.85V, 3.3V, and 5V.
The LM1117 offers current limiting and thermal shutdown. Its circuit includes a
zener trimmed band gap reference to assure output voltage accuracy to within ±1%.
The LM1117 series is available in LLP, TO-263, SOT-223, TO-220, and TO-252
D-PAK packages. A minimum of 10µF tantalum capacitor is required at the output
to improve the transient response and stability. [14]
2.6.2. Features
22
• Line regulation – 0.2% (max)
• 2.6.3. Applications:
• Battery Charger
2.7. RJ 45
RJ45 is a standard type of connector for network cables. RJ45 connectors are most
commonly seen with Ethernet cables and networks. RJ 45 is also known as
Registered Jack 45.
23
RJ45 connectors feature eight pins to which the wire strands of a cable interface
electrically. Standard RJ-45 pin outs define the arrangement of the individual wires
needed when attaching connectors to a cable. [22]
Several other kinds of connectors closely resemble RJ45 and can be easily confused
for each other. The RJ-11 connectors used with telephone cables, for example, are
only slightly smaller (narrower) than RJ-45 connectors.
24
Fig 2.13: Circuit diagram of Microcontroller and Device Section
25
Fig 2.14: Circuit diagram of Ethernet Controller Section
26
Start
Switch on the power supply and connect the LAN to the demonstration kit
Initialize ports A, C & E as input ports and ports B and D as output ports
ADC conversion
If
If No RD2/RD3/RD4 No
RD0=1 If No
/RD5/RD6/RD
RD1=1 7=1
Yes
Yes
Relay on & Yes
Relay off &
Light is turned Light is Relay on Relay off Turn on the Turn off the
on turned off &Alarm &Alarm off correspondi correspondin
on
ng leds g leds
Conclusions
27
The details about PIC microcontroller and its features, power supply unit, ADC
module, Ethernet Controller, oscillator, voltage regulator and also about the RJ45
have been discussed in this chapter.
Chapter-3
28
Relays and temperature sensors
Introduction
In this chapter, we are going to discuss about the relays & its types and also about
the temperature sensors in detail.
3.1. Relays
3.1.1. Introduction
A relay is an electrical switch that opens and closes under the control of another
electrical circuit. In the original form, the switch is operated by an electromagnet to
open or close one or many sets of contacts. It was invented by Joseph Henry in
1835. Because a relay is able to control an output circuit of higher power than the
input circuit, it can be considered to be, in a broad sense, a form of an electrical
amplifier.[10]
A simple electromagnetic relay, such as the one taken from a car in the first picture,
is an adaptation of an electromagnet. It consists of a coil of wire surrounding a soft
iron core, an iron yoke, which provides a low reluctance path for magnetic flux, a
moveable iron armature, and a set, or sets, of contacts; two in the relay pictured.
The armature is hinged to the yoke and mechanically linked to a moving contact or
contacts. It is held in place by a spring so that when the relay is de-energized there
is an air gap in the magnetic circuit. In this condition, one of the two sets of contacts
in the relay pictured is closed, and the other set is open. Other relays may have
more or fewer sets of contacts depending on their function. The relay in the picture
also has a wire connecting the armature to the yoke. This ensures continuity of the
29
circuit between the moving contacts on the armature, and the circuit track on the
Printed Circuit Board (PCB) via the yoke, which is soldered to the PCB.
When an electric current is passed through the coil, the resulting magnetic field
attracts the armature and the consequent movement of the movable contact or
contacts either makes or breaks a connection with a fixed contact. If the set of
contacts was closed when the relay was de-energized, then the movement opens the
contacts and breaks the connection, and vice versa if the contacts were open. When
the current to the coil is switched off, the armature is returned by a force,
approximately half as strong as the magnetic force, to its relaxed position. Usually
this force is provided by a spring, but gravity is also used commonly in industrial
motor starters. Most relays are manufactured to operate quickly. In a low voltage
application, this is to reduce noise. [1], [10]
If the coil is energized with DC, a diode is frequently installed across the coil, to
dissipate the energy from the collapsing magnetic field at deactivation, which
would otherwise generate a voltage spike dangerous to circuit components. Some
automotive relays already include that diode inside the relay case. Alternatively a
contact protection network, consisting of a capacitor and resistor in series, may
absorb the surge. If the coil is designed to be energized with AC, a small copper
ring can be crimped to the end of the solenoid.
1. Latching relay
30
A latching relay has two relaxed states (bistable). These are also called 'keep' or
'stay' relays. When the current is switched off, the relay remains in its last state.
This is achieved with a solenoid operating a ratchet and cam mechanism, or by
having two opposing coils with an over-center spring or permanent magnet to hold
the armature and contacts in position while the coil is relaxed, or with a remnant
core. In the ratchet and cam example, the first pulse to the coil turns the relay on
and the second pulse turns it off. In the two coil example, a pulse to one coil turns
the relay on and a pulse to the opposite coil turns the relay off. This type of relay
has the advantage that it consumes power only for an instant, while it is being
switched, and it retains its last setting across a power outage.
2. Reed relay
A reed relay has a set of contacts inside a vacuum or inert gas filled glass tube,
which protects the contacts against atmospheric corrosion. The contacts are closed
by a magnetic field generated when current passes through a coil around the glass
tube. Reed relays are capable of faster switching speeds than larger types of relays,
but have low switch current and voltage ratings. See also reed switch.
3. Mercury-wetted relay
A mercury-wetted reed relay is a form of reed relay in which contacts are wetted
with mercury. Such relays are used to switch low-voltage signals because of its low
contact resistance, or for high-speed counting and timing applications where the
mercury eliminates contact bounce. Mercury wetted relays are position-sensitive
and must be mounted vertically to work properly. Because of the toxicity and
expense of liquid mercury, these relays are rarely specified for new equipment.
4. Polarized relay
A Polarized Relay placed the armature between the poles of a permanent magnet to
increase sensitivity. Polarized relays were used in middle 20th Century telephone
exchanges to detect faint pulses and correct telegraphic distortion. The poles were
on screws, so a technician could first adjust them for maximum sensitivity and then
apply a bias spring to set the critical current that would operate the relay.
31
5. Machine tool relay
A machine tool relay is a type standardized for industrial control of machine tools,
transfer machines, and other sequential control. They are characterized by a large
number of contacts (sometimes extendable in the field) which are easily converted
from normally-open to normally-closed status, easily replaceable coils, and a form
factor that allows compactly installing many relays in a control panel. Although
such relays once were the backbone of automation in such industries as automobile
assembly, the programmable logic controller (PLC) mostly displaced the machine
tool relay from sequential control applications.
6. Contactor relay
A contactor is a very heavy-duty relay used for switching electric motors and
lighting loads. High-current contacts are made with alloys containing silver. The
unavoidable arcing causes the contacts to oxidize and silver oxide is still a good
conductor. Such devices are often used for motor starters. A motor starter is a
contactor with overload protection devices attached. The overload sensing devices
are a form of heat operated relay where a coil heats a bi-metal strip, or where a
solder pot melts, releasing a spring to operate auxiliary contacts. These auxiliary
contacts are in series with the coil. If the overload senses excess current in the load,
the coil is de-energized. Contactor relays can be extremely loud to operate, making
them unfit for use where noise is a chief concern.
7. Solid-state relay
32
A solid state relay (SSR) is a solid state electronic component that provides a
similar function to an electromechanical relay but does not have any moving
components, increasing long-term reliability. With early SSR's, the tradeoff came
from the fact that every transistor has a small voltage drop across it. This voltage
drop limited the amount of current a given SSR could handle. As transistors
improved, higher current SSR's, able to handle 100 to 1,200 amps, have become
commercially available. Compared to electromagnetic relays, they may be falsely
triggered by transients.
A solid state contactor is a very heavy-duty solid state relay, including the
necessary heat sink, used for switching electric heaters, small electric motors and
lighting loads; where frequent on/off cycles are required. There are no moving parts
to wear out and there is no contact bounce due to vibration. They are activated by
AC control signals or DC control signals from Programmable logic controller
(PLCs), PCs, transistor transistor logic (TTL) sources, or other microprocessor
controls.
9. Buchholz relay
A Buchholz relay is a safety device sensing the accumulation of gas in large oil-
filled transformers, which will alarm on slow accumulation of gas or shut down the
transformer if gas is produced rapidly in the transformer oil.
A forced-guided contacts relay has relay contacts that are mechanically linked
together, so that when the relay coil is energized or de-energized, all of the linked
contacts move together. If one set of contacts in the relay becomes immobilized, no
other contact of the same relay will be able to move. The function of forced-guided
contacts is to enable the safety circuit to check the status of the relay. Forced-guided
contacts are also known as "positive-guided contacts", "captive contacts", "locked
contacts", or "safety relays".
33
3.1.3. Poles and Throws
• SPST - Single Pole Single Throw. These have two terminals which can be
connected or disconnected. Including two for the coil, such a relay has four terminals
in total. It is ambiguous whether the pole is normally open or normally closed. The
terminology "SPNO" and "SPNC" is sometimes used to resolve the ambiguity.
• DPST - Double Pole Single Throw. These have two pairs of terminals.
Equivalent to two SPST switches or relays actuated by a single coil. Including two for
the coil, such a relay has six terminals in total. The poles may be Form A or Form B
(or one of each).
• DPDT - Double Pole Double Throw. These have two rows of change-over
terminals. Equivalent to two SPDT switches or relays actuated by a single coil. Such a
relay has eight terminals, including the coil.[1]
34
Fig 3.4: Relay operation
Normally-open (NO) contacts connect the circuit when the relay is activated; the
circuit is disconnected when the relay is inactive. It is also called a Form A contact
or "make" contact.
Normally-closed (NC) contacts disconnect the circuit when the relay is activated;
the circuit is connected when the relay is inactive. It is also called a Form B contact
or "break" contact.[6]
Relays are quite common in home appliances where there is an electronic control
turning on something like a motor or a light. They are also common in cars, where
the 12V supply voltage means that just about everything needs a large amount of
current. In later model cars, manufacturers have started combining relay panels into
the fuse box to make maintenance easier. In places where a large amount of power
needs to be switched, relays are often cascaded. In this case, a small relay switches
the power needed to drive a much larger relay, and that second relay switches the
power to drive the load. Relays can also be used to implement Boolean logic.[10]
35
3.2. Relay driver IC (ULN2803)
The eight NPN Darlington connected transistors in this family of arrays are ideally
suited for interfacing between low logic level digital circuitry (such as TTL, CMOS
or PMOS/NMOS) and the higher current/voltage requirements of lamps, relays,
printer hammers or other similar loads for a broad range of computer, industrial,
and consumer applications. All devices feature open–collector outputs and free
wheeling clamp diodes for transient suppression.
The ULN2803 is designed to be compatible with standard TTL families while the
ULN2804 is optimized for 6 to 15 volt high level CMOS or PMOS.
NPN transistor 2N2222 is being used to control the relay. The transistor is driven
into saturation (turned ON) when a LOGIC 1 is written on the PORT PIN thus
turning ON the relay. The relay is turned OFF by writing LOGIC 0 on the port pin.
When the transistor is switched OFF the energy stored in the inductor is dissipated
through the diode & the internal resistance of the relay coil.
36
Fig.3.6: Relay driver circuit
The LM35 series are precision integrated-circuit temperature sensors, whose output
voltage is linearly proportional to the Celsius (Centigrade) temperature
37
3.3.1. Features
Conclusions
The detailed description about the relays & its types and also about the temperature
sensors have been provided in this chapter.
38
Chapter-4
Serial communication
Introduction
Here in this chapter, we are going to discuss in detail about the SPI communication
which includes the description about RS232 pins and MAX232.
Choose a PIC microcontroller and write the code to initialize the USART and use it
to send and receive data. We need to transmit data and it will do the rest. It
transmits data at standard speeds of 9600, 19200 bps etc.The advantage of hardware
USART is that you just need to write the data to one of the registers of USART and
your done, you are free to do other things while USART is transmitting the
byte.USART automatically senses the start of transmission of RX line and then
inputs the whole byte and when it has the byte it informs us (CPU) to read that data
from one of its registers.
4.1. Introduction
o The word serial means, that the information is sent one bit at a time.
o Asynchronous tells us that the information is not sent in predefined time slots.
o Data transfer can start at any given time and it is the task of the receiver to
detect when a message starts and ends.[20]
39
Fig 4.1: Basic view of RS232 cable [21]
40
Fig 4.3: Null modem connection
4.2.1. Voltages
41
o The RS-232 standard (& the COM port) use +12V for logic 0 &–12V for logic
1
4.3. MAX232
4.3.1. Introduction
MAX-232 is primary used for people building electronics with an RS-232 interface.
Serial RS-232 communication works with voltages (-15V ... -3V for high) and
+3V ... +15V for low) which are not compatible with normal computer logic
voltages. To receive serial data from an RS-232 interface the voltage has to be
reduced, and the low and high voltage level inverted. In the other direction (sending
data from some logic over RS-232) the low logic voltage has to be "bumped up",
and a negative voltage has to be generated, too.
42
Fig 4.4: Pin Diagram of Max 232 [19]
The Electronic Industries Alliance (EIA) standard RS-232-C [3] as of 1969 defines:
43
The standard does not define such elements as character encoding (for example,
ASCII, Baudot or EBCDIC), or the framing of characters in the data stream (bits
per character, start/stop bits, parity). The standard does not define protocols for
error detection or algorithms for data compression.
The standard does not define bit rates for transmission, although the standard says it
is intended for bit rates lower than 20,000 bits per second. Many modern devices
can exceed this speed (38,400 and 57,600 bit/s being common, and 115,200 and
230,400 bit/s making occasional appearances) while still using RS-232 compatible
signal levels.
Details of character format and transmission bit rate are controlled by the serial port
hardware, often a single integrated circuit called a UART that converts data from
parallel to serial form. A typical serial port includes specialized driver and receiver
integrated circuits to convert between internal logic levels and RS-232 compatible
signal levels.
In this circuit the MAX 232 IC used as level logic converter. The MAX232 is a dual
driver/receiver that includes a capacitive voltage generator to supply EIA 232
voltage levels from a single 5v supply. Each receiver converts EIA-232 to 5v
TTL/CMOS levels. Each driver converts TLL/CMOS input levels into EIA-232
levels.
44
Fig 4.6: Logic diagram and function tables
In this circuit shown below the microcontroller transmitter pin is connected in the
MAX232 T2IN pin which converts input 5v TTL/CMOS level to RS232 level.
Then T2OUT pin is connected to reviver pin of 9 pin D type serial connector which
is directly connected to PC.
45
V D D
C 11 0 u F
16
2
1 3 1 2
I N 8 R 1 I N R 1 O 9U T
V+
R 2
VC C
R X
1 1 R 2 I N R 2 O 1U 4 T
1 0 T 1 I N T 1 O 7U T T 2 O U T
T X T 2 I N T 2 O U T
1
C 2 3 C + M A X 2 3 2
1 0 u F 4 C 1 - U 1
5 C 2 +
C 2 -
GN D
6
V -
C 3 C 4
15
1 0 u F 1 0 u F
46
the master and slave devices to know whether a received byte is meaningful or not.
So a device must discard the received byte in a "transmit only" frame or generate a
dummy byte for a "receive only" frame.
Conclusions
Chapter-5
Embedded Software
Introduction
In this chapter, we are going to discuss about the Embedded C and software tools
like MPLAB IDE, Flash magic and ORCAD-PCB design and their features.
47
5.1. Introduction
In this chapter all the software’s used to develop the embedded system are
discussed in detail. Firstly the code is written in Embedded C language and it is
converted into machine level language by using MPLAB IDE. The code is
assembled, simulated and debugged using this software. Then finally the code is
dumped into PIC microcontroller by using flash magic programmer. The software
named ORCAD is used mainly to create electronic prints for manufacturing
of printed circuit board (PCB).
5.2. Embedded C
48
Fig 5.1: Screen view of MPLAB IDE
5.3.1. Overview
• Editor: The editor is a full-featured programmer's text editor that also serves as a
window into the debugger.
49
• Assembler/Linker and Language Tools: The assembler can be used standalone
to assemble a single file, or can be used with the linker to build a project from
separate source files, libraries and recompiled objects. The linker is responsible for
positioning the compiled code into memory areas of the target microcontroller.
The project manager organizes the files to be edited and other associated files so
they can be sent to the language tools for assembly or compilation, and ultimately to
a linker. The linker has the task of placing the object code fragments from the
assembler, compiler and libraries into the proper memory areas of the embedded
controller, and ensures that the modules function with each other (or is “linked”).
This entire operation from assembly and compilation through the link process is
called a project “build”.
Source
File
Source
File Individual built
options Object
Individual built File
options Assembler compiler Libraries
Object
File
Assembler
Libraries compiler Linker script
Linker script
Linker
Linker
Debug Executable
File File
Executable
Debug
File
50
It is used to dump the generated code into the microcontroller. The following steps
are followed to dump the code into microcontroller-
6. If we are using program for the first time we need to set up it. Set the COM port
to serial port connected to board of the program, baud rate to 9600, device to
89v51RD2. go to options>advanced options…and click on hardware configuration tab.
make sure that check box is checked so that program will use DTR and RTS lines to
enter ISP mode. Then click OK.
11. After board has been programmed, status bar will display finished. Board can be
turned off and disconnect from serial cable. Move the jumper from ISP to RUN.
51
Fig 5.3: Screen view of Flash Magic [15]
The capability to provide fast and universal design entry makes orcad capture
design entry the most widely used schematic entry system in electronic design
today. Whether used to design a new analog circuit, revise a schematic diagram for
an existing printed circuit board (PCB), or design a digital block diagram with an
HDL module, orcad capture provides the tools needed to enter, modify, and verify
the PCB design. Orcad Capture CIS integrates the Orcad Capture schematic design
application with the features of a component information system (CIS).
52
5.5.1. ORCAD PCB design technologies
ORCAD products have a proven track record of innovation in the PCB personal
productivity market. Available as stand-alone tools or in comprehensive suites, they
allow designers to realize products from conception to manufacturing output. Easy
to use and intuitive, they offer exceptional value, and orcad technology provides
easy migration to the platform.
ORCAD capture CIS is designed to reduce production delays and cost overruns
through efficient management of components. It reduces the time spent searching
existing parts for reuse, manually entering part information content, and
maintaining component data.
Users search parts based on their electrical characteristics and orcad capture CIS
automatically retrieves the associated part. Flexible and scalable, the solution is
quickly implemented.
Orcad capture CIS is ideal for individual design teams or multi-site teams who need
to collaborate across multiple locations, orcad capture CIS gives designers access to
53
correct a part of data early in the design process and enables complete component
specifications to be passed to board designers and other members of the design
team, reducing the potential for downstream errors. It provides access to cost
information so designers can use preferred, lower cost, and in stock parts.
5.5.4. Features:
Schematic editor
The full-featured schematic editor allows users to view and edit multiple schematic
designs in a single session. Design data is easily reused by copying and pasting
within or between schematics. Parts are quickly selected from a comprehensive set
of functional part libraries. Configurable design and electrical rule checkers ensure
design integrity. In-line editing of parts allows pin name and number movement. A
user interface has been provided to add critical constraints for users of the orcad
capture to orcad PCB editor flow.
Project manager
The Project Manager simplifies organizing and tracking the various types of data
generated in the design process. An expanding tree diagram makes it easy to
structure and navigate design files, including those generated by pspice simulators,
orcad capture CIS, and other plug-in. A Creation Wizard guides users through all
the resources available for a specific design flow. Users can navigate the entire
schematic structure and instantly open specific elements a schematic page, part, or
net with the hierarchy browser.
Orcad capture boosts schematic editing efficiency by enabling sub circuit reuse
without having to make multiple copies. Using hierarchical blocks, simply
reference the same sub circuit multiple times. Automatic creation of hierarchical
ports eliminates potential design connection errors. Ports and pins can be updated
dynamically for hierarchical blocks and underlying schematics. Added navigation
utilities recognize block boundaries and accessibility using keyboard shortcuts.
54
Libraries and part editor
The library editor is accessed directly from the orcad capture user interface. Users
can create and edit parts in the library or directly from the schematic page without
interrupting workflow. Intuitive graphical controls speed schematic part creation
and editing. New parts are created quickly by modifying existing ones. New parts
can also be created from spread sheets. A library part generator automates the
integration of field programmable gate arrays (FPGAs) and programmable logic
devices (PLDs) into the system schematic.
Designers can access all part, net, pin, and title block properties, or any subset, and
make changes quickly through the orcad capture spreadsheet property editor. It
simply requires selecting a circuit element, grouped area, or entire page, and then
selecting add/edit/delete part, net, or pin properties.
5.5.5. Benefits
• Imports and exports virtually every commonly used design file format
55
Fig 5.4: Screen view of ORCAD
Conclusions
The details about Embedded C, MPLAB IDE, Flash magic and ORCAD-PCB
design and their features are discussed in detail in this chapter.
56
Chapter 6
Here in this chapter, we are going to discuss in detail about the testing process and
results, conclusions and future scope.
For testing purpose, we are using two systems which are connected through a LAN.
The process of testing involves the following steps:
2. Remove the LAN connection from one computer system and connect it to the
demonstration kit.
3. Make sure that all devices are properly working and the connections are
properly done.
4. Take another system and enter the IP address of Ethernet, which we have
used.
5. Then, we will get a page consisting of information about the devices which
we want to control.
6. Then by simply toggling the Port D pins ON/OFF, we can control the devices
from remote places.
7. We can also get the information about the changes that have been made by
anyone at the host area.
8. This page will also contain the information about the Port B pins.
57
Fig 6.1: Snap shot of our project when it is switched on
58
Fig 6.3: Snap shot of web page consisting of control information
6.2. Conclusions
The project work titled “Wireless Automation Using Low Power Embedded Web
Servers” is been designed successfully and also for the demonstration purpose,
prototype module is constructed and tested, results are found satisfactory. Since it is
a demonstration unit, only a few parameters have been taken for automation.
Similarly only some features are added, but in practice just adding sufficient
hardware and changing the program to suit the parameters added, we can add any
number of parameters. Also in this prototype module the actual ratings of the
equipment used are very small but in real time the required ratings have to be
chosen based on the application.
59
6.3. Future scope
60
References
[1] Vladimir Gurevich, Electrical Relays: Principles and Applications, CRC Press
(Taylor & Francis group), London - New York, 2005, 704 pp.
[2] Howard W. Johnson, Fast Ethernet: Dawn of a new network, Prentice Hall, 1996.
[3] Charles E.Spurgeon, Ethernet: The Definitive Guide, O'Reilly and Associates.
[5] Cady F. M., Software and Hardware Engineering, Motorola M68HC1. New
York: Oxford University Press, 1994.
[6] Rao, Power system protection: Static Relays with Microprocessor Applications,
second edition, India, Tata Mc Graw Hill, 2003.
[8] R. J. Baker, CMOS Circuit Design, Layout, and Simulation, Revised Second
Edition, Wiley-IEEE, 2008.
[10] http://en.wikipedia.org/wiki/Relay
[11] http://en.wikipedia.org/wiki/Ethernet
[12] http://www.ethermanage.com/ethernet/ethernet.html
[13] http://en.wikipedia.org/wiki/PIC_microcontroller
[14] http://ww1.microchip.com/downloads/en/DeviceDoc/39582b.pdf
[15] http://www.flashmagictool.com
[16] http://microcontrollershop.com/product_info.php?products_id=992
61
[17] http://www.national.com/mpf/LM/LM1117.html#Overview
[18] www.national.com/ds/LM/LM35.pdf
[19] www.kmitl.ac.th/~kswichit/MAX232/MAX232.html
[20] http://www.camiresearch.com/Data_Com_Basics/RS232_standard.html
[21] http://www.industrialkeyboard.com/html/adapter-ps2-rs232.html
[22] http://compnetworking.about.com/od/networkcables/g/bldef_rj45.htm
62